unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Uday S Reddy <u.s.reddy@cs.bham.ac.uk>, 8399@debbugs.gnu.org
Subject: bug#8399: 23.3; save-some-buffers ignores buffer names
Date: Tue, 25 Aug 2020 15:29:03 +0200	[thread overview]
Message-ID: <87imd697mo.fsf@gnus.org> (raw)
In-Reply-To: <jwvd3l67pr0.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 31 Mar 2011 21:01:05 -0400")

Stefan Monnier <monnier@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





  parent reply	other threads:[~2020-08-25 13:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31 21:33 bug#8399: 23.3; save-some-buffers ignores buffer names Uday S Reddy
2011-04-01  1:01 ` Stefan Monnier
2011-04-01  8:39   ` Uday S Reddy
2011-04-01 14:53     ` Stefan Monnier
2020-08-25 13:29   ` Lars Ingebrigtsen [this message]
2020-08-25 14:01     ` Stefan Monnier
2020-08-25 14:05       ` Stefan Monnier
2020-08-25 14:47         ` Lars Ingebrigtsen
2020-08-25 14:42     ` Eli Zaretskii
2020-08-25 14:48       ` Lars Ingebrigtsen
2020-08-25 15:01         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imd697mo.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=8399@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=u.s.reddy@cs.bham.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).