emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Peter Prevos <peter@prevos.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] ox-odt.el overrides auto-mode-alist defaults [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]
Date: Sat, 09 Dec 2023 10:49:04 +0000	[thread overview]
Message-ID: <87plzfslb3.fsf@localhost> (raw)
In-Reply-To: <87wmtoosru.fsf@prevos.net>

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

Peter Prevos <peter@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-odt.el-Do-not-open-the-generated-exported-fi.patch --]
[-- Type: text/x-patch, Size: 2083 bytes --]

From f60b3b4f2d9159ac367c08bfb7e024d0faeb1d3b Mon Sep 17 00:00:00 2001
Message-ID: <f60b3b4f2d9159ac367c08bfb7e024d0faeb1d3b.1702118852.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-lisp-ox-odt.el-Do-not-alter-auto-mode-alist.patch --]
[-- Type: text/x-patch, Size: 1144 bytes --]

From 3508ed0df8cf28e8f5d74cc1c9e232f027055356 Mon Sep 17 00:00:00 2001
Message-ID: <3508ed0df8cf28e8f5d74cc1c9e232f027055356.1702118852.git.yantar92@posteo.net>
In-Reply-To: <f60b3b4f2d9159ac367c08bfb7e024d0faeb1d3b.1702118852.git.yantar92@posteo.net>
References: <f60b3b4f2d9159ac367c08bfb7e024d0faeb1d3b.1702118852.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@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 <peter@prevos.net>
Link: https://orgmode.org/list/87wmtoosru.fsf@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


[-- Attachment #4: Type: text/plain, Size: 224 bytes --]


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

  reply	other threads:[~2023-12-09 10:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-09  5:18 [BUG] ox-odt.el overrides auto-mode-alist defaults [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)] Peter Prevos
2023-12-09 10:49 ` Ihor Radchenko [this message]
2023-12-29 15:36   ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87plzfslb3.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=peter@prevos.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).