emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/view.el,v [EMACS_22_BASE]


From: Eli Zaretskii
Subject: [Emacs-diffs] Changes to emacs/lisp/view.el,v [EMACS_22_BASE]
Date: Sat, 12 Jan 2008 17:16:20 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     Eli Zaretskii <eliz>    08/01/12 17:16:20

Index: view.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/view.el,v
retrieving revision 1.84.2.7
retrieving revision 1.84.2.8
diff -u -b -r1.84.2.7 -r1.84.2.8
--- view.el     12 Jan 2008 14:14:53 -0000      1.84.2.7
+++ view.el     12 Jan 2008 17:16:20 -0000      1.84.2.8
@@ -238,6 +238,12 @@
 
 ;;; Commands that enter or exit view mode.
 
+(defun kill-buffer-if-not-modified (buf)
+  "Like `kill-buffer', but does nothing if the buffer is modified."
+  (let ((buf (or (bufferp buf) (get-buffer buf))))
+    (and buf (not (buffer-modified-p buf))
+        (kill-buffer buf))))
+
 ;;;###autoload
 (defun view-file (file)
   "View FILE in View mode, returning to previous buffer when done.
@@ -258,7 +264,7 @@
        (progn
          (switch-to-buffer buffer)
          (message "Not using View mode because the major mode is special"))
-      (view-buffer buffer (and (not had-a-buf) 'kill-buffer)))))
+      (view-buffer buffer (and (not had-a-buf) 
'kill-buffer-if-not-modified)))))
 
 ;;;###autoload
 (defun view-file-other-window (file)
@@ -279,8 +285,7 @@
        (buf-to-view (find-file-noselect file)))
     (view-buffer-other-window buf-to-view nil
                              (and (not had-a-buf)
-                                  (not (buffer-modified-p buf-to-view))
-                                  'kill-buffer))))
+                                  'kill-buffer-if-not-modified))))
 
 ;;;###autoload
 (defun view-file-other-frame (file)
@@ -302,8 +307,7 @@
        (buf-to-view (find-file-noselect file)))
     (view-buffer-other-frame buf-to-view nil
                             (and (not had-a-buf)
-                                 (not (buffer-modified-p buf-to-view))
-                                 'kill-buffer))))
+                                 'kill-buffer-if-not-modified))))
 
 
 ;;;###autoload




reply via email to

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