Peter Prevos <pe...@prevos.net> writes: > ox-odt.el overrides the auto-mode-alist settings and instructs > Emacs to open od[fgpst] files in archive-mode instead of > doc-view-mode. > > This line can be removed because it prevents Emacs from opening > LibreOffice files.
Confirmed. AFAIU, the reason that change is made is a line in `org-odt--export-wrap' where the exporter "Open the OpenDocument file in archive-mode for examination." However, most users probably don't have a chance for "examination" as the file is opened in the background without notice in the message buffer or manual. It is also a side effect no other export backend has. So, I am inclined to remove that code in `org-odt--export-wrap' and then remove the code altering `auto-mode-alist' (which is definitely something we must not do). See the attached patch set. I am not applying the patches yet just in case if some users are relying on the removed behaviour. If anyone reading this does use this undocumented feature, please reply, and we will discuss how to retain it.
>From f60b3b4f2d9159ac367c08bfb7e024d0faeb1d3b Mon Sep 17 00:00:00 2001 Message-ID: <f60b3b4f2d9159ac367c08bfb7e024d0faeb1d3b.1702118852.git.yanta...@posteo.net> From: Ihor Radchenko <yanta...@posteo.net> Date: Sat, 9 Dec 2023 11:37:02 +0100 Subject: [PATCH 1/2] lisp/ox-odt.el: Do not open the generated exported file in the background * lisp/ox-odt.el (org-odt--export-wrap): Do not open the exported file in the background. Such behavior is not consistent with the other export backends and is not documented (users don't know about it). * etc/ORG-NEWS (ODT export no longer opens the exported file in the background): Document the breaking change. --- etc/ORG-NEWS | 7 +++++++ lisp/ox-odt.el | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 59c45b2aa..439323f00 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -13,6 +13,13 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.7 (not released yet) ** Important announcements and breaking changes +*** ODT export no longer opens the exported file in the background + +ODT exporter used to open the exported file in ~archive-mode~ "for +examination". This was not documented, was done in the background, +and is not consistent with all other export backends. Now, this +feature is removed. + *** ~org-src-associate-babel-session~ and ~org-babel-<lang>-associate-session~ are now obsolete This functionality is not documented, rarely used and can be achieved diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 8d3a48394..e51547f48 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -4081,9 +4081,6 @@ (defmacro org-odt--export-wrap (out-file &rest body) (message "Created %s" (expand-file-name target)) ;; Cleanup work directory and work files. (funcall --cleanup-xml-buffers) - ;; Open the OpenDocument file in archive-mode for - ;; examination. - (find-file-noselect target t) ;; Return exported file. (cond ;; Case 1: Conversion desired on exported file. Run the -- 2.42.0
>From 3508ed0df8cf28e8f5d74cc1c9e232f027055356 Mon Sep 17 00:00:00 2001 Message-ID: <3508ed0df8cf28e8f5d74cc1c9e232f027055356.1702118852.git.yanta...@posteo.net> In-Reply-To: <f60b3b4f2d9159ac367c08bfb7e024d0faeb1d3b.1702118852.git.yanta...@posteo.net> References: <f60b3b4f2d9159ac367c08bfb7e024d0faeb1d3b.1702118852.git.yanta...@posteo.net> From: Ihor Radchenko <yanta...@posteo.net> Date: Sat, 9 Dec 2023 11:38:22 +0100 Subject: [PATCH 2/2] lisp/ox-odt.el: Do not alter `auto-mode-alist' Reported-by: Peter Prevos <pe...@prevos.net> Link: https://orgmode.org/list/87wmtoosru....@prevos.net --- lisp/ox-odt.el | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index e51547f48..c209e01a6 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -4349,11 +4349,6 @@ (defun org-odt-convert (&optional in-file out-fmt open) ;;; Library Initializations -(dolist (desc org-odt-file-extensions) - ;; Let Emacs open all OpenDocument files in archive mode. - (add-to-list 'auto-mode-alist - (cons (concat "\\." (car desc) "\\'") 'archive-mode))) - (provide 'ox-odt) ;; Local variables: -- 2.42.0
-- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>