Hi

A couple more variables that should be safe to set from local variables...
/PA

-- 
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
From 0486fab9d50c3cefac0379852f309c38da2899ae Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <[email protected]>
Date: Wed, 15 Apr 2026 12:56:17 +0200
Subject: [PATCH] org.el: configure latex package lists from local variables

org.el: Add safe predicate to (org-latex-default-packages-alist)
and (org-latex-packages-alist).
(org-splice-latex-header): Add more information to docstring.
---
 etc/ORG-NEWS | 5 +++++
 lisp/org.el  | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 93c108690..cf8ad6c78 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -195,6 +195,11 @@ addition to being added to a data attribute, ~data-linenr~, on that
 highlight and copy/paste multiple lines from a code block without
 having the line numbers included.
 
+*** ~org-latex-default-packages-alist~ and ~org-latex-packages-alist~ can be set from Emacs local variables.
+
+You can now use File or directory local variables to set the above
+variables without being prompted by Emacs.
+
 ** New functions and changes in function arguments
 
 # This also includes changes in function behavior from Elisp perspective.
diff --git a/lisp/org.el b/lisp/org.el
index 0a2c0b362..f6d83dd9c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3704,6 +3704,7 @@ A string will be inserted as-is in the header of the document."
   :group 'org-export-latex
   :set 'org-set-packages-alist
   :get 'org-get-packages-alist
+  :safe #'listp
   :package-version '(Org . "9.7")
   :type '(repeat
 	  (choice
@@ -3745,6 +3746,7 @@ Make sure that you only list packages here which:
     `org-latex-default-packages-alist'."
   :group 'org-latex
   :group 'org-export-latex
+  :safe #'listp
   :set 'org-set-packages-alist
   :get 'org-get-packages-alist
   :type
@@ -16937,6 +16939,11 @@ holder is missing, the positive one (without the \"NO-\") will be
 assumed to be present at the end of the template.
 DEF-PKG and PKG are assumed to be alists of options/packagename lists.
 EXTRA is a string.
+
+Note that setting `org-latex-default-packages-alist' to nil is equivalent
+to [NO-DEFAULT-PACKAGES] and setting `org-latex-packages-alist' to nil is
+equivalent to [NO-PACKAGES].
+
 SNIPPETS-P indicates if this is run to create snippet images for HTML."
   (let (rpl (end ""))
     (if (string-match "^[ \t]*\\[\\(NO-\\)?DEFAULT-PACKAGES\\][ \t]*\n?" tpl)
-- 
2.43.0

Reply via email to