0

I basically want what this question asks for. Unfortunately, its answers don't work.

For example, when I do what its most-upvoted answer says, and enter man echo, Emacs opens up and the mini buffer says:

Symbol's function definition is void: \(man\ \"echo\"\)

The only window in Emacs is blank.

The linked question doesn't help either.

I normally use Emacs with its GUI but want to view man pages in the terminal.

Setting the variable $PAGER to emacs doesn't work either. First of all, it's empty or unset by default. If I change it to emacs, subsequent calls to man do result in Emacs (GUI) opening but the scratch buffer is shown, just as if I would normally launch Emacs (I disabled the welcome page, that's why the scratch buffer is shown).

I know that I can launch Emacs, press C-x, enter man, and then enter the name of the man page I want to read. But that takes quite some time and just entering man <page name> into a terminal is much faster.

My computer runs Ubuntu 16.04 (with Linux 4.4.0) and GNU Emacs 24.5.1.

2
  • What does type emacs return on your system?
    – choroba
    Commented May 22, 2017 at 19:57
  • @choroba emacs is /usr/bin/emacs
    – UTF-8
    Commented May 22, 2017 at 21:13

2 Answers 2

2

Starting a new Emacs every time you want to view a man page is an unusual workflow. Most commonly people prefer to re-use a running Emacs:

emacsclient --no-wait -e '(man "man")'

If you truly insist on swimming against the flow, you can do

emacs -Q --eval '(progn (man "man") (delete-window))'     # not recommended

See also Using Emacs for $PAGER?

12
  • But it is the workflow I like. I often use several Emacs windows. I don't use Emacs as a window manager, there already is a window manager built into my system. Your command does actually open the man page in an existing Emacs instance. Is it possible to just launch a new Emacs instance in the terminal the command is executed in?
    – UTF-8
    Commented May 22, 2017 at 21:17
  • 1
    @UTF-8: Using a single emacs instance with many windows (called "frames" in emacs lisp) has numerous benefits (e.g., dynamic completion can use buffers in another frame). It also consumes less resources. However, see edit.
    – sds
    Commented May 22, 2017 at 21:23
  • Thank you for your edit. I added -nw so it doesn't launch the GUI. It opens 2 frames: i.imgur.com/yA0E4fC.png Is it possible to let it execute a C-x 0 automatically so only the frame with the man page buffer is shown?
    – UTF-8
    Commented May 22, 2017 at 21:35
  • just add what C-x 0 does to the --eval
    – sds
    Commented May 22, 2017 at 21:40
  • 1
    Please do not confuse frames, windows and buffers.
    – sds
    Commented May 22, 2017 at 22:17
0

You will need a shell session. Here is how I view man pages in emacs: I use a package called Shell-pop (available in Melpa) I configured it to use eshell and I call it with Ctrl-T. I just type the man (program I want info on) and it pops into anothe window (horizontally or vertically, depending on your set-up)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .