diff options
| author | Eli Zaretskii | 2008-01-12 14:15:35 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-01-12 14:15:35 +0000 |
| commit | 48d93bebd51abdfd8d70c74d3c03bcbc2e3bb036 (patch) | |
| tree | 821c0d94108b5184e8070b066a4c4209a5353ab4 /lisp/view.el | |
| parent | 26a30fea51c6d583e87cf82f83f4f3545d1a112c (diff) | |
| download | emacs-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.el | 27 |
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. |
| 266 | Return that window to its previous buffer when done. | 266 | When done, return that window to its previous buffer, and kill the |
| 267 | buffer visiting FILE if unmodified and if it wasn't visited before. | ||
| 268 | |||
| 267 | Emacs commands editing the buffer contents are not available; instead, | 269 | Emacs commands editing the buffer contents are not available; instead, |
| 268 | a special set of commands (mostly letters and punctuation) | 270 | a special set of commands (mostly letters and punctuation) |
| 269 | are defined for moving around in the buffer. | 271 | are defined for moving around in the buffer. |
| @@ -273,14 +275,20 @@ For list of all View commands, type H or h while viewing. | |||
| 273 | This command runs the normal hook `view-mode-hook'." | 275 | This 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. |
| 283 | Maybe delete other frame and/or return to previous buffer when done. | 288 | When done, kill the buffer visiting FILE if unmodified and if it wasn't |
| 289 | visited before; also, maybe delete other frame and/or return to previous | ||
| 290 | buffer. | ||
| 291 | |||
| 284 | Emacs commands editing the buffer contents are not available; instead, | 292 | Emacs commands editing the buffer contents are not available; instead, |
| 285 | a special set of commands (mostly letters and punctuation) | 293 | a special set of commands (mostly letters and punctuation) |
| 286 | are defined for moving around in the buffer. | 294 | are defined for moving around in the buffer. |
| @@ -290,9 +298,12 @@ For list of all View commands, type H or h while viewing. | |||
| 290 | This command runs the normal hook `view-mode-hook'." | 298 | This 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 |