diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-19 18:22:57 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-06-19 18:29:06 -0700 |
commit | 065576ec1b521b90cf68a8531ddf162ec9f678cc (patch) | |
tree | afa066bb6c2547f5200026837d78a03926af540a /.emacs.d/init-spw.el | |
parent | 00fcee96c269a16e6d3427538ed6472b69a069a2 (diff) | |
download | dotfiles-065576ec1b521b90cf68a8531ddf162ec9f678cc.tar.gz |
attempt to fix disabling openwith-mode during Org ODT export
- Move adding the advice to a more appropriate place.
- Completely disable openwith-mode, rather than just binding
inhibit-file-name-handlers, because the latter requires binding
inhibit-file-name-operation too.
- We have to disable openwith-mode during org-open-file too, or that function
will signal an error, which then looks like the whole export failed.
- To restore the behaviour of opening the exported file in an external viewer,
push to org-file-apps an entry to use xdg-open(1); not sure whether is quite
the right way to achieve this.
Diffstat (limited to '.emacs.d/init-spw.el')
-rw-r--r-- | .emacs.d/init-spw.el | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el index 7ed49498..193a8508 100644 --- a/.emacs.d/init-spw.el +++ b/.emacs.d/init-spw.el @@ -2170,14 +2170,6 @@ mutt's review view, after exiting EDITOR." (require 'mm-util) (add-to-list 'mm-inhibit-file-name-handlers 'openwith-file-handler) - ;; disable openwith-mode when certain other functions are running - (defun spw/without-openwith (orig-fun &rest args) - (let ((inhibit-file-name-handlers (cons 'openwith-file-handler - inhibit-file-name-handlers))) - (apply orig-fun args))) - (with-eval-after-load 'ox-odt - (advice-add 'org-odt-export-to-odt :around #'spw/without-openwith)) - ;; Use this to mark sent mail as containing unresolved comments., e.g. when ;; responding to a patch posting. Remove the flag from the message when the ;; next version of the patch series is seen to resolve the review comments. @@ -2548,7 +2540,18 @@ mutt's review view, after exiting EDITOR." (openwith-mode 1) ;; openwith reduces the chances we hit this threshold so can set it higher - (setq large-file-warning-threshold 500000000)) + (setq large-file-warning-threshold 500000000) + + ;; disable openwith-mode when certain functions are running + (defun spw/without-openwith (orig-fun &rest args) + (let ((active openwith-mode)) + (prog2 (when active (openwith-mode 0)) + (apply orig-fun args) + (when active (openwith-mode 1))))) + (with-eval-after-load 'org + (advice-add 'org-open-file :around #'spw/without-openwith)) + (with-eval-after-load 'ox-odt + (advice-add 'org-odt-export-to-odt :around #'spw/without-openwith))) (spw/when-library-available yasnippet (yas-global-mode 1) |