From: Kevin Ryde <user42@zip.com.au>
To: help-gnu-emacs@gnu.org
Subject: Re: How do I decode an NROFF file for viewing?
Date: Wed, 23 Jul 2008 11:01:29 +1000 [thread overview]
Message-ID: <874p6hmn12.fsf@blah.blah> (raw)
In-Reply-To: <g5tajo$28he$1@colin2.muc.de> (Alan Mackenzie's message of "Sat, 19 Jul 2008 18:08:56 +0000 (UTC)")
Alan Mackenzie <acm@colin2.muc.de> 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))))))
I had a similar bit with woman (below) in the past, trying to get it to
preserve the window position in a re-preview (might be slightly broken),
but I think I ended up preferring plain man plus
(setq Man-switches "-Tlatin1").
My perl-pod-preview.el has some hairier stuff preserving the window
position and working from a buffer (from pod2man in its case) instead of
a file. The guts of it is a call-process-region with "man -Tlatin1 -l -"
then Man-fontify-manpage and Man-mode.
(defun my-man-preview-woman ()
(interactive)
(my-save-current-buffer-maybe)
(my-woman-find-or-revert (buffer-file-name)))
(defun my-woman-find-or-revert (filename)
(let ((bufname
(concat "*WoMan "
(file-name-extension filename)
" "
(file-name-sans-extension (file-name-nondirectory filename))
"*")))
(if (get-buffer bufname)
(progn
(switch-to-buffer bufname)
(let* ((point-column (current-column))
(point-line (progn
(beginning-of-line)
(1+ (count-lines (point-min) (point)))))
(start-line (count-lines (point-min) (window-start))))
(kill-buffer (current-buffer))
(woman-find-file filename)
(goto-line start-line)
(set-window-start (selected-window) (point))
(goto-line point-line)
(move-to-column point-column)))
(woman-find-file filename))))
prev parent reply other threads:[~2008-07-23 1:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-19 18:08 How do I decode an NROFF file for viewing? Alan Mackenzie
2008-07-19 20:39 ` Xah
2008-07-23 1:01 ` Kevin Ryde [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874p6hmn12.fsf@blah.blah \
--to=user42@zip.com.au \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.