[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: |
Ruijie Yu |
Subject: |
bug#62413: 29.0.60; [PATCH] save-place-mode cannot restore saved position |
Date: |
Mon, 03 Apr 2023 10:45:34 +0800 |
User-agent: |
mu4e 1.9.22; emacs 30.0.50 |
Liu Hui <liuhui1610@gmail.com> writes:
> Eli Zaretskii <eliz@gnu.org> 于2023年3月30日周四 13:33写道:
>>
>> I think there's a cleaner way: a defcustom can have a :set function,
>> which is called each time the variable is customized; this setter
>> function should be defined for a defcustom when changing its value has
>> non-trivial effects. So we can define such a setter function to
>> rewrite the list, and document in the doc string of the defcustom that
>> users should not just set the value with setq, but instead use either
>> setopt or "M-x customize-variable". WDYT?
>
> OK, I think it is good. Please see the attached patch.
>
> [2. text/x-patch;
> 0001-Restore-positions-reliably-for-abbreviated-file-name.patch]...
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.
> @@ -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?
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?
--
Best,
RY