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:
parent
d189132be1
commit
4d862d7770
1 changed files with 9 additions and 0 deletions
|
@ -303,6 +303,15 @@ Ugh, such an ugly hack."
|
||||||
(apply orig-fn args))
|
(apply orig-fn args))
|
||||||
(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.
|
;; 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)
|
(defadvice! +popup--org-pop-to-buffer-a (orig-fn buf &optional norecord)
|
||||||
"Use `pop-to-buffer' instead of `switch-to-buffer' to open buffer.'"
|
"Use `pop-to-buffer' instead of `switch-to-buffer' to open buffer.'"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue