mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
fix(popup): org-edit-src breaks if forcibly killed
Invoke org-edit-src and an edit buffer is displayed for the src block at point. If that popup is killed incorrectly, it leaves the original org buffer (specifically, the src block you were editing) in a half-broken state; forever waiting for you to finish editing that block. This can happen when the edit window is a popup window and you switch workspaces (which temporarily deletes popup windows), so clean up those popups properly before switching.
This commit is contained in:
@ -303,6 +303,15 @@ Ugh, such an ugly hack."
|
||||
(apply orig-fn args))
|
||||
(apply orig-fn args)))
|
||||
|
||||
(defadvice! +popup--org-edit-src-exit-a (orig-fn &rest args)
|
||||
"If you switch workspaces or the src window is recreated..."
|
||||
:around #'org-edit-src-exit
|
||||
(let* ((window (selected-window))
|
||||
(popup-p (+popup-window-p window)))
|
||||
(prog1 (apply orig-fn args)
|
||||
(when (and popup-p (window-live-p window))
|
||||
(delete-window window)))))
|
||||
|
||||
;; Ensure todo, agenda, and other minor popups are delegated to the popup system.
|
||||
(defadvice! +popup--org-pop-to-buffer-a (orig-fn buf &optional norecord)
|
||||
"Use `pop-to-buffer' instead of `switch-to-buffer' to open buffer.'"
|
||||
|
Reference in New Issue
Block a user