GNU bug report logs - #8399
23.3; save-some-buffers ignores buffer names

Previous Next

Package: emacs;

Reported by: Uday S Reddy <u.s.reddy <at> cs.bham.ac.uk>

Date: Thu, 31 Mar 2011 21:34:02 UTC

Severity: minor

Tags: fixed

Found in version 23.3

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Uday S Reddy <u.s.reddy <at> cs.bham.ac.uk>, 8399 <at> debbugs.gnu.org
Subject: bug#8399: 23.3; save-some-buffers ignores buffer names
Date: Tue, 25 Aug 2020 15:29:03 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> The attached patch (on Emacs-23 head) modifies the dialogue so that
>> file-names are used in the dialogue only when they coincide with the
>> buffer names.  Otherwise, buffer names are used preferentially.
>
> I think the file-name is only useful when you have buffer "file",
> "file<2>", "file<3>", ... so your check is going in the right direction
> but it should also use file-name when the buffer name matches
> (concat "\\<" (regexp-quote (file-name-nondirectory buffer-file-name))
> "<[0-9]+>\\'"), and it should never use file-names when uniquify
> is used.
> IMNSHO,
>
>         Stefan

Did I get the gist right below?  I'm not really sure about whether it's
useful to prefer the buffer names in this way, though -- the use case
here was VM, which has meaningful buffer names that visit obscure
files...  but is that normal?  Isn't it more useful to know what files
you're saving to, and not what buffers they're coming from?

diff --git a/lisp/files.el b/lisp/files.el
index b6abafa4bd..4110412b47 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5565,7 +5565,20 @@ save-some-buffers
                         (if arg
                             t
                           (setq queried t)
-                          (if (buffer-file-name buffer)
+                          (if (and
+                               (buffer-file-name buffer)
+                               (not uniquify-buffer-name-style)
+                               (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))))
                               (format "Save file %s? "
                                       (buffer-file-name buffer))
                             (format "Save buffer %s? "


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 274 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.