Hello Tassilo,

----------------------------------------
> From: t...@gnu.org
> To: vincent....@hotmail.fr
> CC: auctex@gnu.org
> Subject: Re: [AUCTeX] Problem with latex2e style hook --- LaTeX/Texinfo 
> collision‏
> Date: Fri, 12 Sep 2014 21:26:40 +0200
>
> Vincent Belaïche <vincent....@hotmail.fr> writes:
>
> > Here you are.
>
> Thanks, applied. Could you please also document `TeX-add-style-hook's
> new third argument in the info docs.
>
> Bye,
> Tassilo

Please find the patch attached.

Thank you very much for your support and kind checking & installing my
contribution.

  Vincent.

diff --git a/ChangeLog b/ChangeLog
index a5c842e..ca4d1e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-09-13  Vincent Belaïche  <vincent....@hotmail.fr>
+
+	* latex.el (LaTeX-dialect): Correct doctstring for consistency
+	with definition of function TeX-add-style-hook.
+
+	* doc/auctex.texi (Simple Style): modify example with
+	'TeX-add-style-hook', so that 3rd argument is added. Modify @defun
+	of 'TeX-add-style-hook' also to document addition of 3rd argument.
+
 2014-09-11  Vincent Belaïche  <vincent....@hotmail.fr>
 
 	* doc/changes.texi: Add information about style hook labelling by dialect.
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 84ac235..8e768ae 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -4269,7 +4269,8 @@ Here is a simple example of a style file.
 (TeX-add-style-hook
  "book"
  (lambda () 
-   (LaTeX-largest-level-set "chapter")))
+   (LaTeX-largest-level-set "chapter"))
+ LaTeX-dialect)   
 @end lisp
 
 The example is from the @AUCTeX{} sources and is loaded for any @LaTeX{}
@@ -4288,11 +4289,59 @@ hooks will be called for each buffer using the style file.
 Note that the basename of the style file and the name of the style hook
 should usually be identical.
 
-@defun TeX-add-style-hook @var{style} @var{hook}
+@defun TeX-add-style-hook @var{style} @var{hook} &optional @var{dialect-expr}
 Add @var{hook} to the list of functions to run when we use the @TeX{}
-file @var{style}.
+file @var{style} and the current dialect is one in the set derived from
+@var{dialect-expr}. When @var{dialect-expr} is omitted, then @var{hook}
+is allowed to be run whatever the current dialect is.
+
+@var{dialect-expr} may be one of:
+
+@itemize
+@item
+A symbol indicating a singleton containing one basic @TeX{} dialect,
+this symbol shall be selected among:
+@table @code
+@item :latex
+For all files in @LaTeX{} mode, or any mode derived thereof
+@item :bibtex
+For all files in Bib@TeX{} mode, or any mode derived thereof
+@item :texinfo
+For all files in @acronym{Texinfo} mode.
+@end table
+@item
+A logical expression like:
+@table @code
+@item (or @var{dialect-expression1} @dots{} @var{dialect-expression_@var{n}})
+For union of the sets of dialects corresponding to  @var{dialect-expression1}
+through @var{dialect-expression_@var{n}}
+@item (and @var{dialect-expression1} @dots{} @var{dialect-expression_@var{n}})
+For intersection of the sets of dialects corresponding to
+@var{dialect-expression1} through @var{dialect-expression_@var{n}}
+@item (nor @var{dialect-expression1} @dots{} @var{dialect-expression_@var{n}})
+For complement of the union sets of dialects corresponding to
+@var{dialect-expression1} through @var{dialect-expression_@var{n}}
+relatively to the set of all supported dialects
+@item (not @var{dialect-expr})
+For complement set of dialect corresponding to @var{dialect-expr}
+relatively to the set of all supported dialects
+@end table
+@end itemize
+
 @end defun
 
+In case of adding a style hook for @LaTeX{}, when calling function
+@code{TeX-add-style-hook} it is thought more futureproof for argument
+@var{dialect-expr} to pass constant @code{LaTeX-dialect} currently
+defined to @code{:latex}, rather than passing @code{:latex} directly.
+
+@defvr Constant LaTeX-dialect
+Default dialect for use with function @code{TeX-add-style-hook} for
+argument @var{dialect-expr} when the hook is to be run only on LaTeX
+file, or any mode derived thereof.
+@end defvr
+
+
 @node Adding Macros
 @subsection Adding Support for Macros
 @cindex Adding macros
diff --git a/latex.el b/latex.el
index 2cd2b65..32a431f 100644
--- a/latex.el
+++ b/latex.el
@@ -4537,8 +4537,9 @@ use \\[customize]."
 
 (defconst LaTeX-dialect :latex
   "Default dialect for use with function `TeX-add-style-hook' for
-  argument DIALECT when the hook is to be run only on LaTeX file,
-  or any mode derived thereof. See variable `TeX-style-hook-dialect'." )
+argument DIALECT-EXPR when the hook is to be run only on LaTeX
+file, or any mode derived thereof. See variable
+`TeX-style-hook-dialect'." )
 
 (defconst LaTeX-math-default
   '((?a "alpha" "Greek Lowercase" 945) ;; #X03B1
_______________________________________________
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to