Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view man pages using emacs when invoking man command in command line?

I would like to view man pages using emacs when invoking man command. I modified the pager parameter in /etc/man.conf PAGER to emacs.

But, it doesn't work. Is there anything I should modify ?

like image 585
user832953 Avatar asked Dec 28 '22 00:12

user832953


1 Answers

Indeed, emacs cannot read STDIN into a buffer, meaning

cat foobar | emacs

does not work in any case. So setting your PAGER variable to 'emacs', or 'emacs -nw' does not do the job. Only way around I see is to write the man output into a tmp-file and then load that file into emacs:

man find > tmp-file; emacs tmp-file

You could alias this. For example, assuming a tc-shell, and a directory called 'tmp' in your home-path, you can put the following line into your ~/.tcshrc file:

alias man '/usr/bin/man \!* > ~/tmp/tmp-file; emacs ~/tmp/tmp-file; rm ~/tmp/tmp-file'

So next time you call man find, emacs will fire up.

like image 59
Klaus Avatar answered Apr 28 '23 06:04

Klaus