aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/view.el
diff options
context:
space:
mode:
authorEli Zaretskii2008-01-12 14:15:35 +0000
committerEli Zaretskii2008-01-12 14:15:35 +0000
commit48d93bebd51abdfd8d70c74d3c03bcbc2e3bb036 (patch)
tree821c0d94108b5184e8070b066a4c4209a5353ab4 /lisp/view.el
parent26a30fea51c6d583e87cf82f83f4f3545d1a112c (diff)
downloademacs-48d93bebd51abdfd8d70c74d3c03bcbc2e3bb036.tar.gz
emacs-48d93bebd51abdfd8d70c74d3c03bcbc2e3bb036.zip
(view-file-other-window, view-file-other-frame): Don't kill the buffer if it
is modified. Doc fixes.
Diffstat (limited to 'lisp/view.el')
-rw-r--r--lisp/view.el27
1 files changed, 19 insertions, 8 deletions
diff --git a/lisp/view.el b/lisp/view.el
index 8701decf41c..d2a7d5c9b44 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -263,7 +263,9 @@ This command runs the normal hook `view-mode-hook'."
263;;;###autoload 263;;;###autoload
264(defun view-file-other-window (file) 264(defun view-file-other-window (file)
265 "View FILE in View mode in another window. 265 "View FILE in View mode in another window.
266Return that window to its previous buffer when done. 266When done, return that window to its previous buffer, and kill the
267buffer visiting FILE if unmodified and if it wasn't visited before.
268
267Emacs commands editing the buffer contents are not available; instead, 269Emacs commands editing the buffer contents are not available; instead,
268a special set of commands (mostly letters and punctuation) 270a special set of commands (mostly letters and punctuation)
269are defined for moving around in the buffer. 271are defined for moving around in the buffer.
@@ -273,14 +275,20 @@ For list of all View commands, type H or h while viewing.
273This command runs the normal hook `view-mode-hook'." 275This command runs the normal hook `view-mode-hook'."
274 (interactive "fIn other window view file: ") 276 (interactive "fIn other window view file: ")
275 (unless (file-exists-p file) (error "%s does not exist" file)) 277 (unless (file-exists-p file) (error "%s does not exist" file))
276 (let ((had-a-buf (get-file-buffer file))) 278 (let ((had-a-buf (get-file-buffer file))
277 (view-buffer-other-window (find-file-noselect file) nil 279 (buf-to-view (find-file-noselect file)))
278 (and (not had-a-buf) 'kill-buffer)))) 280 (view-buffer-other-window buf-to-view nil
281 (and (not had-a-buf)
282 (not (buffer-modified-p buf-to-view))
283 'kill-buffer))))
279 284
280;;;###autoload 285;;;###autoload
281(defun view-file-other-frame (file) 286(defun view-file-other-frame (file)
282 "View FILE in View mode in another frame. 287 "View FILE in View mode in another frame.
283Maybe delete other frame and/or return to previous buffer when done. 288When done, kill the buffer visiting FILE if unmodified and if it wasn't
289visited before; also, maybe delete other frame and/or return to previous
290buffer.
291
284Emacs commands editing the buffer contents are not available; instead, 292Emacs commands editing the buffer contents are not available; instead,
285a special set of commands (mostly letters and punctuation) 293a special set of commands (mostly letters and punctuation)
286are defined for moving around in the buffer. 294are defined for moving around in the buffer.
@@ -290,9 +298,12 @@ For list of all View commands, type H or h while viewing.
290This command runs the normal hook `view-mode-hook'." 298This command runs the normal hook `view-mode-hook'."
291 (interactive "fIn other frame view file: ") 299 (interactive "fIn other frame view file: ")
292 (unless (file-exists-p file) (error "%s does not exist" file)) 300 (unless (file-exists-p file) (error "%s does not exist" file))
293 (let ((had-a-buf (get-file-buffer file))) 301 (let ((had-a-buf (get-file-buffer file))
294 (view-buffer-other-frame (find-file-noselect file) nil 302 (buf-to-view (find-file-noselect file)))
295 (and (not had-a-buf) 'kill-buffer)))) 303 (view-buffer-other-frame buf-to-view nil
304 (and (not had-a-buf)
305 (not (buffer-modified-p buf-to-view))
306 'kill-buffer))))
296 307
297 308
298;;;###autoload 309;;;###autoload