# HG changeset patch # User Gerd Moellmann # Date 972400671 0 # Node ID 1e6c5cca37db6c58bf424454f74b0ab79cd4c834 # Parent 81391f75fa8d0865acd8fe2a41476a0dfec736c2 (after-find-file): Don't print any warnings if WARN is nil. diff -r 81391f75fa8d -r 1e6c5cca37db lisp/files.el --- a/lisp/files.el Tue Oct 24 15:11:21 2000 +0000 +++ b/lisp/files.el Tue Oct 24 15:17:51 2000 +0000 @@ -1248,52 +1248,53 @@ nil (let* (not-serious (msg - (cond ((and error (file-attributes buffer-file-name)) - (setq buffer-read-only t) - "File exists, but cannot be read") - ((not buffer-read-only) - (if (and warn - ;; No need to warn if buffer is auto-saved - ;; under the name of the visited file. - (not (and buffer-file-name - auto-save-visited-file-name)) - (file-newer-than-file-p (or buffer-auto-save-file-name - (make-auto-save-file-name)) - buffer-file-name)) - (format "%s has auto save data; consider M-x recover-file" - (file-name-nondirectory buffer-file-name)) - (setq not-serious t) - (if (and warn error) "(New file)" nil))) - ((not error) - (setq not-serious t) - "Note: file is write protected") - ((file-attributes (directory-file-name default-directory)) - "File not found and directory write-protected") - ((file-exists-p (file-name-directory buffer-file-name)) - (setq buffer-read-only nil)) - (t - (setq buffer-read-only nil) - (if (file-exists-p (file-name-directory (directory-file-name (file-name-directory buffer-file-name)))) - "Use M-x make-directory RET RET to create the directory" - "Use C-u M-x make-directory RET RET to create directory and its parents"))))) - (if msg - (progn - (message msg) - (or not-serious (sit-for 1 nil t))))) - (if (and auto-save-default (not noauto)) - (auto-save-mode t))) + (cond + ((not warn) nil) + ((and error (file-attributes buffer-file-name)) + (setq buffer-read-only t) + "File exists, but cannot be read") + ((not buffer-read-only) + (if (and warn + ;; No need to warn if buffer is auto-saved + ;; under the name of the visited file. + (not (and buffer-file-name + auto-save-visited-file-name)) + (file-newer-than-file-p (or buffer-auto-save-file-name + (make-auto-save-file-name)) + buffer-file-name)) + (format "%s has auto save data; consider M-x recover-file" + (file-name-nondirectory buffer-file-name)) + (setq not-serious t) + (if error "(New file)" nil))) + ((not error) + (setq not-serious t) + "Note: file is write protected") + ((file-attributes (directory-file-name default-directory)) + "File not found and directory write-protected") + ((file-exists-p (file-name-directory buffer-file-name)) + (setq buffer-read-only nil)) + (t + (setq buffer-read-only nil) + (if (file-exists-p (file-name-directory (directory-file-name (file-name-directory buffer-file-name)))) + "Use M-x make-directory RET RET to create the directory" + "Use C-u M-x make-directory RET RET to create directory and its parents"))))) + (when msg + (message msg) + (or not-serious (sit-for 1 nil t)))) + (when (and auto-save-default (not noauto)) + (auto-save-mode t))) ;; Make people do a little extra work (C-x C-q) ;; before altering a backup file. - (if (backup-file-name-p buffer-file-name) - (setq buffer-read-only t)) - (if nomodes - nil - (and view-read-only view-mode - (view-mode-disable)) + (when (backup-file-name-p buffer-file-name) + (setq buffer-read-only t)) + (unless nomodes + (when (and view-read-only view-mode) + (view-mode-disable)) (normal-mode t) - (if (and buffer-read-only view-read-only - (not (eq (get major-mode 'mode-class) 'special))) - (view-mode-enter)) + (when (and buffer-read-only + view-read-only + (not (eq (get major-mode 'mode-class) 'special))) + (view-mode-enter)) (run-hooks 'find-file-hooks))) (defun normal-mode (&optional find-file)