summaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-06-19 18:22:57 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-06-19 18:29:06 -0700
commit065576ec1b521b90cf68a8531ddf162ec9f678cc (patch)
treeafa066bb6c2547f5200026837d78a03926af540a /.emacs.d
parent00fcee96c269a16e6d3427538ed6472b69a069a2 (diff)
downloaddotfiles-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')
-rw-r--r--.emacs.d/init-org.el1
-rw-r--r--.emacs.d/init-spw.el21
2 files changed, 13 insertions, 9 deletions
diff --git a/.emacs.d/init-org.el b/.emacs.d/init-org.el
index 7e9d2e30..a217463d 100644
--- a/.emacs.d/init-org.el
+++ b/.emacs.d/init-org.el
@@ -178,6 +178,7 @@
;; setting this means if we type C-c C-e o O then the PDF opens for inspection
(setq org-odt-preferred-output-format "pdf")
+(add-to-list 'org-file-apps '(system . "xdg-open %s"))
;; ... but also ensure we get a .docx (would be better to make
;; `org-odt-preferred-output-format' accept a list)
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)