emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] nroff-mode.el (nroff-view): Kill old buffer before refresh the p


From: Kan-Ru Chen
Subject: [PATCH] nroff-mode.el (nroff-view): Kill old buffer before refresh the preview buffer.
Date: Tue, 14 Sep 2010 01:09:45 +0800

Currently calling nroff-view always return the previous generated
buffer. Kill the old buffer first so it can be updated.

Signed-off-by: Kan-Ru Chen <address@hidden>
---
 lisp/ChangeLog               |    5 +++++
 lisp/textmodes/nroff-mode.el |    9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3c3ce90..c46c7f1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-14  Kan-Ru Chen <address@hidden>
+
+       * textmodes/nroff-mode.el (nroff-view): Kill old buffer before
+       refresh the preview buffer.
+
 2010-09-13  Michael Albinus  <address@hidden>
 
        Major code cleanup.  Split tramp.el into tramp.el and tramp-sh.el.
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index 14b0b10..c84699c 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -311,9 +311,14 @@ turns it on if arg is positive, otherwise off."
   "Run man on this file."
   (interactive)
   (require 'man)
-  (let* ((file (buffer-file-name)))
+  (let* ((file (buffer-file-name))
+         (bufname (concat "*Man " file "*"))
+         (buffer (get-buffer bufname)))
     (if file
-       (Man-getpage-in-background file)
+       (progn
+          (if buffer
+              (kill-buffer buffer))
+          (Man-getpage-in-background file))
       (error "No associated file for the current buffer"))))
 
 ;; Old names that were not namespace clean.
-- 
1.7.1




reply via email to

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