bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56693: 29.0.50; write-file does not respect uniquify.el


From: Gabriel
Subject: bug#56693: 29.0.50; write-file does not respect uniquify.el
Date: Fri, 22 Jul 2022 02:30:01 -0300

Description:
The `write-file' command (C-x C-w) does not respect `uniquify.el'.

Steps to reproduce (correct case):
1) emacs -Q
2) eval (setopt uniquify-buffer-name-style 'forward)
3) C-x C-f "~/tmp/a/x"
4) C-x C-f "~/tmp/b/x"
5) The buffers are renamed are expected: "a/x" and "b/x"

Steps to reproduce (bug case):
1) emacs -Q
2) eval (setopt uniquify-buffer-name-style 'forward)
3) C-x C-f "~/tmp/a/x"
4) C-x C-f "~/tmp/b/y"
5) C-x C-w "~/tmp/b/x"
6) The buffers are not named correctly: "x" and "x<2>"

I did not have time to look deep into this problem, but the following
patch seems to work as expected:
>From 3e2ef93862ad13650854a34982c320aaafbf2b6f Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com>
Date: Fri, 22 Jul 2022 01:14:11 -0300
Subject: [PATCH 1/1] * files.el (set-visited-file-name): Respect uniquify.el

---
 lisp/files.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index bc74dfa738..2051cc0f95 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4714,7 +4714,7 @@ set-visited-file-name
          ;; If new-name == old-name, renaming would add a spurious <2>
          ;; and it's considered as a feature in rename-buffer.
          (or (string= new-name (buffer-name))
-             (rename-buffer new-name t))))
+             (uniquify--rename-buffer-advice new-name t))))
     (setq buffer-backed-up nil)
     (or along-with-file
        (clear-visited-file-modtime))
--
2.34.1

But it seems to be an unnecessary change, since `rename-bufer' calls
`uniquify--rename-buffer-advice'. The root-cause might be related to
`rename-buffer' passing the result of `generate-new-buffer-name' (that
generates "x<2>") to `uniquify--rename-buffer-advice'.

---
Gabriel


In GNU Emacs 29.0.50 (build 27, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.16.0)
 of 2022-07-21 built on 4BQPCJ3
Repository revision: 46e07d0a4bdb19b0aed26917227d7846bdb0f43c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Ubuntu 22.04 LTS





reply via email to

[Prev in Thread] Current Thread [Next in Thread]