(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))