From ab62bdd79ff18cf4c88db9e803d51233f4cb71d6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 3 Mar 2024 23:08:16 -0500 Subject: [PATCH] Backport commit 2b5d43081 from Emacs * lisp/ox.el (org-export-to-buffer): Modernize docstring accordingly. * lisp/ox-latex.el (org-latex-export-as-latex): * lisp/ox-koma-letter.el (org-koma-letter-export-as-latex): * lisp/ox-beamer.el (org-beamer-export-as-latex): Use `major-mode-remap` when available. (major-mode-remap(-defaults)): New var and function (bug#69191) 2b5d43081a30f816dd38a16c7b5bfbad712a779b Stefan Monnier Sun Mar 3 23:58:18 2024 -0500 --- lisp/ox-beamer.el | 5 ++++- lisp/ox-koma-letter.el | 4 +++- lisp/ox-latex.el | 5 ++++- lisp/ox.el | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index 3d4d99843..d3a90179d 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -1008,7 +1008,10 @@ will be displayed when `org-export-show-temporary-export-buffer' is non-nil." (interactive) (org-export-to-buffer 'beamer "*Org BEAMER Export*" - async subtreep visible-only body-only ext-plist (lambda () (LaTeX-mode)))) + async subtreep visible-only body-only ext-plist + (if (fboundp 'major-mode-remap) + (major-mode-remap 'latex-mode) + #'LaTeX-mode))) ;;;###autoload (defun org-beamer-export-to-latex diff --git a/lisp/ox-koma-letter.el b/lisp/ox-koma-letter.el index aef25232c..38460d174 100644 --- a/lisp/ox-koma-letter.el +++ b/lisp/ox-koma-letter.el @@ -911,7 +911,9 @@ non-nil." (let (org-koma-letter-special-contents) (org-export-to-buffer 'koma-letter "*Org KOMA-LETTER Export*" async subtreep visible-only body-only ext-plist - (lambda () (LaTeX-mode))))) + (if (fboundp 'major-mode-remap) + (major-mode-remap 'latex-mode) + #'LaTeX-mode)))) ;;;###autoload (defun org-koma-letter-export-to-latex diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index bca387e59..98b388081 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -4160,7 +4160,10 @@ will be displayed when `org-export-show-temporary-export-buffer' is non-nil." (interactive) (org-export-to-buffer 'latex "*Org LATEX Export*" - async subtreep visible-only body-only ext-plist (lambda () (LaTeX-mode)))) + async subtreep visible-only body-only ext-plist + (if (fboundp 'major-mode-remap) + (major-mode-remap 'latex-mode) + #'LaTeX-mode))) ;;;###autoload (defun org-latex-convert-region-to-latex () diff --git a/lisp/ox.el b/lisp/ox.el index 19bf559c9..8e2fdd22a 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -6608,7 +6608,7 @@ use it to set a major mode there, e.g., (interactive) (org-export-to-buffer \\='latex \"*Org LATEX Export*\" async subtreep visible-only body-only ext-plist - #\\='LaTeX-mode)) + (major-mode-remap 'latex-mode))) When expressed as an anonymous function, using `lambda', POST-PROCESS needs to be quoted.