auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Problem with latex2e style hook --- LaTeX/Texinfo collision


From: Tassilo Horn
Subject: Re: [AUCTeX] Problem with latex2e style hook --- LaTeX/Texinfo collision
Date: Thu, 14 Aug 2014 14:54:21 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux)

Vincent Belaïche <address@hidden> writes:

Hi Vincent,

> So, I thought a little bit, and I am coming with another solution
> attached to this email as file <auctex-texinfo-style-hooks.diff>. That
> amounts to marking each hook with a context symbol and runing the hook
> function only conditionally to the context being active. It is
> implemented in a way that all LaTeX specific existing code (notably
> style hooks and user init files I think) can remain unchanged, only
> Texinfo specific stuff may need some context-marking.

Some comments below.

> diff --git a/tex.el b/tex.el
> index 068859f..6431f79 100644
> --- a/tex.el
> +++ b/tex.el
> @@ -2318,9 +2318,37 @@ Used when checking if any files have changed."
>  (defvar TeX-style-hook-list nil
>    "List of TeX style hooks currently loaded.
> 
> -Each entry is a list where the first element is the name of the style,
> -and the remaining elements are hooks to be run when that style is
> -active.")
> +Each entry is a list:
> +
> + (STYLE HOOK1 HOOK2 ...)
> +
> +where the first element  STYLE is the name of the style,
> +and the remaining elements HOOKN, if any, are hooks to be run when that 
> style is
> +active. 

Please fill the paragraph.

> +A hook HOOKN may a hook function HOOK-FUN to be run in non-Texinfo
                   ^
There's a "be" missing.

> +context only, or a vector [TeX-style-hook HOOK-FUN CONTEXT] where
> +HOOK-FUN is the hook function to be run, and CONTEXT is a symbol
> +defining in which context the hook function may be run. 

Why [TeX-style-hook HOOK-FUN CONTEXT] and not simply [HOOK-FUN CONTEXT]?

> +(defvar TeX-style-hook-context nil
> +  "Context for running hooks locally to the considered file.
> +May take two values:
> +
> +* 'nil'      for non-Texinfo files
> +* ':texinfo' for Texinfo files.

I think, I'd like it more if there was an explicit :latex context
instead of just nil.  Maybe, at some point we will also want to have a
:context context for ConTeXt.

I'm not sure about the calling conventions.  Right now, the context in
your functions is optional and when omitted it means "everywhere except
for texinfo".  I'm not sure if that's the best semantics in the longer
term.  IMHO, it would be more logical with the meaning

  nil               => in every context (like it's now)
  :latex            => only in the latex context
  (:latex :texinfo) => only in the latex or texinfo contexts

Maybe even a negation would be useful, e.g.,

  (not :texinfo)    => in any context except texinfo

Of course that would mean that most if not all styles need to be changed
to call

  (TeX-add-style-hook "thestyle" (lambda () ...) :latex)

but that's just a one-time effort.

> +Purpose is to prevent non-Texinfo hooks to be run in Texinfo
> +files, due to ambiguous style name, as this may cause bad side effect e.g. 
> on variable 'TeX-font-list'.")

Please fill that paragraph.

> Sorry for that, but I could not retain myself for doing other changes
> --- beautifying and optimizing a few things --- attached to this email
> as <auctex-optimizations.diff>.
>
> auctex-optimizations.diff patch isn't related with the latex2e style
> hook problem, so I did it as a first change as I naively think that it
> should not be contentious, and then auctex-texinfo-style-hooks.diff is
> a second patch over that first one.

The patch is backwards. ;-)

Oh, and at least `assoc-string' doesn't seem to be available in XEmacs,
neither in the stable nor the beta release.

Bye,
Tassilo



reply via email to

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