doom/popup-restore: clone file buffers if needed
This commit is contained in:
parent
1ab5f86188
commit
5b6f3119c7
1 changed files with 8 additions and 5 deletions
|
@ -39,8 +39,8 @@ possible rules."
|
|||
;;;###autoload
|
||||
(defun doom/popup-restore ()
|
||||
"Restore the last open popups. If the buffers have been killed, and
|
||||
represented real files, they will be restored. Special buffers or buffers with
|
||||
non-nil :autokill properties will not be.
|
||||
represented real files, they will be restored. Dead special buffers or buffers
|
||||
with non-nil :autokill properties will not be.
|
||||
|
||||
Returns t if popups were restored, nil otherwise."
|
||||
(interactive)
|
||||
|
@ -49,10 +49,13 @@ Returns t if popups were restored, nil otherwise."
|
|||
(let (any-p)
|
||||
(dolist (spec doom-popup-history)
|
||||
(let ((buffer (get-buffer (car spec)))
|
||||
(path (plist-get (cdr spec) :file))
|
||||
(file (plist-get (cdr spec) :file))
|
||||
(rules (plist-get (cdr spec) :rules)))
|
||||
(when (and (not buffer) path)
|
||||
(setq buffer (find-file-noselect path t)))
|
||||
(when (and (not buffer) file)
|
||||
(setq buffer
|
||||
(if-let (buf (get-file-buffer file))
|
||||
(clone-indirect-buffer (buffer-name buf) nil t)
|
||||
(find-file-noselect file t))))
|
||||
(when (and buffer (apply #'doom-popup-buffer buffer rules) (not any-p))
|
||||
(setq any-p t))))
|
||||
(when any-p
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue