emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101249: * textmodes/nroff-mode.el (n


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101249: * textmodes/nroff-mode.el (nroff-view): New command.
Date: Tue, 31 Aug 2010 14:04:26 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101249
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Tue 2010-08-31 14:04:26 -0400
message:
  * textmodes/nroff-mode.el (nroff-view): New command.
  (nroff-mode-map): Bind it to C-c C-c.
modified:
  lisp/ChangeLog
  lisp/textmodes/nroff-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-08-31 12:22:40 +0000
+++ b/lisp/ChangeLog    2010-08-31 18:04:26 +0000
@@ -1,3 +1,8 @@
+2010-08-31  Masatake YAMATO  <address@hidden>
+
+       * textmodes/nroff-mode.el (nroff-view): New command.
+       (nroff-mode-map): Bind it to C-c C-c.
+
 2010-08-31  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/smie.el (smie-down-list): New command.

=== modified file 'lisp/textmodes/nroff-mode.el'
--- a/lisp/textmodes/nroff-mode.el      2010-01-13 08:35:10 +0000
+++ b/lisp/textmodes/nroff-mode.el      2010-08-31 18:04:26 +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-view)
     (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-view
+                 :help "Run man on this file."))
     map)
   "Major mode keymap for `nroff-mode'.")
 
@@ -301,6 +305,17 @@
   :lighter " Electric"
   (or (derived-mode-p 'nroff-mode) (error "Must be in nroff mode")))
 
+(declare-function Man-getpage-in-background "man" (topic))
+
+(defun nroff-view ()
+  "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")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]