]> code.delx.au - gnu-emacs/blobdiff - lisp/view.el
Update AUCTeX
[gnu-emacs] / lisp / view.el
index cf9db5293393386e2524d06f158419f7019b8452..b17cd52ae35b19e276955345408364e249f3d7d0 100644 (file)
@@ -137,6 +137,7 @@ subtracted from by `view-mode-exit' when finished viewing the buffer.
 See RETURN-TO-ALIST argument of function `view-mode-exit' for the format of
 `view-return-to-alist'.")
 (make-variable-buffer-local 'view-return-to-alist)
+(put 'view-return-to-alist 'permanent-local t)
 
 (defvar view-exit-action nil
   "nil or a function with one argument (a buffer) called when finished viewing.
@@ -242,9 +243,16 @@ For list of all View commands, type H or h while viewing.
 
 This command runs the normal hook `view-mode-hook'."
   (interactive "fView file: ")
-  (let ((had-a-buf (get-file-buffer file)))
-    (view-buffer (find-file-noselect file)
-                (and (not had-a-buf) 'kill-buffer))))
+  (unless (file-exists-p file) (error "%s does not exist" file))
+  (let ((had-a-buf (get-file-buffer file))
+       (buffer (find-file-noselect file)))
+    (if (eq (with-current-buffer buffer
+             (get major-mode 'mode-class))
+           'special)
+       (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)))))
 
 ;;;###autoload
 (defun view-file-other-window (file)
@@ -258,6 +266,7 @@ For list of all View commands, type H or h while viewing.
 
 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))))
@@ -274,6 +283,7 @@ For list of all View commands, type H or h while viewing.
 
 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))))
@@ -993,4 +1003,5 @@ for highlighting the match that is found."
 
 (provide 'view)
 
+;;; arch-tag: 6d0ace36-1d12-4de3-8de3-1fa3231636d7
 ;;; view.el ends here