GNU bug report logs -
#56693
29.0.50; write-file does not respect uniquify.el
Previous Next
Reported by: Gabriel <gabriel376 <at> hotmail.com>
Date: Fri, 22 Jul 2022 05:36:02 UTC
Severity: normal
Tags: moreinfo
Found in version 29.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56693 in the body.
You can then email your comments to 56693 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56693
; Package
emacs
.
(Fri, 22 Jul 2022 05:36:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Gabriel <gabriel376 <at> hotmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 22 Jul 2022 05:36:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56693
; Package
emacs
.
(Sat, 23 Jul 2022 06:31:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 56693 <at> debbugs.gnu.org (full text, mbox):
Gabriel <gabriel376 <at> hotmail.com> writes:
> 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'.
The code in rename-buffer was added in:
commit 1a724cc2d2e7f08b9fcad569c8cacf126ad55791
Author: Stefan Monnier <monnier <at> iro.umontreal.ca>
AuthorDate: Mon Dec 27 19:47:23 2021 -0500
I've added Stefan to the CCs; perhaps he has some comments here.
Added tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 23 Jul 2022 06:31:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56693
; Package
emacs
.
(Tue, 16 Aug 2022 21:32:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 56693 <at> debbugs.gnu.org (full text, mbox):
> 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>"
Hmm... indeed.
> (or (string= new-name (buffer-name))
> - (rename-buffer new-name t))))
> + (uniquify--rename-buffer-advice new-name t))))
That's an OK workaround, yes.
> 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'.
Exactly.
I installed the corresponding change, so it should be fixed on `master`.
Thanks,
Stefan
diff --git a/src/buffer.c b/src/buffer.c
index 98066a2eb60..0d553e7e2d1 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1563,7 +1563,8 @@ DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
(register Lisp_Object newname, Lisp_Object unique)
{
register Lisp_Object tem, buf;
-
+ Lisp_Object requestedname = newname;
+
CHECK_STRING (newname);
if (SCHARS (newname) == 0)
@@ -1599,7 +1601,7 @@ DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
run_buffer_list_update_hook (current_buffer);
call2 (intern ("uniquify--rename-buffer-advice"),
- BVAR (current_buffer, name), unique);
+ requestedname, unique);
/* Refetch since that last call may have done GC. */
return BVAR (current_buffer, name);
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#56693
; Package
emacs
.
(Wed, 14 Sep 2022 15:28:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 56693 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> I installed the corresponding change, so it should be fixed on `master`.
Thanks; and I'm therefore closing this bug report now.
(If there are still problems in this area, please respond to the debbugs
address and we'll reopen.)
bug marked as fixed in version 29.1, send any further explanations to
56693 <at> debbugs.gnu.org and Gabriel <gabriel376 <at> hotmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 14 Sep 2022 15:28:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 13 Oct 2022 11:24:17 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 189 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.