0

I just added the following line to my init.el:

(global-set-key (kbd "M-o") 'man)

but it is not enough. Before, if I wanted to perform the shell command equivalent to man 2 read I would do M-x man RET 2 read. Emacs doesn't to like the numbers and spaces, and takes multiple seconds to load it up, whereas M-x man RET read is instantaneous, but not what I want.

What is an easy way to grab a specific numbered man page?

Something where I can see all the reads would be ideal, so that I could do something like M-n within man-mode to browse through my options, or even something that can see whether I'm in a shell buffer, or in C mode and grab the relevant man page.

6
  • 2
    Can you explain what you mean by “Emacs doesn't like the numbers”? Typing “2 read” into the prompt works just fine for me; there’s no extra delay compared to just typing “read”. The space doesn’t do anything unusual either.
    – db48x
    Apr 22, 2023 at 22:10
  • Typing 2 with a space afterward makes emacs hang for several seconds. If I type in read, it won't show up on my screen, but after hitting RET, in an indeterministic amount of time, the man page will load. Apr 22, 2023 at 22:12
  • 1
    That sounds like an unrelated problem; perhaps something to do with how you have set up completion. Comment out that part of your init file and try again without whatever extra completion stuff you had set up. Then at least you can ask questions about the right thing.
    – db48x
    Apr 22, 2023 at 23:03
  • Ah. My init file doesn't have anything to do with completion. I'm running on MacOS Ventura, and installed as a homebrew cask. Apr 22, 2023 at 23:29
  • 1
    M-x man RET 2 read RET works fine for me: no delays. So does M-x man RET read(2) RET. No perceived difference in the timing (but I did not profile them).
    – NickD
    Apr 23, 2023 at 3:03

1 Answer 1

1

Two solutions I have found since posting:

M-x man RET command-name(man-page-number) RET

a.ka., put the number in parentheses, or via

M-x customize RET change Man-switches to -a and use M-n to go through man pages. Found via docs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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