diff options
author | Kan-Ru Chen <kanru@kanru.info> | 2010-09-17 21:25:31 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2010-09-17 21:25:31 -0400 |
commit | dbbd7ad43914c269bee90e1d6c08185dc2bdf7a5 (patch) | |
tree | b879064b5ceeb029dc81224442c90c398d4e54b0 /lisp/textmodes/nroff-mode.el | |
parent | b879a6e2974d913d0c6dc1e290b2c246d7888b4f (diff) | |
download | emacs-dbbd7ad43914c269bee90e1d6c08185dc2bdf7a5.tar.gz |
* textmodes/nroff-mode.el (nroff-view): Kill old buffer before refreshing the preview buffer.
Diffstat (limited to 'lisp/textmodes/nroff-mode.el')
-rw-r--r-- | lisp/textmodes/nroff-mode.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el index 14b0b106bb3..52538064053 100644 --- a/lisp/textmodes/nroff-mode.el +++ b/lisp/textmodes/nroff-mode.el @@ -311,10 +311,16 @@ turns it on if arg is positive, otherwise off." "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")))) + (let* ((file (buffer-file-name)) + (viewbuf (get-buffer (concat "*Man " file "*")))) + (unless file + (error "Buffer is not associated with any file")) + (and (buffer-modified-p) + (y-or-n-p (format "Save buffer %s first? " (buffer-name))) + (save-buffer)) + (if viewbuf + (kill-buffer viewbuf)) + (Man-getpage-in-background file))) ;; Old names that were not namespace clean. (define-obsolete-function-alias 'count-text-lines 'nroff-count-text-lines "22.1") |