GNU bug report logs - #62413
29.0.60; [PATCH] save-place-mode cannot restore saved position

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Fri, 24 Mar 2023 04:10:02 UTC

Severity: normal

Tags: patch

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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Liu Hui <liuhui1610 <at> gmail.com>
Subject: bug#62413: closed (Re: bug#62413: 29.0.60; [PATCH]
 save-place-mode cannot restore saved position)
Date: Thu, 06 Apr 2023 10:28:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 62413 <at> debbugs.gnu.org.

-- 
62413: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62413
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: ruijie <at> netyu.xyz, 62413-done <at> debbugs.gnu.org
Subject: Re: bug#62413: 29.0.60;
 [PATCH] save-place-mode cannot restore saved position
Date: Thu, 06 Apr 2023 13:27:55 +0300
> From: Liu Hui <liuhui1610 <at> gmail.com>
> Date: Tue, 4 Apr 2023 09:37:26 +0800
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 62413 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
> 
> Ruijie Yu <ruijie <at> netyu.xyz> 于2023年4月3日周一 11:06写道:
> 
> > Two minor comments below.
> >
> > > @@ -90,8 +92,32 @@ save-place-forget-unreadable-files
> > >  (defcustom save-place-abbreviate-file-names nil
> > > [...]
> > > +  :set (lambda (sym val)
> > > +         (set-default sym val)
> > > +         (let ((fun (if val 'abbreviate-file-name 'expand-file-name)))
> >
> > I believe function quotes "#'" are preferred over simple quotes "'" when
> > dealing with functions.
> 
> OK
> 
> > > @@ -214,7 +241,11 @@ save-place-to-alist
> > >                           ((and (derived-mode-p 'dired-mode) directory)
> > >                            (let ((filename (dired-get-filename nil t)))
> > >                              (if filename
> > > -                                `((dired-filename . ,filename))
> > > +                                   (list
> > > +                                    (cons 'dired-filename
> > > +                                          (if save-place-abbreviate-file-names
> > > +                                              (abbreviate-file-name filename)
> > > +                                            filename)))
> >
> > It seems that you rewrote the quote-backquote thing with regular
> > list-cons construct -- no comments on that.  I noticed that here, and in
> > a few other places, you are reusing the exact `if' construct multiple
> > times.  Does that warrant defining a helper function?
> 
> I feel such a function is too short.
> 
> > Also, while I was about to send the mail, regarding the docstring of
> > `save-place-abbreviate-file-names', instead of letting the user enable
> > `save-place-mode', would it be better if you directly call facilities in
> > saveplace to load `save-place-alist' from file system, within your :set
> > function?
> 
> Thanks for the suggestion. I have added `save-place-load-alist-from-file'
> to the :set function in the new patch.

Thanks, I installed this on the master branch, and I'm therefore
closing this bug.

[Message part 3 (message/rfc822, inline)]
From: Liu Hui <liuhui1610 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; [PATCH] save-place-mode cannot restore saved position
Date: Fri, 24 Mar 2023 10:19:07 +0800
[Message part 4 (text/plain, inline)]
Hi,

save-place-mode cannot restore last saved position when
`save-place-abbreviate-file-names' is non-nil:

- emacs -Q
- M-x save-place-mode, and set save-place-abbreviate-file-names to t
- open a file, scroll to some position, and kill buffer
- reopen the file, the position is not restored

The reason is it uses abbreviated file names when saving positions to
`save-place-alist', but uses full file names to find position in
`save-place-alist'.


Best,
Liu Hui
[0001-Restore-positions-for-abbreviated-file-names.patch (text/x-patch, attachment)]

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

Previous Next


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