GNU bug report logs -
#78296
Hand-written styles with `LaTeX-provided-package-options'
Previous Next
To reply to this bug, email your comments to 78296 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-auctex <at> gnu.org
:
bug#78296
; Package
auctex
.
(Wed, 07 May 2025 08:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Arash Esbati <arash <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-auctex <at> gnu.org
.
(Wed, 07 May 2025 08:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi all,
say you have a .tex file like this:
--8<---------------cut here---------------start------------->8---
\documentclass[11pt]{article}
\usepackage{mypackage}
\begin{document}
foo
\end{document}
%%% Local Variables:
%%% mode: LaTeX
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---
loading mypackage.sty and you have also written an AUCTeX style file
mypackage.el which looks like this:
--8<---------------cut here---------------start------------->8---
;;; -*- lexical-binding: t; -*-
(TeX-add-style-hook
"mypackage"
(lambda ()
(TeX-add-to-alist 'LaTeX-provided-class-options
'(("article" "11pt")))
(TeX-add-to-alist 'LaTeX-provided-package-options
'(("babel" "english")
("booktabs" "")
("fontspec" "")
("geometry" "a4paper")
("graphicx" "")
("lastpage" "")
("microtype" "activate")
("parskip" "")
("siunitx" "")
("tabularx" "")
("titlesec" "pagestyles")
("xcolor" "svgnames")
("xspace" "")))
(TeX-run-style-hooks
"article"
"babel"
"booktabs"
"fontspec"
"geometry"
"graphicx"
"lastpage"
"microtype"
"parskip"
"siunitx"
"tabularx"
"titlesec"
"xcolor"
"xspace"))
TeX-dialect)
--8<---------------cut here---------------end--------------->8---
IIUC, the hand-written additions to `LaTeX-provided-package-options' and
`LaTeX-provided-class-options' are never activated in the .tex file. I
played with moving these forms around from `LaTeX-auto-cleanup':
(setq LaTeX-provided-class-options nil)
(setq LaTeX-provided-package-options nil)
but no avail. The best solution I can currently offer is:
--8<---------------cut here---------------start------------->8---
diff --git a/latex.el b/latex.el
index 3a32c4e7..8b35851a 100644
--- a/latex.el
+++ b/latex.el
@@ -1943,6 +1943,8 @@ For example, its value will be
...)
See also `LaTeX-provided-package-options'.")
+(add-to-list 'TeX-normal-mode-reset-list 'LaTeX-provided-class-options)
+
(defun LaTeX-provided-class-options-member (class option)
"Return non-nil if OPTION has been given to CLASS at load time.
The value is actually the tail of the list of options given to CLASS."
@@ -1966,6 +1968,8 @@ For example, its value will be
...)
See also `LaTeX-provided-class-options'.")
+(add-to-list 'TeX-normal-mode-reset-list 'LaTeX-provided-package-options)
+
(defun LaTeX-provided-package-options-member (package option)
"Return non-nil if OPTION has been given to PACKAGE at load time.
The value is actually the tail of the list of options given to PACKAGE."
@@ -2140,8 +2144,8 @@ TYPE is one of the symbols mac or env."
LaTeX-auto-bibliography)))
;; Reset class and packages options for the current buffer
- (setq LaTeX-provided-class-options nil)
- (setq LaTeX-provided-package-options nil)
+ ;; (setq LaTeX-provided-class-options nil)
+ ;; (setq LaTeX-provided-package-options nil)
;; Cleanup document classes and packages
(unless (null LaTeX-auto-style)
--8<---------------cut here---------------end--------------->8---
I.e., adding the variables to `TeX-normal-mode-reset-list' and deleting
the forms inside `LaTeX-auto-cleanup'. Am I missing something?
Best, Arash
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#78296
; Package
auctex
.
(Fri, 09 May 2025 09:06:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 78296 <at> debbugs.gnu.org (full text, mbox):
Hi Arash,
>>>>> Arash Esbati <arash <at> gnu.org> writes:
> --8<---------------cut here---------------start------------->8---
> \documentclass[11pt]{article}
> \usepackage{mypackage}
> \begin{document}
> foo
> \end{document}
> %%% Local Variables:
> %%% mode: LaTeX
> %%% TeX-master: t
> %%% End:
> --8<---------------cut here---------------end--------------->8---
> loading mypackage.sty and you have also written an AUCTeX style file
> mypackage.el which looks like this:
> --8<---------------cut here---------------start------------->8---
> ;;; -*- lexical-binding: t; -*-
> (TeX-add-style-hook
> "mypackage"
> (lambda ()
> (TeX-add-to-alist 'LaTeX-provided-class-options
> '(("article" "11pt")))
> (TeX-add-to-alist 'LaTeX-provided-package-options
> '(("babel" "english")
> ("booktabs" "")
> ("fontspec" "")
> ("geometry" "a4paper")
> ("graphicx" "")
> ("lastpage" "")
> ("microtype" "activate")
> ("parskip" "")
> ("siunitx" "")
> ("tabularx" "")
> ("titlesec" "pagestyles")
> ("xcolor" "svgnames")
> ("xspace" "")))
> (TeX-run-style-hooks
> "article"
> "babel"
> "booktabs"
> "fontspec"
> "geometry"
> "graphicx"
> "lastpage"
> "microtype"
> "parskip"
> "siunitx"
> "tabularx"
> "titlesec"
> "xcolor"
> "xspace"))
> TeX-dialect)
> --8<---------------cut here---------------end--------------->8---
> IIUC, the hand-written additions to `LaTeX-provided-package-options' and
> `LaTeX-provided-class-options' are never activated in the .tex file.
Hmm, indeed.
> The best solution I can currently offer is:
> --8<---------------cut here---------------start------------->8---
> diff --git a/latex.el b/latex.el
> index 3a32c4e7..8b35851a 100644
> --- a/latex.el
> +++ b/latex.el
> @@ -1943,6 +1943,8 @@ For example, its value will be
> ...)
> See also `LaTeX-provided-package-options'.")
> +(add-to-list 'TeX-normal-mode-reset-list 'LaTeX-provided-class-options)
> +
> (defun LaTeX-provided-class-options-member (class option)
> "Return non-nil if OPTION has been given to CLASS at load time.
> The value is actually the tail of the list of options given to CLASS."
> @@ -1966,6 +1968,8 @@ For example, its value will be
> ...)
> See also `LaTeX-provided-class-options'.")
> +(add-to-list 'TeX-normal-mode-reset-list 'LaTeX-provided-package-options)
> +
> (defun LaTeX-provided-package-options-member (package option)
> "Return non-nil if OPTION has been given to PACKAGE at load time.
> The value is actually the tail of the list of options given to PACKAGE."
> @@ -2140,8 +2144,8 @@ TYPE is one of the symbols mac or env."
> LaTeX-auto-bibliography)))
> ;; Reset class and packages options for the current buffer
> - (setq LaTeX-provided-class-options nil)
> - (setq LaTeX-provided-package-options nil)
> + ;; (setq LaTeX-provided-class-options nil)
> + ;; (setq LaTeX-provided-package-options nil)
> ;; Cleanup document classes and packages
> (unless (null LaTeX-auto-style)
> --8<---------------cut here---------------end--------------->8---
> I.e., adding the variables to `TeX-normal-mode-reset-list' and deleting
> the forms inside `LaTeX-auto-cleanup'. Am I missing something?
I think that would be a reasonable solution. (Maybe we should tune
`LaTeX-auto-cleanup' to skip, for efficiency, additions to
`LaTeX-provided-package-options' and `LaTeX-provided-class-options' when
those variables already have non-nil bindings.)
Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#78296
; Package
auctex
.
(Fri, 09 May 2025 12:42:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 78296 <at> debbugs.gnu.org (full text, mbox):
Hi Keita,
Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
> I think that would be a reasonable solution.
Thanks for looking at this.
> (Maybe we should tune `LaTeX-auto-cleanup' to skip, for efficiency,
> additions to `LaTeX-provided-package-options' and
> `LaTeX-provided-class-options' when those variables already have
> non-nil bindings.)
How would you then reset those variables? Say, you comment out your
hand-written package and hit C-c C-n, now those variables should not
contain your additions, but that will not happen, right? Or am I
missing something?
Best, Arash
Information forwarded
to
bug-auctex <at> gnu.org
:
bug#78296
; Package
auctex
.
(Mon, 12 May 2025 13:32:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 78296 <at> debbugs.gnu.org (full text, mbox):
Hi Arash,
>>>>> Arash Esbati <arash <at> gnu.org> writes:
>> (Maybe we should tune `LaTeX-auto-cleanup' to skip, for efficiency,
>> additions to `LaTeX-provided-package-options' and
>> `LaTeX-provided-class-options' when those variables already have
>> non-nil bindings.)
> How would you then reset those variables? Say, you comment out your
> hand-written package and hit C-c C-n, now those variables should not
> contain your additions, but that will not happen, right? Or am I
> missing something?
My thought is to add such skips in addition to your proposal, so I
expect that prefix argument C-u for C-c C-n would reset those variables.
(Please forgive me if I'm saying something stupid.)
Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW
This bug report was last modified 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.