From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.help Subject: Re: How do I decode an NROFF file for viewing? Date: Wed, 23 Jul 2008 11:01:29 +1000 Organization: Bah Humbug Message-ID: <874p6hmn12.fsf@blah.blah> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1216774931 15726 80.91.229.12 (23 Jul 2008 01:02:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Jul 2008 01:02:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 23 03:02:59 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KLSks-0000OL-SU for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Jul 2008 03:02:59 +0200 Original-Received: from localhost ([127.0.0.1]:50007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KLSjz-0005sE-Kc for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Jul 2008 21:02:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KLSji-0005s2-TT for help-gnu-emacs@gnu.org; Tue, 22 Jul 2008 21:01:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KLSje-0005rY-Mg for help-gnu-emacs@gnu.org; Tue, 22 Jul 2008 21:01:45 -0400 Original-Received: from [199.232.76.173] (port=45297 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KLSje-0005rV-I8 for help-gnu-emacs@gnu.org; Tue, 22 Jul 2008 21:01:42 -0400 Original-Received: from mailout2-11.pacific.net.au ([125.255.80.138]:50279 helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KLSjd-0003a4-LQ for help-gnu-emacs@gnu.org; Tue, 22 Jul 2008 21:01:42 -0400 Original-Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout2.pacific.net.au (Postfix) with ESMTP id 650B8CC1BC for ; Wed, 23 Jul 2008 11:01:36 +1000 (EST) Original-Received: from blah.blah (ppp2E2C.dyn.pacific.net.au [61.8.46.44]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id A9E3727469 for ; Wed, 23 Jul 2008 11:01:35 +1000 (EST) Original-Received: from gg by blah.blah with local (Exim 4.69) (envelope-from ) id 1KLSjR-00032Y-OG for help-gnu-emacs@gnu.org; Wed, 23 Jul 2008 11:01:29 +1000 In-Reply-To: (Alan Mackenzie's message of "Sat, 19 Jul 2008 18:08:56 +0000 (UTC)") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.2 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:55839 Archived-At: 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)))))) 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))))