unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Masatake YAMATO <yamato@redhat.com>
To: 6219@debbugs.gnu.org
Subject: bug#6219: Lauching nroff command from nroff-mode
Date: Wed, 19 May 2010 19:32:47 +0900 (JST)	[thread overview]
Message-ID: <20100519.193247.174666647357430990.yamato@redhat.com> (raw)

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@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")






             reply	other threads:[~2010-05-19 10:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 10:32 Masatake YAMATO [this message]
2010-05-20 15:05 ` bug#6219: Lauching nroff command from nroff-mode Chong Yidong
2010-05-21  3:25   ` Masatake YAMATO
2010-08-31 18:05 ` Chong Yidong

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100519.193247.174666647357430990.yamato@redhat.com \
    --to=yamato@redhat.com \
    --cc=6219@debbugs.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).