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 14:14:54 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     Eli Zaretskii <eliz>    08/01/12 14:14:53

Index: view.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/view.el,v
retrieving revision 1.84.2.6
retrieving revision 1.84.2.7
diff -u -b -r1.84.2.6 -r1.84.2.7
--- view.el     7 Jan 2008 02:44:06 -0000       1.84.2.6
+++ view.el     12 Jan 2008 14:14:53 -0000      1.84.2.7
@@ -263,7 +263,9 @@
 ;;;###autoload
 (defun view-file-other-window (file)
   "View FILE in View mode in another window.
-Return that window to its previous buffer when done.
+When done, return that window to its previous buffer, and kill the
+buffer visiting FILE if unmodified and if it wasn't visited before.
+
 Emacs commands editing the buffer contents are not available; instead,
 a special set of commands (mostly letters and punctuation)
 are defined for moving around in the buffer.
@@ -273,14 +275,20 @@
 This command runs the normal hook `view-mode-hook'."
   (interactive "fIn other window view file: ")
   (unless (file-exists-p file) (error "%s does not exist" file))
-  (let ((had-a-buf (get-file-buffer file)))
-    (view-buffer-other-window (find-file-noselect file) nil
-                             (and (not had-a-buf) 'kill-buffer))))
+  (let ((had-a-buf (get-file-buffer file))
+       (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))))
 
 ;;;###autoload
 (defun view-file-other-frame (file)
   "View FILE in View mode in another frame.
-Maybe delete other frame and/or return to previous buffer when done.
+When done, kill the buffer visiting FILE if unmodified and if it wasn't
+visited before; also, maybe delete other frame and/or return to previous
+buffer.
+
 Emacs commands editing the buffer contents are not available; instead,
 a special set of commands (mostly letters and punctuation)
 are defined for moving around in the buffer.
@@ -290,9 +298,12 @@
 This command runs the normal hook `view-mode-hook'."
   (interactive "fIn other frame view file: ")
   (unless (file-exists-p file) (error "%s does not exist" file))
-  (let ((had-a-buf (get-file-buffer file)))
-    (view-buffer-other-frame (find-file-noselect file) nil
-                            (and (not had-a-buf) 'kill-buffer))))
+  (let ((had-a-buf (get-file-buffer file))
+       (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))))
 
 
 ;;;###autoload




reply via email to

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