unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Augusto Stoffel <arstoffel@gmail.com>
Cc: 60097@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	[thread overview]
Message-ID: <83wn6qgpqz.fsf@gnu.org> (raw)
In-Reply-To: <87wn6sleju.fsf@gmail.com> (message from Augusto Stoffel on Thu,  15 Dec 2022 19:14:45 +0100)

> From: Augusto Stoffel <arstoffel@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)





  reply	other threads:[~2022-12-17 12:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 18:14 bug#60097: 29.0.60; emacsclient adds unabbreviated names to file-name-history Augusto Stoffel
2022-12-17 12:48 ` Eli Zaretskii [this message]
2022-12-19 10:20   ` Augusto Stoffel
2022-12-19 13:34     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wn6qgpqz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=60097@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).