changeset 5292:4b1f2e4dcf34

(hack-local-variables-prop-line): If we can't switch-to-buffer in selected window, try another window, then a new frame. (set-visited-file-name): Don't rename-buffer if buffer already has the desired name. (insert-file): Add * to interactive spec.
author Richard M. Stallman <rms@gnu.org>
date Thu, 23 Dec 1993 03:49:15 +0000
parents 872d39813f70
children 346d921eaf3b
files lisp/files.el
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Thu Dec 23 03:47:45 1993 +0000
+++ b/lisp/files.el	Thu Dec 23 03:49:15 1993 +0000
@@ -947,7 +947,16 @@
 	       (or (eq enable-local-variables t)
 		   (and enable-local-variables
 			(save-window-excursion
-			  (switch-to-buffer (current-buffer))
+			  (condition-case nil
+			      (switch-to-buffer (current-buffer))
+			    (error
+			     ;; If we fail to switch in the selected window,
+			     ;; it is probably a minibuffer.
+			     ;; So try another window.
+			     (condition-case nil
+				 (switch-to-buffer-other-window (current-buffer))
+			       (error
+				(switch-to-buffer-other-frame (current-buffer))))))
 			  (y-or-n-p (format "Set local variables as specified in -*- line of %s? "
 					    (file-name-nondirectory buffer-file-name)))))))
 	  (while result
@@ -1091,7 +1100,8 @@
 	(if (eq system-type 'vax-vms)
 	    (setq new-name (downcase new-name)))
 	(setq default-directory (file-name-directory buffer-file-name))
-	(rename-buffer new-name t)))
+	(or (string= new-name (buffer-name))
+	    (rename-buffer new-name t))))
   (setq buffer-backed-up nil)
   (clear-visited-file-modtime)
   (if filename
@@ -1578,7 +1588,7 @@
 This function is meant for the user to run interactively.
 Don't call it from programs!  Use `insert-file-contents' instead.
 \(Its calling sequence is different; see its documentation)."
-  (interactive "fInsert file: ")
+  (interactive "*fInsert file: ")
   (if (file-directory-p filename)
       (signal 'file-error (list "Opening input file" "file is a directory"
 				filename)))