tags:

views:

102

answers:

4

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?

+1  A: 

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.

luapyad
A: 

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`
Chris Dolan
+1  A: 
alias man 'emacs -e man'

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

Trey Jackson
+4  A: 

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.

Jouni K. Seppänen
Thank you for your answer!
Masi