emacs-devel
[Top][All Lists]
Advanced

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

Re: master e8488bcc9c: Avoid having font locking triggering unnecessary


From: Stefan Monnier
Subject: Re: master e8488bcc9c: Avoid having font locking triggering unnecessary auto-saving
Date: Mon, 09 May 2022 22:11:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>> [ I'd use `(unless (eq ,modified t)`  ]
> The return value is now defined as nil/`autosaved'/non-nil, so assuming
> t is no longer the thing.

:-)

>> But... hmm... what if `body` caused the modified-p status to change from
>> `autosaved` to `nil`.  With the old code, we'd leave `nil` untouched,
>> but with the new code we'd re-set it to `autosaved`.
>>
>> Admittedly, it's quite unlikely for `body` to save the buffer (and hence
>> cause the modified-p status to change from `autosaved` to `nil`), so I'm
>> not sure how important this is.
>
> I think that's probably outside the scope for this macro.

Fair enough.  In that case, maybe it can even call
`restore-buffer-modified-p` unconditionally.

>> I think this will not do the right thing if you call
>> `(restore-buffer-modified-p 'autosaved)` when modified-p is `nil`.
>
> Yeah, the semantics are slightly obscure now, but you're not supposed to
> call the function with `autosaved' when it hasn't been modified.
> Perhaps it should just signal an error in that case?

Why not make it DTRT and make sure

    (buffer-modified-p (restore-buffer-modified-p FLAG))

always returns FLAG if FLAG is one of nil/t/autosaved (and add a few
tests while we're at it)?


        Stefan




reply via email to

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