GNU bug report logs - #6219
Lauching nroff command from nroff-mode

Previous Next

Package: emacs;

Reported by: Masatake YAMATO <yamato <at> redhat.com>

Date: Wed, 19 May 2010 13:14:02 UTC

Severity: wishlist

Tags: patch

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Masatake YAMATO <yamato <at> redhat.com>
To: 6219 <at> debbugs.gnu.org
Subject: bug#6219: Lauching nroff command from nroff-mode
Date: Wed, 19 May 2010 19:32:47 +0900 (JST)
This is not a bug report. This a request to review a patch to
include the official emacs source tree.

This patch provides the way to nroff-mode user to preview one's
document quickly.

2010-04-04  Masatake YAMATO  <yamato <at> redhat.com>

	* textmodes/nroff-mode.el (nroff-preview-as-man-page): Add new function.
	(nroff-mode-map): Put `nroff-preview-as-man-page' to the key map and
	menu map.

=== modified file 'lisp/textmodes/nroff-mode.el'
--- lisp/textmodes/nroff-mode.el	2010-01-13 08:35:10 +0000
+++ lisp/textmodes/nroff-mode.el	2010-04-04 21:14:58 +0000
@@ -55,6 +55,7 @@
     (define-key map "\n"  'nroff-electric-newline)
     (define-key map "\en" 'nroff-forward-text-line)
     (define-key map "\ep" 'nroff-backward-text-line)
+    (define-key map "\C-c\C-c" 'nroff-preview-as-man-page)
     (define-key map [menu-bar nroff-mode] (cons "Nroff" menu-map))
     (define-key menu-map [nn]
       '(menu-item "Newline" nroff-electric-newline
@@ -73,6 +74,9 @@
 		  nroff-electric-mode
 		  :help "Auto insert closing requests if necessary"
 		  :button (:toggle . nroff-electric-mode)))
+    (define-key menu-map [npm]
+      '(menu-item "Preview as man page" nroff-preview-as-man-page
+		  :help "Run man on this file."))
     map)
   "Major mode keymap for `nroff-mode'.")
 
@@ -301,6 +305,15 @@
   :lighter " Electric"
   (or (derived-mode-p 'nroff-mode) (error "Must be in nroff mode")))
 
+(defun nroff-preview-as-man-page ()
+  "Run man on this file."
+  (interactive)
+  (require 'man)
+  (let* ((file (buffer-file-name)))
+    (if file
+	(Man-getpage-in-background file)
+      (error "No associated file for the current buffer"))))
+	 
 ;; Old names that were not namespace clean.
 (define-obsolete-function-alias 'count-text-lines 'nroff-count-text-lines "22.1")
 (define-obsolete-function-alias 'forward-text-line 'nroff-forward-text-line "22.1")





This bug report was last modified 14 years and 328 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.