[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] TeX-add-style-hook appends or overwrites?

From: Tassilo Horn
Subject: Re: [AUCTeX] TeX-add-style-hook appends or overwrites?
Date: Thu, 21 Nov 2013 16:21:06 +0100
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Mandar Mitra <address@hidden> writes:

Hi Mandar,

> According to the documentation for TeX-add-style-hook, it should 
> "give STYLE yet another HOOK to run."
> In my .emacs, I have, via (add-hook 'LaTeX-mode-hook '(lambda () ...,

BTW, you should add custom style hooks into separate files named like
the style in the directory `TeX-style-private'.

> (TeX-add-style-hook
>  "beamer"
>  (lambda ()
>    (LaTeX-add-environments
>     '("block" (lambda (env &rest ignore) ...
> because I want "frames" and "blocks" handled a little differently from
> the default.
> When I look at the variable TeX-style-hook-list, I find that it has
> ONLY the above lambda, rather than the above in addition to the
> default provided by auctex. As a result, I don't get any of auctex's
> default goodies for beamer.

Hm, I just evaled

--8<---------------cut here---------------start------------->8---
 (lambda ()
   (TeX-add-symbols "fubble")))
--8<---------------cut here---------------end--------------->8---

and now `TeX-style-hook-list' contains

--8<---------------cut here---------------start------------->8---
  (lambda nil
    (TeX-add-symbols "fubble"))
  #[the original byte-compiled hook])
--8<---------------cut here---------------end--------------->8---

as expected.  So the documentation is correct.  `TeX-add-style-hook' has
been changed the last time in 1999, so it's strange that only the last
hook is in `TeX-style-hook-list' for you...  Maybe `C-u C-c C-n' helps?

However, there may still be problems with overriding macro and
environment definitions of style files that come with auctex.
Basically, if there are multiple

  (TeX-add-symbols '("foo" ...))
  (LaTeX-add-environments '("block" ...))

like it seems to be in your case, then AUCTeX uses the longest
definition, i.e., the definition with the most arguments.  So your
"block" environment definition needs to declare more arguments than the
definition in the standard "beamer" hook.  You can easily get that done
by declaring some artificial arguments using `ignore' as the reading
function, e.g., this override should work

    '("block" (lambda (env &rest ignore)...) ignore))

because the original definition declares only one argument.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]