2

Instead of open many buffers I wish to have the same buffer for all calls to the man.

5
  • somthing like dired-find-alternate-file but for man is desiderable Oct 5 '18 at 16:53
  • I have already (setq-default Man-notify-method 'pushy) Oct 5 '18 at 16:55
  • 1
    Define a command that calls kill-buffer and then calls man...
    – Drew
    Oct 6 '18 at 0:34
  • 2
    In 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 6 '18 at 0: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
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:

  1. I used call-interactively to preserve man's fancy guessing of which man page you want.

  2. I didn't know that kill-matching-buffers existed, but since Emacs often has exactly the function you need I went C-h f kill-match TAB and sure enough, it was there.

1
  • and then: (bind-key [remap man] 'last-man-standing)
    – Heikki
    Oct 6 '18 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.