From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#8399: 23.3; save-some-buffers ignores buffer names Date: Tue, 25 Aug 2020 15:29:03 +0200 Message-ID: <87imd697mo.fsf@gnus.org> References: <83y63vm0v4.fsf@cs.bham.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="814"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Uday S Reddy , 8399@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 25 15:30:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAZ1f-00005j-DI for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 15:30:11 +0200 Original-Received: from localhost ([::1]:52852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAZ1e-0004Mz-A5 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 09:30:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAZ1W-0004LR-Oi for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 09:30:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAZ1W-00056F-EX for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 09:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kAZ1W-0005NE-AQ for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 09:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Aug 2020 13:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8399 X-GNU-PR-Package: emacs Original-Received: via spool by 8399-submit@debbugs.gnu.org id=B8399.159836215820580 (code B ref 8399); Tue, 25 Aug 2020 13:30:02 +0000 Original-Received: (at 8399) by debbugs.gnu.org; 25 Aug 2020 13:29:18 +0000 Original-Received: from localhost ([127.0.0.1]:60752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAZ0n-0005Lr-N3 for submit@debbugs.gnu.org; Tue, 25 Aug 2020 09:29:17 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:41444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAZ0l-0005Le-KG for 8399@debbugs.gnu.org; Tue, 25 Aug 2020 09:29:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Kj94ga1qBiEwfDCL89n70jfZTfAKaOwtI3w3+A81IAo=; b=nlnOe6hIVcbwdplHZXnejUuyJU weAcgFMA5C4LxtJC7z55M7xbbqQJkZIPcmqms+MrOjjpvpyYvN6zRkIIFtZr1kES14rcciiV6GnI6 cazH2sqoWznOM9VmMNwa5LQ4YIMuPao5UF2dMPmGMsPPFQhoBLhu1WS2T4wyfIMnU+9E=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAZ0a-00064K-Jq; Tue, 25 Aug 2020 15:29:08 +0200 X-Now-Playing: DACM's =?UTF-8?Q?=5FSt=C3=83=C2=A9r=C3=83=C2=A9otypie=5F:?= "Birthday" In-Reply-To: (Stefan Monnier's message of "Thu, 31 Mar 2011 21:01:05 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186282 Archived-At: Stefan Monnier 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