From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74709: [PATCH] Avoid empty unique qualifier in buffer name Date: Fri, 06 Dec 2024 13:17:31 +0100 Message-ID: <87wmgdj99g.fsf@ledu-giraud.fr> Reply-To: Manuel Giraud Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16370"; mail-complaints-to="usenet@ciao.gmane.io" To: 74709@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 06 13:18:27 2024 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 1tJXHu-00040P-Kk for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 Dec 2024 13:18:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJXHa-000427-FL; Fri, 06 Dec 2024 07:18:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJXHX-00041c-9p for bug-gnu-emacs@gnu.org; Fri, 06 Dec 2024 07:18:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJXHX-0001FN-0A for bug-gnu-emacs@gnu.org; Fri, 06 Dec 2024 07:18:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=WRRg0qSwBUnqc7br7vtQ9DVsfea88JwTTb3TGAn+PqE=; b=gLngLi+P6QqGHWBrzKj8YnT8lTG7jFkLO17/xharMLRyQEl5SXf6xixP9UxPFtnX4fy8P2Yo8GXpk5+Xla7Copa985aiKdrj3SCzL2PelDAW1vJ1mMqP+2jOyC2KgDodujpmjaSEVM42C7eeok7ZEmxjKtq8pvxT5/w2Ei7XagsuxY7OXauzkrhPRR+HspzrCXnAJYFl2QGcR5XNRDL8/EjFmRu3Of2ggCILNs5paLrO7mxn3Zq1YiQNm6f7OZNHNvx4PRV+owp/5MyxHc1gEcXqWY9+itFZJrVnfn46C3yRhg9hGdR7MK97vdzZvnvdUw8MLj+Ma/Kh2it/J8Iu6w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tJXHW-0005iz-KE for bug-gnu-emacs@gnu.org; Fri, 06 Dec 2024 07:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Dec 2024 12:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74709 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173348746721975 (code B ref -1); Fri, 06 Dec 2024 12:18:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Dec 2024 12:17:47 +0000 Original-Received: from localhost ([127.0.0.1]:42265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJXHH-0005iM-9k for submit@debbugs.gnu.org; Fri, 06 Dec 2024 07:17:47 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:34272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJXHD-0005iB-BE for submit@debbugs.gnu.org; Fri, 06 Dec 2024 07:17:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJXHC-00040c-Hv for bug-gnu-emacs@gnu.org; Fri, 06 Dec 2024 07:17:42 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJXH8-0000sY-T0 for bug-gnu-emacs@gnu.org; Fri, 06 Dec 2024 07:17:42 -0500 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=u1ms+HvV nWAtMflyAvDkhzd5j9+lnK9kYUCLGMBVAQM=; h=date:subject:to:from; d=ledu-giraud.fr; b=bd+tpRs3l/LuJHHwfiNGDu1iSmuhp5IUYqEiBWUwkBvyubK9x3 ElHfCu1bpet8Ycc64sewes5n4F0xxtcjy9Ag== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=u1ms+HvVnWAtMfly AvDkhzd5j9+lnK9kYUCLGMBVAQM=; h=date:subject:to:from; d=ledu-giraud.fr; b=vhHiDMRtNH6cuCcqmSLUjnMgmLSj97yAahXE6rGzFKQ4RMCVfC n88L5v0TC9lO4mMrp0qT1sc/dLe1kGXpfFHkKgNii0Lkz+5zSZCJND7dceonmrtLw6xPuo uvBd6DKUwn8k600azTaQwHAxfPhtiF499cNBCdwmnmq6DoIr1wInXEFU2/I9Tby0IMAGXT qK8+48pFz05lTLvJg1QvKpLGeTs1Btvb64WK+H2LBPZ8ZsVrxrxdBU1xqdLQN8EExpFseC nx+aaonv/0zApCf10Q95CpQ+slSolmWirBTXtrRdprTtL7nqMwWVT+zOgJO//2l2kIaiJN TzKbGl0XjFSg== Original-Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 8edb7dcb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 6 Dec 2024 13:17:33 +0100 (CET) Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296499 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Hi, This patch prevents from having an empty unique qualifier in the buffer name. Maybe this could happen with others file buffer as well but, most of the time, you could witness it with Dired buffer in homedir. Here is a recipe: - emacs -Q - C-x d /ssh:somewhere: ;; This buffer is named "~" - C-x d /~/ ;; This buffer is named "~<>" With this patch, the last buffer will simply be named "~" instead. In GNU Emacs 31.0.50 (build 26, x86_64-unknown-openbsd7.6, X toolkit) of 2024-12-06 built on computer Repository revision: 2c1dfba7feb67c39299da0579a2be7ff14e13ccb Repository branch: mgi/unique Windowing system distributor 'The X.Org Foundation', version 11.0.12101014 System Description: OpenBSD computer 7.6 GENERIC.MP#458 amd64 Configured using: 'configure CC=egcc CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs --bindir=/home/manuel/bin --with-x-toolkit=lucid --with-toolkit-scroll-bars=no --without-cairo --without-compress-install' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Avoid-empty-unique-qualifier-in-buffer-name.patch >From 70b7e0afe02669df44fd719c2ab35561b565f2df Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Fri, 6 Dec 2024 12:01:29 +0100 Subject: [PATCH] Avoid empty unique qualifier in buffer name * lisp/uniquify.el (uniquify-get-proposed-name): If the unique qualifier will end up being empty just return the base name. --- lisp/uniquify.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/uniquify.el b/lisp/uniquify.el index efe42762a6b..677270d6a91 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -397,7 +397,10 @@ uniquify-get-proposed-name (setq uniquify-possibly-resolvable t)) (cond - ((null extra-string) base) + ((or (null extra-string) + (and (= 1 (length extra-string)) + (string= "" (car extra-string)))) + base) ((string-equal base "") ;Happens for dired buffers on the root directory. (mapconcat #'identity extra-string "/")) ((eq uniquify-buffer-name-style 'reverse) -- 2.47.0 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--