Re: [AUCTeX] TeX-insert-macro-default-style not applied?
Arash Esbati writes: > I'm not sure if I can give it a roll in near future, but I will add it > to my todo list. Following up myself, I had a look at this and it seems a little harder than I thought. At the end, I had to carve out some code from `TeX-parse-arguments' and write a macro in order to simulate `TeX-parse-arguments'. Manuel, can you please try the attached style files and report back if they work as expected? The recipe is: 1) Save the style files in a directory of your choice, e.g. "~/.emacs.d/private-styles" 2) Restart Emacs and in scratch, eval this (i.e., put cursor after the last paren and hit `C-x C-e'): (setq TeX-style-private (expand-file-name "~/.emacs.d/private-styles")) 3) Also in scratch, eval this macro: (defmacro LaTeX-check-insert-macro-default-style (&rest body) `(unless (if (eq TeX-insert-macro-default-style 'show-all-optional-args) (equal current-prefix-arg '(4)) (or (and (eq TeX-insert-macro-default-style 'show-optional-args) (equal current-prefix-arg '(4))) (and (eq TeX-insert-macro-default-style 'mandatory-args-only) (null (equal current-prefix-arg '(4 last-optional-rejected)) ,@body)) 4) Open your .tex file and insert the macros in question. TIA. Best, Arash <> ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] TeX-insert-macro-default-style not applied?
Mosè Giordano writes: > On Sat, Oct 27, 2018 at 5:03 PM Manuel Wiesinger wrote: >> >> Hi all, >> >> When I set TeX-insert-macro-default-style to mandatory-args-only, >> C- still asks me for optional arguments. >> >> E.g. when entering \textcolor, AUCTeX asks for the optional color model >> argument and inserts \textcolor[some_model]{some_color}{some_text}. With >> TeX-insert-macro-default-style set to mandatory-args-only, I would >> expect that I'm only asked for the mandatory color and text arguments >> and that \textcolor{some_color}{some_text} is inserted. >> >> Other macros show similar behavior. >> >> I tried this with Emacs 26.1, on two machines and with a minimal config, >> just loading AUCTeX. >> Is this a bug, or I missing something? > > `\textcolor' and similar macros use `TeX-arg-color' to insert the > color and indeed this function doesn't respect > `TeX-insert-macro-default-style', but this may be considered a feature > rather than a bug because the color specification in the mandatory > argument strongly depends on the model. The style file was created by > Arash, maybe he can give us a comment about this. Hi Manuel and Mosè, IIRC, your assumption is right here and I didn't add any code to respect `TeX-insert-macro-default-style' since the optional argument is important for mandatory ones. But then again, I think Manuel is right here and the code should respect `TeX-insert-macro-default-style'. I'm not sure if I can give it a roll in near future, but I will add it to my todo list. Best, Arash ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
Re: [AUCTeX] TeX-insert-macro-default-style not applied?
Hi Manuel, On Sat, Oct 27, 2018 at 5:03 PM Manuel Wiesinger wrote: > > Hi all, > > When I set TeX-insert-macro-default-style to mandatory-args-only, > C- still asks me for optional arguments. > > E.g. when entering \textcolor, AUCTeX asks for the optional color model > argument and inserts \textcolor[some_model]{some_color}{some_text}. With > TeX-insert-macro-default-style set to mandatory-args-only, I would > expect that I'm only asked for the mandatory color and text arguments > and that \textcolor{some_color}{some_text} is inserted. > > Other macros show similar behavior. > > I tried this with Emacs 26.1, on two machines and with a minimal config, > just loading AUCTeX. > Is this a bug, or I missing something? `\textcolor' and similar macros use `TeX-arg-color' to insert the color and indeed this function doesn't respect `TeX-insert-macro-default-style', but this may be considered a feature rather than a bug because the color specification in the mandatory argument strongly depends on the model. The style file was created by Arash, maybe he can give us a comment about this. Bye, Mosè ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex
[AUCTeX] TeX-insert-macro-default-style not applied?
Hi all, When I set TeX-insert-macro-default-style to mandatory-args-only, C- still asks me for optional arguments. E.g. when entering \textcolor, AUCTeX asks for the optional color model argument and inserts \textcolor[some_model]{some_color}{some_text}. With TeX-insert-macro-default-style set to mandatory-args-only, I would expect that I'm only asked for the mandatory color and text arguments and that \textcolor{some_color}{some_text} is inserted. Other macros show similar behavior. I tried this with Emacs 26.1, on two machines and with a minimal config, just loading AUCTeX. Is this a bug, or I missing something? Best, Manuel ___ auctex mailing list auctex@gnu.org https://lists.gnu.org/mailman/listinfo/auctex