[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] Can the hook `TeX-after-compilation-finished-functions' wor
Re: [AUCTeX] Can the hook `TeX-after-compilation-finished-functions' work as a file local variable?
Wed, 11 Apr 2018 23:29:19 +0200
Gnus/5.13 (Gnus v5.13) Emacs/25.3
address@hidden (Diogo F. S. Ramos) writes:
>>> I'm setting the hook `TeX-after-compilation-finished-functions' as a
>>> file local variable, but the functions aren't being called after I
>>> compile my document. Shouldn't they?
>> try adding your function to the hook with `add-hook'; this works for me:
>> %%% Local Variables:
>> %%% mode: latex
>> %%% TeX-master: t
>> %%% eval: (add-hook 'TeX-after-compilation-finished-functions (lambda (x)
>> (message "hello, world!")))
>> %%% End:
> Ah, thank you, Arash. But I think then the variable
> `TeX-after-compilation-finished-functions' won't be file local. I want
> it to be file local so the function in hook will only execute if I
> compile this document.
,----[ C-h f add-hook RET ]
| add-hook is a compiled Lisp function in ‘subr.el’.
| (add-hook HOOK FUNCTION &optional APPEND LOCAL)
| Add to the value of HOOK the function FUNCTION.
| FUNCTION is not added if already present.
| FUNCTION is added (if necessary) at the beginning of the hook list
| unless the optional argument APPEND is non-nil, in which case
| FUNCTION is added at the end.
| The optional fourth argument, LOCAL, if non-nil, says to modify
| the hook’s buffer-local value rather than its global value.
| This makes the hook buffer-local, and it makes t a member of the
| buffer-local value. That acts as a flag to run the hook
| functions of the global value as well as in the local value.
| HOOK should be a symbol, and FUNCTION may be any valid function. If
| HOOK is void, it is first set to nil. If HOOK’s value is a single
| function, it is changed to a list of functions.
Set the LOCAL argument to t. It should do the trick.