From: Lars Ingebrigtsen Date: Tue, 25 Aug 2020 14:47:10 +0000 (+0200) Subject: Possibly mention both file and buffer names in save-some-buffers X-Git-Tag: emacs-28.0.90~6410 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6d10b607d094bfd29b9ce0c4baf469e3683c3ac6;p=emacs.git Possibly mention both file and buffer names in save-some-buffers * lisp/files.el (save-some-buffers): If the file and buffer names are dissimilar, mention both their names (bug#8399). --- diff --git a/lisp/files.el b/lisp/files.el index b6abafa4bd0..f1931c7d92f 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5566,10 +5566,28 @@ change the additional actions you can take on files." t (setq queried t) (if (buffer-file-name buffer) - (format "Save file %s? " - (buffer-file-name buffer)) - (format "Save buffer %s? " - (buffer-name buffer)))))) + (if (or + (equal (buffer-name buffer) + (file-name-nondirectory + (buffer-file-name buffer))) + (string-match + (concat "\\<" + (regexp-quote + (file-name-nondirectory + buffer-file-name)) + "<[0-9]+>\\'") + (buffer-name buffer))) + ;; The buffer name is similar to the + ;; file name. + (format "Save file %s? " + (buffer-file-name buffer)) + ;; The buffer and file names are + ;; dissimilar; display both. + (format "Save file %s (buffer %s)? " + (buffer-file-name buffer) + (buffer-name buffer))) + ;; No file name + (format "Save buffer %s? " (buffer-name buffer)))))) (lambda (buffer) (with-current-buffer buffer (save-buffer)))