doom/popup-restore: return t on success (and clear history less aggressively)
This commit is contained in:
parent
8fa6ba7886
commit
4221bea044
1 changed files with 17 additions and 12 deletions
|
@ -39,21 +39,26 @@ possible rules."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/popup-restore ()
|
(defun doom/popup-restore ()
|
||||||
"Restore the last popups. If the buffers have been killed, and represented
|
"Restore the last open popups. If the buffers have been killed, and
|
||||||
real files, they will be restored. Special buffers or buffers with non-nil
|
represented real files, they will be restored. Special buffers or buffers with
|
||||||
:autokill properties will not be."
|
non-nil :autokill properties will not be.
|
||||||
|
|
||||||
|
Returns t if popups were restored, nil otherwise."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless doom-popup-history
|
(unless doom-popup-history
|
||||||
(error "No popups to restore"))
|
(error "No popups to restore"))
|
||||||
|
(let (any-p)
|
||||||
(dolist (spec doom-popup-history)
|
(dolist (spec doom-popup-history)
|
||||||
(let ((buffer (get-buffer (car spec)))
|
(let ((buffer (get-buffer (car spec)))
|
||||||
(path (plist-get (cdr spec) :file))
|
(path (plist-get (cdr spec) :file))
|
||||||
(rules (plist-get (cdr spec) :rules)))
|
(rules (plist-get (cdr spec) :rules)))
|
||||||
(when (and (not buffer) path)
|
(when (and (not buffer) path)
|
||||||
(setq buffer (find-file-noselect path t)))
|
(setq buffer (find-file-noselect path t)))
|
||||||
(when buffer
|
(when (and buffer (apply 'doom-popup-buffer buffer rules) (not any-p))
|
||||||
(apply 'doom-popup-buffer buffer rules))))
|
(setq any-p t))))
|
||||||
|
(when any-p
|
||||||
(setq doom-popup-history '()))
|
(setq doom-popup-history '()))
|
||||||
|
any-p))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/popup-toggle ()
|
(defun doom/popup-toggle ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue