Skip to content

Instantly share code, notes, and snippets.

@takaxp
Last active December 6, 2019 09:36
Show Gist options
  • Save takaxp/9fb592a58090ca8a66f8b887904d5d03 to your computer and use it in GitHub Desktop.
Save takaxp/9fb592a58090ca8a66f8b887904d5d03 to your computer and use it in GitHub Desktop.
split window horizontally when showing org-export-dispatch
(with-eval-after-load "ox"
(defun my-org-export-dispatch-done ()
(when (eq this-command 'org-export-dispatch)
(delete-window))
(remove-hook 'post-command-hook #'my-org-export-dispatch-done))
(defun my-moom-org-export-dispatch-done ()
(when (eq this-command 'org-export-dispatch)
(moom-delete-windows))
(remove-hook 'post-command-hook #'my-moom-org-export-dispatch-done))
(defun my-org-export-dispatch (f ARG)
(interactive "P")
(cond
(org-export-dispatch-use-expert-ui
(apply f ARG))
((eq (frame-width) 80)
(if (require 'moom nil t)
(let ((moom-verbose nil))
(add-hook 'post-command-hook #'my-moom-org-export-dispatch-done)
(moom-split-window)
(apply f ARG))
(apply f ARG)))
((> (frame-width) 160)
(add-hook 'post-command-hook #'my-org-export-dispatch-done)
(split-window-right)
(apply f ARG))
(t
(apply f ARG))))
(advice-add 'org-export-dispatch :around #'my-org-export-dispatch))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment