Instead of open many buffers I wish to have the same buffer for all calls to the man.
Asked
Active
Viewed 189 times
3
-
somthing like `dired-find-alternate-file` but for man is desiderable – Francesco Cadei Oct 05 '18 at 16:53
-
I have already `(setq-default Man-notify-method 'pushy)` – Francesco Cadei Oct 05 '18 at 16:55
-
1Define a command that calls `kill-buffer` and then calls `man`... – Drew Oct 06 '18 at 00:34
-
2In the commentary in `man.el` there is a TODO item that says: "Allow a user option to mean that all the manpages should go in the same buffer, where they can be browsed with M-n and M-p." :) – Omar Oct 06 '18 at 00:38
-
I found that what you're asking is the default behaviour of `woman`, an Elisp replacement of man already present in Emacs. (M-x `woman`) – kotchwane May 13 '20 at 18:41
1 Answers
3
Here's a function following @Drew's excellent suggestion:
(defun last-man-standing ()
(interactive)
(kill-matching-buffers "^\*Man .*\*" nil t)
(call-interactively #'man))
A couple of notes:
I used
call-interactively
to preserveman
's fancy guessing of which man page you want.I didn't know that
kill-matching-buffers
existed, but since Emacs often has exactly the function you need I wentC-h f kill-match TAB
and sure enough, it was there.

Omar
- 4,732
- 1
- 17
- 32