I am using emacs to read man pages.

macsman() {
    emacsclient -nw -e "(let ((Man-notify-method 'bully)) (man \"$1\"))"
alias man=macsman

(define-key Man-mode-map "q" 'save-buffers-kill-emacs)

While man buffer is opened, when I press q it usually exits.

It is bound to If the current frame has no client, kill Emacs itself using ‘save-buffers-kill-emacs’.

After running ex: man ls and pressing "q" in order to exit and get back to my shell, I find myself in *Messages* buffer, than pressing q again opens the man page again, and finally pressing q exits emacs. What may be the reason of this?

Would it be possible to exit right away by preventing opening *Messages* buffer?

  • Sorry, its bound to save-buffers-kill-emacs
    – alper
    Commented Oct 19, 2021 at 9:57

1 Answer 1


If you're just popping in and out for the man page, you don't need the save-buffers-kill-emacs because there are no buffers to save. Just unconditionally kill Emacs.

Command: kill-emacs &optional exit-data

This command calls the hook kill-emacs-hook, then exits the Emacs 
process and kills it.

If exit-data is an integer, that is used as the exit status of the       
Emacs process. (This is useful primarily in batch operation; see Batch   

If exit-data is a string, its contents are stuffed into the terminal 
input buffer so that the shell (or whatever program next reads input)  
can read them.

If exit-data is neither an integer nor a string, or is omitted, that 
means to use the (system-specific) exit status which indicates 
successful program termination. 
  • Thanks! Yes I was just popping in and out for the man page. Seems like kill-emacs also kill the emacs daemon, would it be possible to keep emacs daemon running
    – alper
    Commented Oct 20, 2021 at 9:31
  • No but I believe there's a restart if stopped switch for the daemon. Commented Oct 22, 2021 at 2:10
  • Does restart completely kills the emacs daemon?
    – alper
    Commented Oct 22, 2021 at 9:53
  • The idea is that if Emacs detects that the daemon has been stopped, it restarts it. Commented Oct 22, 2021 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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