Emacs provides a nice manual viewer which could be used for obtaining documentation for C syscalls (at point with Man-default-man-entry. However, it always starts searching manuals from section 0. How can I configure man viewer so that it will start from section 2, then 3, and then 0?

man 1 perror doesn't make much sense


Emacs defers to the external man command's section choice in the absence of a specific section value.

You can edit the SECTION definition in /etc/manpath.config to modify the default priority order.

You can override that value with the MANSECT environment variable.

Finally, you can override all of that by passing a --sections=list option to the command itself.

(See man man for details.)

For the final approach, you can set the Man-switches variable in Emacs. e.g.:

(setq Man-switches "--sections=2,3,1,n,l,8,3posix,3pm,3perl,5,4,9,6,7")

Note that Emacs re-uses man page buffers where possible, so kill the existing buffers before testing this.

| improve this answer | |

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.