all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Liu Hui <liuhui1610@gmail.com>
Cc: 62413@debbugs.gnu.org
Subject: bug#62413: 29.0.60; [PATCH] save-place-mode cannot restore saved position
Date: Sat, 25 Mar 2023 17:17:11 +0300	[thread overview]
Message-ID: <83y1nkc3vc.fsf@gnu.org> (raw)
In-Reply-To: <CAOQTW-Ni_Z-W+=MA+PCYGmfr18ic+=YBKwxiZH0cKyg2YPorgg@mail.gmail.com> (message from Liu Hui on Sat, 25 Mar 2023 22:14:02 +0800)

> From: Liu Hui <liuhui1610@gmail.com>
> Date: Sat, 25 Mar 2023 22:14:02 +0800
> Cc: 62413@debbugs.gnu.org
> 
> > Wouldn't it be best to always test for abbreviated file name if the
> > full file name fails to match?  E.g., it could be that the user turned
> > on save-place-abbreviate-file-names for a while, then turned it off
> > (or vice versa), thus causing mixed file names in the saved history.
> > It would also make the code simpler, I think.
> 
> I agree that it is better to consider mixed file names. Please see the
> updated patch.
> 
> From ad5f2d4f3c878a15c2fd1d2eca09e2f2fbecec15 Mon Sep 17 00:00:00 2001
> From: Liu Hui <liuhui1610@gmail.com>
> Date: Fri, 24 Mar 2023 10:08:12 +0800
> Subject: [PATCH] Restore positions for abbreviated file names in saveplace.el
> 
> * lisp/saveplace.el (save-place-find-file-hook): Use abbreviated file
> name when `save-place-abbreviate-file-names' is non-nil.
> ---
>  lisp/saveplace.el | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/lisp/saveplace.el b/lisp/saveplace.el
> index 7512fc87c5d..6c3ed34f198 100644
> --- a/lisp/saveplace.el
> +++ b/lisp/saveplace.el
> @@ -353,7 +353,14 @@ save-place-find-file-hook
>    "Function added to `find-file-hook' by `save-place-mode'.
>  It runs the hook `save-place-after-find-file-hook'."
>    (or save-place-loaded (save-place-load-alist-from-file))
> -  (let ((cell (assoc buffer-file-name save-place-alist)))
> +  (let ((cell (and (stringp buffer-file-name)
> +                   (if save-place-abbreviate-file-names
> +                       (or (assoc (abbreviate-file-name buffer-file-name)
> +                                  save-place-alist)
> +                           (assoc buffer-file-name save-place-alist))
> +                     (or (assoc buffer-file-name save-place-alist)
> +                         (assoc (abbreviate-file-name buffer-file-name)
> +                                save-place-alist))))))
>      (if cell

But now testing save-place-abbreviate-file-names here should be
redundant, right?

Also, I think we should first test buffer-file-name, and only after
that its abbreviated variant.





  reply	other threads:[~2023-03-25 14:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24  2:19 bug#62413: 29.0.60; [PATCH] save-place-mode cannot restore saved position Liu Hui
2023-03-25 11:52 ` Eli Zaretskii
2023-03-25 14:14   ` Liu Hui
2023-03-25 14:17     ` Eli Zaretskii [this message]
2023-03-26  1:26       ` Liu Hui
2023-03-26  5:20         ` Eli Zaretskii
2023-03-28  5:56           ` Liu Hui
2023-03-28 12:03             ` Eli Zaretskii
2023-03-30  2:49               ` Liu Hui
2023-03-30  5:34                 ` Eli Zaretskii
2023-04-03  1:02                   ` Liu Hui
2023-04-03  2:45                     ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-04  1:37                       ` Liu Hui
2023-04-06 10:27                         ` 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

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

  git send-email \
    --in-reply-to=83y1nkc3vc.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=62413@debbugs.gnu.org \
    --cc=liuhui1610@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.