GNU bug report logs - #60097
29.0.60; emacsclient adds unabbreviated names to file-name-history

Previous Next

Package: emacs;

Reported by: Augusto Stoffel <arstoffel <at> gmail.com>

Date: Thu, 15 Dec 2022 18:16:01 UTC

Severity: normal

Found in version 29.0.60

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: 60097 <at> debbugs.gnu.org
Subject: bug#60097: 29.0.60; emacsclient adds unabbreviated names to file-name-history
Date: Sat, 17 Dec 2022 14:48:36 +0200
> From: Augusto Stoffel <arstoffel <at> gmail.com>
> Date: Thu, 15 Dec 2022 19:14:45 +0100
> 
> 
> 1. Start emacs -Q
> 2. M-x server-start RET
> 3. In a terminal, type /home/user/somefile

I guess you meant to type "emacsclient /home/user/somefile"?

> Then "/home/user/somefile" is added to file-name-history.  I would
> instead expect the abbreviated name, "~/somefile", to be added to
> history.

Does the patch below do what you want?

Btw, we don't do this consistently: "C-x C-f" doesn't record the
abbreviated file name, it records the original one.

diff --git a/lisp/server.el b/lisp/server.el
index fd740d1..d963ee5 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1495,7 +1495,7 @@ server-visit-files
 					  minibuffer-auto-raise))
 	       (filen (car file))
 	       (obuf (get-file-buffer filen)))
-	  (add-to-history 'file-name-history filen)
+          (file-name-history--add filen)
 	  (if (null obuf)
 	      (progn
 		(run-hooks 'pre-command-hook)




This bug report was last modified 2 years and 213 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.