Org-mode mailing list
 help / color / mirror / Atom feed
From: Timothy <tecosaur@gmail.com>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: [PATCH] avoid loading major modes when exporting to file
Date: Wed, 31 Mar 2021 23:25:51 +0800
Message-ID: <87lfa3fips.fsf@gmail.com> (raw)

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


Hello,

Another little patch, this time a one-liner.
I think the commit description is pretty thorough, so give that a look.
TLDR; it makes `org-export-to-file' behave a bit more nicely.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-don-t-load-a-major-mode-when-exporting-to-file.patch --]
[-- Type: text/x-patch, Size: 1406 bytes --]

From eb9d7c038dbb9e7a4b89edf61db83a31dda27170 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 31 Mar 2021 23:16:58 +0800
Subject: [PATCH] ox: don't load a major-mode when exporting to file

* lisp/ox.el (org-export-to-file): Prior to this, when
`org-export-to-file' was called it activated the major mode for that
file type based on `auto-mode-alist'.  This can be mildly annoying in
various ways as loading the major mode (1) makes the export take
longer, (2) can produce unwanted "noise" while initialising, namely
warnings and errors related to the mode itself, (3) can produce spurious
files like an .auctex-auto folder.  By locally binding `auctex-auto' to
nil all of these undesirable behaviours can be avoided.
---
 lisp/ox.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index f705bc83a..96d2866dd 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -6388,7 +6388,8 @@   (defun org-latex-export-to-latex
   (declare (indent 2))
   (if (not (file-writable-p file)) (error "Output file not writable")
     (let ((ext-plist (org-combine-plists `(:output-file ,file) ext-plist))
-	  (encoding (or org-export-coding-system buffer-file-coding-system)))
+	  (encoding (or org-export-coding-system buffer-file-coding-system))
+          (auto-mode-alist nil))
       (if async
           (org-export-async-start
 	      `(lambda (file)
-- 
2.30.1


             reply	other threads:[~2021-03-31 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 15:25 Timothy [this message]
2021-05-01 16:52 ` Bastien
2021-05-01 17:26   ` Timothy
2021-05-03 17:25     ` Bastien

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://orgmode.org

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

  git send-email \
    --in-reply-to=87lfa3fips.fsf@gmail.com \
    --to=tecosaur@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git