Discussion:
[AUCTeX] Italicizing user macros
Ognjen Maric
2016-08-02 19:04:55 UTC
Permalink
Hi Arash, Ivan,

thanks for the responses. I missed them with Gmane being down. Anyway,
font-latex-add-keywords did exactly what I wanted! I also prefer the
file-local variant.

Out of curiosity - I guess this is an Emacs question rather than an
AUCTeX one, but I'll ask anyway - if I evaluate

M-:
(font-latex-add-keywords '(("inldef" "{" )) 'italic-command)

I do get the syntax highlighting, but only for the previously unrendered
parts of the document. Is there a way to force the re-fontification of
the whole buffer?

Thanks!
Ognjen
Arash Esbati
2016-08-12 19:58:30 UTC
Permalink
Hi Ognjen,
Post by Ognjen Maric
thanks for the responses. I missed them with Gmane being down. Anyway,
font-latex-add-keywords did exactly what I wanted! I also prefer the
file-local variant.
Out of curiosity - I guess this is an Emacs question rather than an
AUCTeX one, but I'll ask anyway - if I evaluate
(font-latex-add-keywords '(("inldef" "{" )) 'italic-command)
I do get the syntax highlighting, but only for the previously unrendered
parts of the document. Is there a way to force the re-fontification of
the whole buffer?
Sorry for the late response. I can't reproduce what you describe. Can
you provide a recipe?

AUCTeX comes with a command TeX-normal-mode:

,----[ C-h k C-c C-n ]
| C-c C-n runs the command TeX-normal-mode (found in LaTeX-mode-map),
| which is an interactive compiled Lisp function in ‘tex.el’.
|
| It is bound to C-c C-n, C-c #, <menu-bar> <LaTeX> <Multifile/Parsing>
| <Reset Buffer>.
|
| (TeX-normal-mode &optional ARG)
|
| Remove all information about this buffer, and apply the style hooks again.
| Save buffer first including style information.
| With optional argument ARG, also reload the style hooks.
`----

Put the specification above in a file local variable and try `C-c C-n'.

Emacs also has this:

,----
| hack-local-variables is a compiled Lisp function in ‘files.el’.
|
| (hack-local-variables &optional MODE-ONLY)
|
| Parse and put into effect this buffer’s local variables spec.
| Uses ‘hack-local-variables-apply’ to apply the variables.
|
| If MODE-ONLY is non-nil, all we do is check whether a "mode:"
| is specified, and return the corresponding mode symbol, or nil.
| In this case, we try to ignore minor-modes, and only return a
| major-mode.
|
| If ‘enable-local-variables’ or ‘local-enable-local-variables’ is nil,
| this function does nothing. If ‘inhibit-local-variables-regexps’
| applies to the file in question, the file is not scanned for
| local variables, but directory-local variables may still be applied.
`----

Best, Arash
Ognjen Maric
2016-08-15 16:48:48 UTC
Permalink
Hi Aresh,
Post by Arash Esbati
Sorry for the late response. I can't reproduce what you describe. Can
you provide a recipe?
thanks for the response. I can reproduce it with larger files if I use
eval-expression instead of putting the code in a file local variable.
But it's not really a problem, as you've already solved my use case
perfectly, so I won't waste any more of your time with that :)

Best,
Ognjen

Loading...