feature/popup: add new autosave window parameter

(autosave . CDR)

This parameter determines what to do with modified buffers in closing
popup windows. CDR can be a t, 'ignore, a function or nil.

+ If t, no prompts. Just save them automatically (if they're
  file-visiting buffers).
+ If 'ignore, no prompts, no saving. Just silently kill it.
+ If nil (the default), prompt the user what to do if the buffer is
  file-visiting and modified.
+ If a function, the return value must return one of the other values.
  It takes two arguments: the popup window and buffer.
This commit is contained in:
Henrik Lissner 2018-05-19 12:07:11 +02:00
parent f16aa539c7
commit dcec3b9b25
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 16 additions and 3 deletions

View file

@ -68,7 +68,8 @@ and enables `+popup-buffer-mode'."
ttl)
(when (and (buffer-file-name buffer)
(buffer-modified-p buffer)
(y-or-n-p "Popup buffer is modified. Save it?"))
(or (+popup-parameter-fn 'autosave window buffer)
(y-or-n-p "Popup buffer is modified. Save it?")))
(with-current-buffer buffer (save-buffer)))
(set-buffer-modified-p nil)
(let ((ignore-window-parameters t))