How do I decode an NROFF file for viewing?
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

gnu.emacs.help Profile…
 Up
How do I decode an NROFF file for viewing?         


Author: Alan Mackenzie
Date: Jul 19, 2008 11:08

Hallo, world!

The M-x man command does 2 things:
(i) It finds the pertinent file using complicated, difficult, and
obscure algorithms;
(ii) It converts the markup stuff in the file to a readable form and
displays it.

I have an Nroff file, mount.8, loaded into Emacs. How do I do part
(ii) of the above, and get it nicely displayed?

TIA!

--
Alan Mackenzie (Nuremberg, Germany).
2 Comments
Re: How do I decode an NROFF file for viewing?         


Author: Xah
Date: Jul 19, 2008 13:39

Alan Mackenzie wrote:
> The M-x man command does 2 things:
> (i) It finds the pertinent file using complicated, difficult, and
> obscure algorithms;
> (ii) It converts the markup stuff in the file to a readable form and
> displays it.
>
> I have an Nroff file, mount.8, loaded into Emacs. How do I do part
> (ii) of the above, and get it nicely displayed?

possibly others have elisp answers on the spot. But here's what i
know:

you can use WoMan to read man pages in emacs. The manual-entry command
calls shell tool to do its job. WoMan is written entirely in elisp.
So, this means you could lookup WoMan's source code to see what it
does if you need it.

Alternative solution is to call shell command to process it first then
display the result plain text file in emacs. Here's some tips i wrote
some 10 years ago:

• How to get a text output of a man page?
Show full article (1.59Kb)
no comments
Re: How do I decode an NROFF file for viewing?         


Author: Kevin Ryde
Date: Jul 22, 2008 18:01

Alan Mackenzie writes:
>
> I have an Nroff file, mount.8, loaded into Emacs. How do I do part
> (ii) of the above, and get it nicely displayed?

I use a bit as simple as a "man -l filename" for files:

(defun my-man-preview ()
(interactive)
(my-save-current-buffer-maybe)
(setq Man-notify-method 'pushy)
(man (concat "-l " (buffer-file-name))))

(defun my-save-current-buffer-maybe ()
"Use `save-some-buffers' to save the current buffer, if it's modified."
(interactive)
(let ((my-save-current-buffer-maybe--target (current-buffer)))
(save-some-buffers nil
(lambda ()
(equal my-save-current-buffer-maybe--target
(current-buffer))))))
Show full article (2.29Kb)
no comments