Unable to put manuals open at Emacs directly from terminal

237 Views Asked by At

I want to open manuals directly in Terminal to Emacs by

man man

I put the following code as an alias in .zshrc unsuccessfully

alias man=x
unalias man  
man() { emacs ^x man }

How can you open manuals to emacs?

4

There are 4 best solutions below

0
On BEST ANSWER

Perhaps this is what you mean:

function man() { emacs -eval "(progn (setq Man-notify-method 'bully) (man \"$1\"))" }

The setq is there just to make the manual page hide the *scratch* buffer; if you don't want that, it is enough to do

function man() { emacs -eval "(man \"$1\")" }

If you want to call Emacs functions from the command line, you must write the function call in elisp; you can't just give Emacs key sequences on the command line.

0
On

I'm not sure I completely understand your question, but you can open a man page in emacs by simply doing M-x man followed by the man page you want to view. If you want to do this directly from the command line I imagine it would not be too difficult to set up a script to do this.

0
On

A few possibilities, depending on how you want the man pages formatted:

man man > /tmp/man
emacs /tmp/man

or

zcat `man -w man` | nroff > /tmp/man
emacs /tmp/man

or

emacs `man -w man`
0
On
alias man 'emacs -e man'

Check out this part of the info pages (and the following sections) for more information.