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

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

bug#62413: 29.0.60; [PATCH] save-place-mode cannot restore saved positio


From: Liu Hui
Subject: bug#62413: 29.0.60; [PATCH] save-place-mode cannot restore saved position
Date: Sun, 26 Mar 2023 09:26:22 +0800

Eli Zaretskii <eliz@gnu.org> 于2023年3月25日周六 22:17写道:

> >  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.

I don't think so. Consider the following case:

- open file A and then close the buffer:
  (buffer-file-name . position1) is saved in save-place-alist

- then set save-place-abbreviate-file-names to t

- open file A, scroll the buffer and close it:
  (abbreviated-file-name . position2) is saved

- open file A again, and the point will be at position1 if
  buffer-file-name is tested first. But I would expect the point is at
  position2.





reply via email to

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