X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/11fdef7d0cf3ef1ce30d1cd09ca9ca9a2b099d20..a3dae87a1b5405d2bffde7c2d829a5dbfc7ff274:/lisp/files.el diff --git a/lisp/files.el b/lisp/files.el index 7b97b73011..6b8a352f20 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -151,6 +151,7 @@ Automatically local in all buffers." :type 'boolean :group 'backup) (make-variable-buffer-local 'buffer-offer-save) +(put 'buffer-offer-save 'permanent-local t) (defcustom find-file-existing-other-name t "Non-nil means find a file under alternative names, in existing buffers. @@ -1341,8 +1342,8 @@ automatically choosing a major mode, use \\[find-file-literally]." (confirm-nonexistent-file-or-buffer))) (let ((value (find-file-noselect filename nil nil wildcards))) (if (listp value) - (mapcar 'switch-to-buffer (nreverse value)) - (switch-to-buffer value)))) + (mapcar #'pop-to-buffer-same-window (nreverse value)) + (pop-to-buffer-same-window value)))) (defun find-file-other-window (filename &optional wildcards) "Edit file FILENAME, in another window. @@ -2060,7 +2061,11 @@ unless NOMODES is non-nil." ((not warn) nil) ((and error (file-attributes buffer-file-name)) (setq buffer-read-only t) - "File exists, but cannot be read") + (if (and (file-symlink-p buffer-file-name) + (not (file-exists-p + (file-chase-links buffer-file-name)))) + "Symbolic link that points to nonexistent file" + "File exists, but cannot be read")) ((not buffer-read-only) (if (and warn ;; No need to warn if buffer is auto-saved @@ -2268,7 +2273,12 @@ since only a single case-insensitive search through the alist is made." ("\\.icn\\'" . icon-mode) ("\\.sim\\'" . simula-mode) ("\\.mss\\'" . scribe-mode) + ;; The Fortran standard does not say anything about file extensions. + ;; .f90 was widely used for F90, now we seem to be trapped into + ;; using a different extension for each language revision. + ;; Anyway, the following extensions are supported by gfortran. ("\\.f9[05]\\'" . f90-mode) + ("\\.f0[38]\\'" . f90-mode) ("\\.indent\\.pro\\'" . fundamental-mode) ; to avoid idlwave-mode ("\\.\\(pro\\|PRO\\)\\'" . idlwave-mode) ("\\.srt\\'" . srecode-template-mode) @@ -2938,16 +2948,7 @@ n -- to ignore the local variables list.") (setq char nil))) (kill-buffer buf) (when (and offer-save (= char ?!) unsafe-vars) - (dolist (elt unsafe-vars) - (add-to-list 'safe-local-variable-values elt)) - ;; When this is called from desktop-restore-file-buffer, - ;; coding-system-for-read may be non-nil. Reset it before - ;; writing to .emacs. - (if (or custom-file user-init-file) - (let ((coding-system-for-read nil)) - (customize-save-variable - 'safe-local-variable-values - safe-local-variable-values)))) + (customize-push-and-save 'safe-local-variable-values unsafe-vars)) (memq char '(?! ?\s ?y)))))) (defun hack-local-variables-prop-line (&optional mode-only) @@ -4698,7 +4699,7 @@ and `view-read-only' is non-nil, enter view mode." (view-mode-enter)) (t (setq buffer-read-only (not buffer-read-only)) (force-mode-line-update))) - (if (vc-backend buffer-file-name) + (if (memq (vc-backend buffer-file-name) '(RCS SCCS)) (message "%s" (substitute-command-keys (concat "File is under version-control; " "use \\[vc-next-action] to check in/out")))))) @@ -4778,7 +4779,10 @@ visited a file in a nonexistent directory. Noninteractively, the second (optional) argument PARENTS, if non-nil, says whether to create parent directories that don't -exist. Interactively, this happens by default." +exist. Interactively, this happens by default. + +If creating the directory or directories fail, an error will be +raised." (interactive (list (read-file-name "Make directory: " default-directory default-directory nil nil) @@ -5564,7 +5568,8 @@ default directory. However, if FULL is non-nil, they are absolute." contents) (while dirs (when (or (null (car dirs)) ; Possible if DIRPART is not wild. - (file-directory-p (directory-file-name (car dirs)))) + (and (file-directory-p (directory-file-name (car dirs))) + (file-readable-p (car dirs)))) (let ((this-dir-contents ;; Filter out "." and ".." (delq nil