TransWikia.com

How to exit emacs with `q` when man inside emacs is opened

Emacs Asked on September 2, 2021

Default behavior of man <command> (opens inside less) when q is pressed it is closed.


I am using following to open MANPAGER with emacs:

emacsclient -nw -e "(let ((Man-notify-method 'bully)) (man "$1"))"

Here pressing q closes buffer but does not close the emacs like Ctrl-x Ctrl-c does. Is it possible to bind q into the same action Ctrl-x Ctrl-c to exit the emacs and get back to shell.

One Answer

the incantation you want is

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

I am guessing that you can do this inside your let form.

emacsclient -nw -e "(let ((Man-notify-method 'bully)) (man "$1") (define-key Man-mode-map "q" 'save-buffers-kill-emacs))"

Correct answer by Aidan Schofield on September 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP