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.

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

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?

  • 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 May 22 '17 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 May 22 '17 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 May 22 '17 at 21:35
  • just add what C-x 0 does to the --eval – sds May 22 '17 at 21:40
  • I tried it but I can't seem to figure out how to separate the commands: pastebin.com/pn0jsL7B The man page is opened by all of them but the other commands aren't executed. When I evaluate any of them in the scratch buffer, they work. – UTF-8 May 22 '17 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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