Hi discard the previous email in this thread. The correct file is attached here.
Sorry (after-holiday glitch) /PA On Mon, 31 Aug 2026 at 09:19, Pedro A. Aranda <[email protected]> wrote: > Hi > Attached is a patch solving the Org export to PDF menu problems for > LaTeX and Beamer. Possibly triggered by a change in the menu API. > > Best, /PA > -- > Pedro A. Aranda > ox-latex & ox-beamer maintainer > > Sagen's Paradeiser! (ORF: Als Radiohören gefährlich war) => write BE! > IA: onomatopeya del rebuzno > 2nd year of the New Koprocracy > -- Fragen sind nicht da, um beantwortet zu werden, Fragen sind da um gestellt zu werden Georg Kreisler "Sagen's Paradeiser" (ORF: Als Radiohören gefährlich war) => write BE! Year 2 of the New Koprocracy *IA: onomatopeya del rebuznar* This was produced by a human (implied virtues and weaknesses acknowledged) Don't feed your ArtStup (SKA AI) with this. It won't make YOU smarter...
From d763f526943efa9526226f6c0b38535ea52fa828 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" <[email protected]> Date: Mon, 31 Aug 2026 09:13:32 +0200 Subject: [PATCH] Factor out export-and-show in ox-latex.el and ox-beamer.el * etc/ORG-NEWS: Announce factored out functions. * lisp/ox-beamer.el (org-beamer-export-to-pdf-and-open): New function to export the buffer to PDF and open the result in a PDF viewer. export-backend: Use the new function instead of the inlined code. * lisp/ox-latex.el (org-beamer-export-to-pdf-and-open): New function to export the buffer to PDF and open the result in a PDF viewer. export-backend: Use the new function instead of the inlined code. Reported-by: Colin Baxter <[email protected]> Link: https://list.orgmode.org/[email protected]/ --- etc/ORG-NEWS | 11 ++++++++++- lisp/ox-beamer.el | 13 +++++++++---- lisp/ox-latex.el | 14 ++++++++++---- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 8d2953d25..77e995f00 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -252,7 +252,7 @@ keywords or with =#+OPTIONS:=. Option keys can be used like this: : #+OPTIONS: html-self-link-headlines:t : #+OPTIONS: html-tag-class-prefix:"myorg-" - + To know which value you can use, find the allowed option values in the manual or in the default variable documentation. @@ -454,6 +454,15 @@ LuaLaTeX, or generate PDFs with CJK fonts in the case of XeLaTeX. Refer to "Controlling font setup for LuaLaTeX and XeLaTeX" in the "LaTeX Export" chapter in the Org manual. +*** New function ~org-latex-export-to-pdf-and-open~ + +This function contains the code factored out from the export menu. It +exports the buffer to PDF and opens the resulting PDF file. + +*** New function ~org-beamer-export-to-pdf-and-open~ + +This function contains the code factored out from the export menu. It +exports the buffer to PDF and opens the resulting PDF file. ** Removed or renamed functions and variables diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index 301fc06b4..4adeedf77 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -263,10 +263,7 @@ (org-export-define-derived-backend 'beamer 'latex ((?B "As LaTeX buffer (Beamer)" org-beamer-export-as-latex) (?b "As LaTeX file (Beamer)" org-beamer-export-to-latex) (?P "As PDF file (Beamer)" org-beamer-export-to-pdf) - (?O "As PDF file and open (Beamer)" - #'(lambda (a s v b) - (if a (org-beamer-export-to-pdf t s v b) - (org-open-file (org-beamer-export-to-pdf nil s v b))))))) + (?O "As PDF file and open (Beamer)" org-beamer-export-to-pdf-and-open))) :options-alist '((:headline-levels nil "H" org-beamer-frame-level) (:latex-class "LATEX_CLASS" nil "beamer" t) @@ -1194,6 +1191,14 @@ (defun org-beamer-export-to-pdf #'org-latex-compile))) ;;;###autoload +(defun org-beamer-export-to-pdf-and-open + (&optional async subtreep visible-only body-only ext-plist) + "Export current buffer as a Beamer presentation (PDF) and open it. + +Cf. `org-beamer-export-to-pdf' for argument list." + (if async (org-beamer-export-to-pdf t subtreep visible-only body-only ext-plist) + (org-open-file (org-beamer-export-to-pdf nil subtreep visible-only body-only ext-plist)))) +;;;###autoload (defun org-beamer-select-environment () "Select the environment to be used by beamer for this entry. While this uses (for convenience) a tag selection interface, the diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index d9898fdd5..1099b244e 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -109,10 +109,7 @@ (org-export-define-backend 'latex ((?L "As LaTeX buffer" org-latex-export-as-latex) (?l "As LaTeX file" org-latex-export-to-latex) (?p "As PDF file" org-latex-export-to-pdf) - (?o "As PDF file and open" - #'(lambda (a s v b) - (if a (org-latex-export-to-pdf t s v b) - (org-open-file (org-latex-export-to-pdf nil s v b))))))) + (?o "As PDF file and open" org-latex-export-to-pdf-and-open))) :filters-alist '((:filter-options . org-latex-math-block-options-filter) (:filter-body . org-latex-get-font-list) (:filter-paragraph . org-latex-clean-invalid-line-breaks) @@ -4842,6 +4839,7 @@ (defun org-latex-compile--postprocess (outfile log-buf &optional snippet) (warnings (concat " with warnings: " warnings)) (t "."))))))) + (defun org-latex--collect-warnings (buffer) "Collect some warnings from \"pdflatex\" command output. BUFFER is the buffer containing output. Return collected @@ -4896,6 +4894,14 @@ (defun org-latex-publish-to-pdf (plist filename pub-dir) 'latex filename ".tex" plist (file-name-directory filename)))) pub-dir)) +;;;###autoload +(defun org-latex-export-to-pdf-and-open + (&optional async subtreep visible-only body-only exp-plist) + "Export current buffer to LaTeX, process, and open the resulting PDF. + +Cf. `org-latex-export-to-pdf' for arguments" + (if async (org-latex-export-to-pdf t subtreep visible-only body-only exp-plist) + (org-open-file (org-latex-export-to-pdf nil subtreep visible-only body-only exp-plist)))) (provide 'ox-latex) -- 2.43.0
