[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclas
From: |
Ikumi Keita |
Subject: |
Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm |
Date: |
Sun, 18 Nov 2018 18:49:50 +0900 |
Hi Arash,
>>>>> Arash Esbati <address@hidden> writes:
> using `TeX-update-style-hook' would have been also my suggestion -- I
> think it is the straightforward approach.
Hmm, then should we go the way of the revised patch #1? It saves the
value of `TeX-active-styles' by let-binding.
>> Thus I propose another patch #2 to defer running style hooks until the
>> package options are actually given.
>>
>> How do you think about these ideas?
> I like this one. The current implementation bugged me also as I wrote
> enumitem.el; one has to hit `C-c C-n' after doing `C-c C-m usepackage
> RET name RET' in order to get things right. And I'm not sure if your
> patch break other things. So +1 from me :)
Thanks. I found that the previous patch is not sufficient in some cases
because there are style files which requires running style hooks to
obtain proper package options. For example, empheq.el has the following
code:
(TeX-add-style-hook
"empheq"
...
;; Load amsmath.el and mathtools.el
(TeX-run-style-hooks "amsmath" "mathtools")
;; Add elements from `LaTeX-mathtools-package-options' only once
;; and not every time the style hook runs
(dolist (elt LaTeX-mathtools-package-options)
(add-to-list 'LaTeX-empheq-package-options elt))
...
Though I haven't verified yet, I suppose there are many other style
files like this. So I reconsidered the implementation to create the
revised patch #2. It runs the style hooks twice, once to collect the
package options for completion, another to reflect the options entered
by the user. This is the same as what `TeX-arg-document' does, after
all. In order to ensure the second run even with
`LaTeX-arg-usepackage', I again binds `TeX-active-styles' by `let' in
`LaTeX-arg-usepackage-read-packages-with-options'.
Maybe `(let ((TeX-active-styles TeX-active-styles))' is better than
`(let ((TeX-active-styles nil))' here.
Best,
Ikumi Keita
0001-Fix-not-to-run-wrong-style-hooks.patch.gz
Description: revised patch #1
0002-Ensure-to-reflect-package-options.patch.gz
Description: revised patch #2
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, jfbu, 2018/11/10
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Mosè Giordano, 2018/11/10
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Ikumi Keita, 2018/11/11
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Ikumi Keita, 2018/11/15
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Arash Esbati, 2018/11/16
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm,
Ikumi Keita <=
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Arash Esbati, 2018/11/18
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Ikumi Keita, 2018/11/20
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Mosè Giordano, 2018/11/21
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Ikumi Keita, 2018/11/23
- Re: [AUCTeX] Set automatically TeX-PDF-from-DVI variable if documentclass receives option dvipdfmx or dvipdfm, Ikumi Keita, 2018/11/26