Eli Zaretskii <
eliz@gnu.org> schrieb am Sa., 31. März 2018 um 10:44 Uhr:
> From: 纪秀峰 <jixiuf@qq.com>
> Date: Sat, 31 Mar 2018 00:59:19 +0800
> Feedback-ID: esmtp:qq.com:bgforeign:bgforeign1
>
> When I enable auto-save-visited-mode and start an ediff merge session
> It always prompt me save "*ediff-merge*” to a file.
Why is that a problem? *ediff-merge* is a buffer where you prepare
the merge, and that merge will eventually be saved to some file,
right? So it doesn't sound wrong to offer to save it.
However, auto-saving should probably not prompt for filenames. That's at least the intention of the :noprompt argument here.
> (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:
(or
(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.