[Top][All Lists]

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

Re: make pred customable in auto-save-visited-mode

From: Philipp Stephani
Subject: Re: make pred customable in auto-save-visited-mode
Date: Sat, 31 Mar 2018 10:28:58 +0000

Philipp Stephani <address@hidden> schrieb am Sa., 31. März 2018 um 12:23 Uhr:
Eli Zaretskii <address@hidden> schrieb am Sa., 31. März 2018 um 10:44 Uhr:

>   (setq auto-save--timer
>         (when auto-save-visited-mode
>           (run-with-idle-timer
>            auto-save-visited-interval :repeat
>            #'save-some-buffers :no-prompt
>            (lambda ()  ;;<————————————how about make this customable
>              (not (and buffer-auto-save-file-name
>                        auto-save-visited-file-name)))))))

Letting users customize a non-trivial function is not the best way of
affecting this behavior.  I think you can have what you want by adding
a function to ediff-startup-hook, and in that function set
buffer-auto-save-file-name of the *ediff-merge* buffer to nil.

I agree that customization isn't the best solution here. However, I'm suprised that `save-some-buffers' still prompts even if :noprompt is passed.
The issue might be in `save-some-buffers': Its docstring says "If PRED is t, then certain non-file buffers will also be considered.", but later it only checks whether PRED is non-nil:

                     (buffer-file-name buffer)
                     (with-current-buffer buffer
                       (or (eq buffer-offer-save 'always)
                           (and pred buffer-offer-save (> (buffer-size) 0)))))

Maybe instead of `pred' here we should say (eq pred t). Alternative, the predicate lambda should check whether `buffer-file-name' is non-nil.

Probably the second option is better because the first option would prevent PRED from running for non-file-visiting buffers. Patch attached.

Attachment: 0001-files.el-auto-save-visited-mode-Don-t-prompt-for-filen.txt
Description: Text document

reply via email to

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