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: Vincent Belaïche
Subject: Re: [AUCTeX] Problem with latex2e style hook --- LaTeX/Texinfo collision‏
Date: Wed, 10 Sep 2014 22:25:44 +0200

Hello,

Attached is the other patch --- that with bitmap based style hook
dialect sets.

It saves 43 lines of code in tex.el, and also has a smaller memory
footprint per hooks because an integer is smalled than a list containing
one symbol (best case for the sorted list based implementation).

I could save even a little more if we decide to remove the nor operator
--- I feel that in the end we will do that.

I have done the same basic tests, and it works the same...

more feedback below...
  
> From: address@hidden
> To: address@hidden
> CC: address@hidden
> Subject: Re: [AUCTeX] Problem with latex2e style hook --- LaTeX/Texinfo 
> collision‏
> Date: Wed, 10 Sep 2014 16:56:02 +0200
> 
> Vincent Belaïche <address@hidden> writes:
> 
> >> FWIW, I wouldn't mind releasing with that patch and an appropriate
> >> info doc update & NEWS entry (Vincent, could you please add that?)
> >
> > Yes, of course, I will do that in the next patch version.
> 
> Do that once we have settled on a specific patch version.
> 
> > Please make me know whether you are happy with the sorted-list based
> > implementation of style-hook set arithmetic, or if you think that
> > bitmaps are better.
> 
> Since you said that bitmaps would be easier to maintain, shorter, and
> simpler, I'm in favor of that. See my other mail.
> 
> > Also what about the nor/not discussion, I suggest that we keep only
> > `nor' and rename it `not'. Do you agree ?
> 
> No, see my other mail. I don't get why (not (or :a :b)) isn't
> equivalent to (nor :a :b) in every case.

Well, after more thoughts, that is a bug of the sorted list based
implementation of `not' operator which I submitted in the previous
patch: this implementation of the not operator was restricted to one
argument being a dialect, and not allowing argument being _any_ dialect
expression. So it was possible to do

   (not :a)

but not

  (not (or :a :b))
  
since :a is a both a dialect and a dialect expression, while (or :a :b)
is a dialect expression, but not a dialect.

I can correct this bug if we decide to go for the sorted-list based
implementation, which now I really doubt we will do.

> And in my book, the logical `not' is always unary.
>

It could be seen as an implementation trick to have `not' delegating to
`nor'. After all, for all x, (nor x) will yield the `same set' as (not
x) --- where `same set', does not necessarilly means same integer as
there are non significant bits.

However I decided to provide separate implementations for nor and not,
as I think that you wish to get rid of `nor', and the `not' specific
implementation is slightly simpler.

About non significant bits, I mean that

  (or :latex :bibtex)

and

  (not :texinfo)

is the same set, but not the same integer value. That does not really
matter.

Maybe to avoid these non-significant bits variations, I should have used
(logxor TeX-shdex-all x) rather than (lognot x) for not operator,
with TeX-shdex-all = 2^(3 dialects) -1 = 7, e.g. defined as:

(defconst TeX-shdex-all
  (lognot
    (let ((dialect-count (length TeX-style-hook-dialect-weight-alist)))
         (lsh (lsh -1 (- dialect-count)) dialect-count))))

I don't think that this is really needed, but your opinion is welcome.

> Bye,

Good night --- if you are on CEST time,

   Vincent.

diff --git a/ChangeLog b/ChangeLog
index 9b70f3a..2318fb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,329 @@
+2014-09-08  Vincent Belaïche  <address@hidden>
+
+       * style/xspace.el ("xspace"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/xparse.el ("xparse"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/virtex.el ("virtex"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/verbatim.el ("verbatim"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/varioref.el ("varioref"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/url.el ("url"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/units.el ("units"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/unicode-math.el ("unicode-math"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/ulem.el ("ulem"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/tabulary.el ("tabulary"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/tabularx.el ("tabularx"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/swedish.el ("swedish"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/subfigure.el ("subfigure"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/slovak.el ("slovak"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/slides.el ("slides"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/siunitx.el ("siunitx"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/shortvrb.el ("shortvrb"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/setspace.el ("setspace"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/scrreprt.el ("scrreprt"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/scrpage2.el ("scrpage2"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/scrlttr2.el ("scrlttr2"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/scrbook.el ("scrbook"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/scrbase.el ("scrbase"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/scrartcl.el ("scrartcl"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/ruby.el ("ruby"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/report.el ("report"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/ragged2e.el ("ragged2e"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/pstricks.el ("pstricks"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/pst-slpe.el ("pst-slpe"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/pst-plot.el ("pst-plot"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/pst-node.el ("pst-node"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/pst-grad.el ("pst-grad"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/psfig.el ("psfig"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/prosper.el ("prosper"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/polski.el ("polski"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/polish.el ("polish"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/plhb.el ("plhb"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/plfonts.el ("plfonts"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/plext.el ("plext"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/placeins.el ("placeins"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/pdfsync.el ("pdfsync"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/paralist.el ("paralist"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/nomencl.el ("nomencl"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/nicefrac.el ("nicefrac"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/ngerman.el ("ngerman"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/naustrian.el ("naustrian"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/natbib.el ("natbib"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/nameref.el ("nameref"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/multirow.el ("multirow"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/multind.el ("multind"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/multido.el ("multido"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/multicol.el ("multicol"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/mflogo.el ("mflogo"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/metalogo.el ("metalogo"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/memoir.el ("memoir"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/mdwlist.el ("mdwlist"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/mathtools.el ("mathtools"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/makeidx.el ("makeidx"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/luacode.el ("luacode"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/ltxdoc.el ("ltxdoc"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/ltx-base.el ("ltx-base"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/lscape.el ("lscape"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/longtable.el ("longtable"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/listings.el ("listings"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/lipsum.el ("lipsum"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/lettrine.el ("lettrine"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/letter.el ("letter"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/latexinfo.el ("latexinfo"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/kpfonts.el ("kpfonts"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/kantlipsum.el ("kantlipsum"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/jurabib.el ("jurabib"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/jura.el ("jura"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/jsbook.el ("jsbook"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/jsarticle.el ("jsarticle"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/jreport.el ("jreport"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/jbook.el ("jbook"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/jarticle.el ("jarticle"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/j-report.el ("j-report"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/j-book.el ("j-book"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/j-article.el ("j-article"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/italian.el ("italian"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/inputenc.el ("inputenc"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/index.el ("index"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/imakeidx.el ("imakeidx"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/icelandic.el ("icelandic"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/hyperref.el ("hyperref"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/harvard.el ("harvard"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/graphicx.el ("graphicx"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/graphics.el ("graphics"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/german.el ("german"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/frenchb.el ("frenchb"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/french.el ("french"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/francais.el ("francais"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/footmisc.el ("footmisc"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/fontspec.el ("fontspec"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/foils.el ("foils"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/flashcards.el ("flashcards"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/filecontents.el ("filecontents"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/fancyvrb.el ("fancyvrb"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/fancyref.el ("fancyref"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/fancynum.el ("fancynum"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/fancyhdr.el ("fancyhdr"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/exercise.el ("exercise"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/everysel.el ("everysel"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/epsf.el ("epsf"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/epigraph.el ("epigraph"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/english.el ("english"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/emp.el ("emp"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/dutch.el ("dutch"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/doc.el ("doc"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/dk.el ("dk"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/dinbrief.el ("dinbrief"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/danish.el ("danish"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/czech.el ("czech"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/csquotes.el ("csquotes"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/comment.el ("comment"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/captcont.el ("captcont"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/bulgarian.el ("bulgarian"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/booktabs.el ("booktabs"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/book.el ("book"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/bm.el ("bm"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/bigstrut.el ("bigstrut"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/bigdelim.el ("bigdelim"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/biblatex.el ("biblatex"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/beamer.el ("beamer"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/babel.el ("babel"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/austrian.el ("austrian"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/article.el ("article"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/array.el ("array"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/amsthm.el ("amsthm"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/amstext.el ("amstext"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/amstex.el ("amstex"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/amssymb.el ("amssymb"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/amsopn.el ("amsopn"): Add LaTeX-dialect to
+       TeX-add-style-hook call. Update header with correct filename.
+
+       * style/amsmath.el ("amsmath"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/amsbsy.el ("amsbsy"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/amsbook.el ("amsbook"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/amsart.el ("amsart"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/alphanum.el ("alphanum"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/alltt.el ("alltt"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/afterpage.el ("afterpage"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/acronym.el ("acronym"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/acro.el ("acro"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * style/MinionPro.el ("MinionPro"): Add LaTeX-dialect to 
TeX-add-style-hook call.
+
+       * style/CJKutf8.el ("CJKutf8"): Add LaTeX-dialect to TeX-add-style-hook 
call.
+
+       * style/CJK.el ("CJK"): Add LaTeX-dialect to TeX-add-style-hook call.
+
+       * bib-cite.el (eval-after-load "bibtex"): Add hook
+       TeX-bibtex-set-BibTeX-dialect to BibTex mode, this will set
+       'TeX-style-hook-dialect' to :bibtex for BibTeX files so that
+       Mosè's problem should be solved.
+
+       * latex.el (LaTeX-common-initialization): set
+       'TeX-style-hook-dialect' to :latex for LaTeX files, and those in
+       LaTeX derived modes. Add LaTeX-dialect as DIALECT argument to all
+       calls of TeX-add-style-hook.
+
+       * tex.el (TeX-bibtex-set-BibTeX-dialect): New defun.
+       (TeX-style-hook-list): Update docstring to make clear
+       that style hooks can also be in the form
+       '[TeX-style-hook HOOK-FUN DIALECT DIALECT-CACHE]'
+       (TeX-style-hook-context): New defvar, used to have style hooks
+       called only in corresponding context.
+       (TeX-add-style-hook): Add optional argument context for marking
+       hooks that must run only in non default (aka nil) context.
+       (TeX-keep-hooks-in-context): New defun, used for unloading only
+       those hooks in a context list.
+       (TeX-unload-style): Add optional argument context-list for
+       unloading only those hooks marked for contexts in that
+       context-list.
+       (TeX-run-style-hooks): Run style hook only when current style hook
+       context matches context for which hook is marked.
+
+       * tex-info.el (Texinfo-environment-list): Add 'html' and 'float'
+       environments.
+       (TeX-texinfo-mode): set 'TeX-style-hook-dialect' to :texinfo for
+       Texinfo files. Add macro '@caption'.
+
 2014-09-08  Tassilo Horn  <address@hidden>
 
        * tex.el (TeX-assoc-string): Remove docstring from defalias since
diff --git a/bib-cite.el b/bib-cite.el
index 8ac7ac9..612641c 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -941,6 +941,7 @@ runs bib-find, and [mouse-3] runs bib-display."
   (eval-after-load
    "bibtex"
    '(progn
+      (add-hook 'bibtex-mode-hook 'TeX-bibtex-set-BibTeX-dialect)
       (cond
        ((lookup-key bibtex-mode-map [menu-bar move/edit])
        (define-key-after
diff --git a/latex.el b/latex.el
index b260625..2cd2b65 100644
--- a/latex.el
+++ b/latex.el
@@ -4535,6 +4535,11 @@ use \\[customize]."
     (unless (lookup-key map (LaTeX-math-abbrev-prefix))
       (define-key map (LaTeX-math-abbrev-prefix) 'self-insert-command))))
 
+(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'." )
+
 (defconst LaTeX-math-default
   '((?a "alpha" "Greek Lowercase" 945) ;; #X03B1
     (?b "beta" "Greek Lowercase" 946) ;; #X03B2
@@ -5775,6 +5780,7 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
 
   (setq TeX-header-end LaTeX-header-end
        TeX-trailer-start LaTeX-trailer-start)
+  (set (make-local-variable 'TeX-style-hook-dialect) :latex)
 
   (require 'outline)
   (set (make-local-variable 'outline-level) 'LaTeX-outline-level)
@@ -6147,7 +6153,8 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
                      (lambda ()
                        (setq TeX-font-list LaTeX-font-list)
                        (setq TeX-font-replace-function 'TeX-font-replace-macro)
-                       (run-hooks 'LaTeX2e-hook)))
+                       (run-hooks 'LaTeX2e-hook))
+                     LaTeX-dialect)
 
   (TeX-add-style-hook "latex2"
                      ;; Use old fonts for `\documentstyle' documents.
@@ -6155,27 +6162,28 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
                        (setq TeX-font-list (default-value 'TeX-font-list))
                        (setq TeX-font-replace-function
                              (default-value 'TeX-font-replace-function))
-                       (run-hooks 'LaTeX2-hook)))
+                       (run-hooks 'LaTeX2-hook))
+                     LaTeX-dialect)
 
   ;; There must be something better-suited, but I don't understand the
   ;; parsing properly.  -- dak
-  (TeX-add-style-hook "pdftex" 'TeX-PDF-mode-on)
-  (TeX-add-style-hook "pdftricks" 'TeX-PDF-mode-on)
-  (TeX-add-style-hook "pst-pdf" 'TeX-PDF-mode-on)
-  (TeX-add-style-hook "dvips" 'TeX-PDF-mode-off)
+  (TeX-add-style-hook "pdftex" 'TeX-PDF-mode-on LaTeX-dialect)
+  (TeX-add-style-hook "pdftricks" 'TeX-PDF-mode-on LaTeX-dialect)
+  (TeX-add-style-hook "pst-pdf" 'TeX-PDF-mode-on LaTeX-dialect)
+  (TeX-add-style-hook "dvips" 'TeX-PDF-mode-off LaTeX-dialect)
   ;; This is now done in style/pstricks.el because it prevents other
   ;; pstricks style files from being loaded.
   ;;   (TeX-add-style-hook "pstricks" 'TeX-PDF-mode-off)
-  (TeX-add-style-hook "psfrag" 'TeX-PDF-mode-off)
-  (TeX-add-style-hook "dvipdf" 'TeX-PDF-mode-off)
-  (TeX-add-style-hook "dvipdfm" 'TeX-PDF-mode-off)
+  (TeX-add-style-hook "psfrag" 'TeX-PDF-mode-off LaTeX-dialect)
+  (TeX-add-style-hook "dvipdf" 'TeX-PDF-mode-off LaTeX-dialect)
+  (TeX-add-style-hook "dvipdfm" 'TeX-PDF-mode-off LaTeX-dialect)
   ;;  (TeX-add-style-hook "DVIoutput" 'TeX-PDF-mode-off)
   ;;
   ;;  Well, DVIoutput indicates that we want to run PDFTeX and expect to
   ;;  get DVI output.  Ugh.
   (TeX-add-style-hook "ifpdf" (lambda ()
                                (TeX-PDF-mode-on)
-                               (TeX-PDF-mode-off)))
+                               (TeX-PDF-mode-off)) LaTeX-dialect)
   ;; ifpdf indicates that we cater for either.  So calling both
   ;; functions will make sure that the default will get used unless the
   ;; user overrode it.
diff --git a/style/CJK.el b/style/CJK.el
index fa285bd..f21d1a9 100644
--- a/style/CJK.el
+++ b/style/CJK.el
@@ -88,6 +88,7 @@ The function can be used for CJK and CJK* environments."
    ;; New environments
    (LaTeX-add-environments
     '("CJK" LaTeX-env-CJK)
-    '("CJK*" LaTeX-env-CJK))))
+    '("CJK*" LaTeX-env-CJK)))
+ LaTeX-dialect)
 
 ;;; CJK.el ends here
diff --git a/style/CJKutf8.el b/style/CJKutf8.el
index ea3c2e3..c9e16b6 100644
--- a/style/CJKutf8.el
+++ b/style/CJKutf8.el
@@ -33,6 +33,7 @@
 (TeX-add-style-hook
  "CJKutf8"
  (lambda ()
-   (TeX-run-style-hooks "CJK")))
+   (TeX-run-style-hooks "CJK"))
+ LaTeX-dialect)
 
 ;;; CJKutf8.el ends here
diff --git a/style/MinionPro.el b/style/MinionPro.el
index 7151c36..3441911 100644
--- a/style/MinionPro.el
+++ b/style/MinionPro.el
@@ -58,7 +58,8 @@
                                ("textsw" "{")
                                ("textssc" "{"))
                              'textual)
-     (font-latex-add-keywords '(("figureversion" "{")) 'variable))))
+     (font-latex-add-keywords '(("figureversion" "{")) 'variable)))
+ LaTeX-dialect)
 
 (defvar LaTeX-MinionPro-package-options
   '("smallfamily" "medfamily" "fullfamily" "noopticals" "opticals"
diff --git a/style/acro.el b/style/acro.el
index 93eb32f..fda4b71 100644
--- a/style/acro.el
+++ b/style/acro.el
@@ -282,7 +282,8 @@ be a list with strings to be used as values for the key."
                                ("iacflike" "*{")
                                ("Iacflike" "*{")
                                ("acuse" "{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defun LaTeX-acro-package-options ()
   "Prompt for package options for the acro package."
diff --git a/style/acronym.el b/style/acronym.el
index 11295d1..86a8e68 100644
--- a/style/acronym.el
+++ b/style/acronym.el
@@ -167,7 +167,8 @@ string."
                                ("acroplural" "{[{")
                                ("acrodefplural" "{[{")
                                ("newacroplural" "{[{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-acronym-package-options
   '("footnote" "nohyperlinks" "printonlyused" "withpage" "smaller" "dua" 
"nolist")
diff --git a/style/afterpage.el b/style/afterpage.el
index 5e8c579..ec0d320 100644
--- a/style/afterpage.el
+++ b/style/afterpage.el
@@ -34,7 +34,8 @@
  "afterpage"
  (lambda ()
    (TeX-add-symbols
-    '("afterpage" t))))
+    '("afterpage" t)))
+ LaTeX-dialect)
 
 (defvar LaTeX-afterpage-package-options nil
   "Package options for afterpage.")
diff --git a/style/alltt.el b/style/alltt.el
index a266a88..e5c5684 100644
--- a/style/alltt.el
+++ b/style/alltt.el
@@ -47,7 +47,8 @@
      (font-latex-set-syntactic-keywords)
      ;; Tell font-lock about the update.
      (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults))))
+     (font-lock-set-defaults)))
+ LaTeX-dialect)
 
 (defvar LaTeX-alltt-package-options nil
   "Package options for the alltt package.")
diff --git a/style/alphanum.el b/style/alphanum.el
index 43ce10e..64d694c 100644
--- a/style/alphanum.el
+++ b/style/alphanum.el
@@ -92,7 +92,8 @@
    (if (fboundp 'reftex-add-section-levels)
        (reftex-add-section-levels
        '(("toc" .  reftex-get-section-level-alphanum)
-         ("sub" .  reftex-get-section-level-alphanum))))))
+         ("sub" .  reftex-get-section-level-alphanum)))))
+ LaTeX-dialect)
 
 ;; Local Variables:
 ;; coding: iso-8859-1
diff --git a/style/amsart.el b/style/amsart.el
index 51a2902..8e3ae5c 100644
--- a/style/amsart.el
+++ b/style/amsart.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook "amsart"
  (function
   (lambda ()
-    (TeX-run-style-hooks "amsmath" "amsthm"))))
+    (TeX-run-style-hooks "amsmath" "amsthm")))
+ LaTeX-dialect)
 
 ;;; amsart.el ends here.
diff --git a/style/amsbook.el b/style/amsbook.el
index ccbc84e..192b807 100644
--- a/style/amsbook.el
+++ b/style/amsbook.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook "amsbook"
  (function
   (lambda ()
-    (TeX-run-style-hooks "amsmath" "amsthm"))))
+    (TeX-run-style-hooks "amsmath" "amsthm")))
+ LaTeX-dialect)
 
 ;;; amsbook.el ends here.
diff --git a/style/amsbsy.el b/style/amsbsy.el
index dd2605c..3302a8b 100644
--- a/style/amsbsy.el
+++ b/style/amsbsy.el
@@ -10,7 +10,8 @@
     (TeX-add-symbols
      '("boldsymbol" "Symbol")
      '("pmb"        "Symbol")
-     ))))
+     )))
+ LaTeX-dialect)
 
 (defvar LaTeX-amsbsy-package-options nil
   "Package options for the amsbsy package.")
diff --git a/style/amsmath.el b/style/amsmath.el
index ce732d5..0326561 100644
--- a/style/amsmath.el
+++ b/style/amsmath.el
@@ -157,7 +157,8 @@
 
     ;; If RefTeX is loaded, make it recognize the amsmath environments.
     (when (fboundp 'reftex-add-to-label-alist)
-      (reftex-add-to-label-alist '(AMSTeX))))))
+      (reftex-add-to-label-alist '(AMSTeX)))))
+ LaTeX-dialect)
 
 (defun LaTeX-amsmath-env-alignat (env)
   "Insert ENV with column number specifications.
diff --git a/style/amsopn.el b/style/amsopn.el
index 8843759..85e3f17 100644
--- a/style/amsopn.el
+++ b/style/amsopn.el
@@ -1,4 +1,4 @@
-;;; amsnopn.el --- AUCTeX style for the `amsnopn.sty' AMS-LaTeX package
+;;; amsopn.el --- AUCTeX style for the `amsnopn.sty' AMS-LaTeX package
 
 ;; Copyright (C) 1997, 2002, 2005, 2013 Free Software Foundation, Inc.
 
@@ -43,7 +43,9 @@
 
     (add-to-list 'LaTeX-auto-regexp-list
                 '("\\\\DeclareMathOperator\\*?{?\\\\\\([A-Za-z0-9]+\\)}?"
-                  1 TeX-auto-symbol)))))
+                  1 TeX-auto-symbol))))
+ LaTeX-dialect
+ )
 
 (defvar LaTeX-amsopn-package-options '("namelimits" "nonamelimits")
   "Package options for the amsopn package.")
diff --git a/style/amssymb.el b/style/amssymb.el
index 78ebd63..2aec6b6 100644
--- a/style/amssymb.el
+++ b/style/amssymb.el
@@ -240,7 +240,8 @@
     "varkappa"
     "Bbbk"
     "hslash"
-    "backepsilon")))
+    "backepsilon"))
+ LaTeX-dialect)
 
 (defvar LaTeX-amssymb-package-options '("psamsfonts")
   "Package options for the amssymb package.")
diff --git a/style/amstex.el b/style/amstex.el
index 347d72f..97a8b70 100644
--- a/style/amstex.el
+++ b/style/amstex.el
@@ -45,7 +45,8 @@
  (function
   (lambda ()
     (unless (memq major-mode '(plain-tex-mode ams-tex-mode))
-      (TeX-run-style-hooks "amsmath")))))
+      (TeX-run-style-hooks "amsmath"))))
+ LaTeX-dialect)
 
 (defvar LaTeX-amstex-package-options '("noamsfonts" "psamsfonts" 
                                       "intlimits" "nointlimits"
diff --git a/style/amstext.el b/style/amstext.el
index a9aa855..ea6f619 100644
--- a/style/amstext.el
+++ b/style/amstext.el
@@ -8,7 +8,8 @@
  (function
   (lambda ()
     (TeX-add-symbols
-     '("text" t)))))
+     '("text" t))))
+ LaTeX-dialect)
 
 (defvar LaTeX-amstext-package-option nil
   "Package options for the amstext package.")
diff --git a/style/amsthm.el b/style/amsthm.el
index 2214980..15cbf3a 100644
--- a/style/amsthm.el
+++ b/style/amsthm.el
@@ -59,7 +59,8 @@
      (font-latex-add-keywords '(("newtheorem" "*{[{[")
                                ("theoremstyle" "{")
                                ("newtheoremstyle" "{{{{{{{{{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defun LaTeX-amsthm-complete-theoremstyle (&rest ignore)
   (insert TeX-grop
diff --git a/style/array.el b/style/array.el
index 7775abb..51a27e8 100644
--- a/style/array.el
+++ b/style/array.el
@@ -43,7 +43,8 @@
    (LaTeX-add-lengths "extratabsurround" "extrarowheight")
 
    ;; `array.sty' adds some new column specification letters.
-   (set (make-local-variable 'LaTeX-array-column-letters) "clrpmb")))
+   (set (make-local-variable 'LaTeX-array-column-letters) "clrpmb"))
+ LaTeX-dialect)
 
 (defvar LaTeX-array-package-options nil
   "Package options for array.")
diff --git a/style/article.el b/style/article.el
index ca6281f..d4842f1 100644
--- a/style/article.el
+++ b/style/article.el
@@ -14,6 +14,7 @@
    (LaTeX-largest-level-set "section")
    (LaTeX-add-counters "part" "section" "subsection" "subsubsection" 
"paragraph"
                       "subparagraph" "figure" "table")
-   (LaTeX-add-pagestyles "headings" "myheadings")))
+   (LaTeX-add-pagestyles "headings" "myheadings"))
+ LaTeX-dialect)
 
 ;;; article.el ends here
diff --git a/style/austrian.el b/style/austrian.el
index 13f28a8..fce8906 100644
--- a/style/austrian.el
+++ b/style/austrian.el
@@ -34,6 +34,7 @@
 (TeX-add-style-hook
  "austrian"
  (lambda ()
-   (TeX-run-style-hooks "german")))
+   (TeX-run-style-hooks "german"))
+ LaTeX-dialect)
 
 ;;; austrian.el ends here
diff --git a/style/babel.el b/style/babel.el
index 36c93be..88b10b2 100644
--- a/style/babel.el
+++ b/style/babel.el
@@ -167,7 +167,8 @@
      (font-latex-add-keywords '(("defineshorthand" "{{")
                                ("aliasshorthand" "{{")
                                ("languageattribute" "{{"))
-                             'variable))))
+                             'variable)))
+ LaTeX-dialect)
 
 (defun LaTeX-babel-package-options ()
   "Prompt for package options for the babel package."
diff --git a/style/beamer.el b/style/beamer.el
index d79c0a4..c108f2b 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -187,7 +187,8 @@
      (font-latex-set-syntactic-keywords)
      ;; Tell font-lock about the update.
      (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults))))
+     (font-lock-set-defaults)))
+ LaTeX-dialect)
 
 (defun TeX-arg-beamer-overlay-spec (optional &optional prompt)
   "Prompt for overlay specification."
diff --git a/style/biblatex.el b/style/biblatex.el
index d5c3513..8a42a45 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -478,7 +478,8 @@ for citation keys."
     "NewBibliographyString")
    (LaTeX-declare-expert-environments
     "biblatex"
-    "refsection" "refsegment")))
+    "refsection" "refsegment"))
+ LaTeX-dialect)
 
 (defvar LaTeX-biblatex-package-options-list
   (append
diff --git a/style/bigdelim.el b/style/bigdelim.el
index 8d55c4a..085185b 100644
--- a/style/bigdelim.el
+++ b/style/bigdelim.el
@@ -37,7 +37,8 @@
     '("ldelim" TeX-arg-bigdelim-brace "Number of rows for multirow"
       "Width in multirow" [ "Text in multirow" ])
     '("rdelim" TeX-arg-bigdelim-brace "Number of rows for multirow"
-      "Width in multirow" [ "Text in multirow" ]))))
+      "Width in multirow" [ "Text in multirow" ])))
+ LaTeX-dialect)
 
 (defun TeX-arg-bigdelim-brace (optional &optional prompt)
   "Prompt for a single brace, and do not insert the matching
diff --git a/style/bigstrut.el b/style/bigstrut.el
index 0c9953e..14269db 100644
--- a/style/bigstrut.el
+++ b/style/bigstrut.el
@@ -34,7 +34,8 @@
  (lambda ()
    (TeX-add-symbols
     "bigstrutsetup"
-    '("bigstrut" [ TeX-arg-bigstrut ]))))
+    '("bigstrut" [ TeX-arg-bigstrut ])))
+ LaTeX-dialect)
 
 (defun TeX-arg-bigstrut (optional &optional prompt)
   "Prompt for the optional argument in \\bigstrut"
diff --git a/style/bm.el b/style/bm.el
index 565095c..d735e62 100644
--- a/style/bm.el
+++ b/style/bm.el
@@ -46,7 +46,8 @@
      (font-latex-add-keywords '(("DeclareBoldMathCommand" "[|{\\{")
                                ("bmdefine" "|{\\{")
                                ("hmdefine" "|{\\{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-bm-package-options nil
   "Package options for the bm package.")
diff --git a/style/book.el b/style/book.el
index e8e3f31..cbc9813 100644
--- a/style/book.el
+++ b/style/book.el
@@ -15,6 +15,7 @@
    (LaTeX-largest-level-set "chapter")
    (LaTeX-add-counters "part" "chapter" "section" "subsection" "subsubsection"
                       "paragraph" "subparagraph" "figure" "table")
-   (LaTeX-add-pagestyles "headings" "myheadings")))
+   (LaTeX-add-pagestyles "headings" "myheadings"))
+ LaTeX-dialect)
 
 ;;; book.el ends here
diff --git a/style/booktabs.el b/style/booktabs.el
index ee19459..20145af 100644
--- a/style/booktabs.el
+++ b/style/booktabs.el
@@ -70,7 +70,8 @@ PROMPT is the value of the prompt to be shown."
                                ("addlinespace" "[")
                                ("morecmidrules" "")
                                ("specialrule" "{{{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-booktabs-package-options nil
   "Package options for the booktabs package.")
diff --git a/style/bulgarian.el b/style/bulgarian.el
index 77cb2b2..1f4103c 100644
--- a/style/bulgarian.el
+++ b/style/bulgarian.el
@@ -49,6 +49,7 @@
    (when (fboundp 'font-latex-add-quotes)
      (font-latex-add-quotes '("\"`" "\"'"))
      (font-latex-add-quotes '("\"<" "\">" french)))
-   (run-hooks 'TeX-language-bg-hook)))
+   (run-hooks 'TeX-language-bg-hook))
+ LaTeX-dialect)
 
 ;;; bulgarian.el ends here
diff --git a/style/captcont.el b/style/captcont.el
index ffa48bf..b2f4b5f 100644
--- a/style/captcont.el
+++ b/style/captcont.el
@@ -37,7 +37,8 @@
     '("captcont*" [ "list entry" ] "Caption"))
    ;; Fontification
    (when (featurep 'font-latex)
-     (font-latex-add-keywords '(("captcont" "*[{")) 'textual))))
+     (font-latex-add-keywords '(("captcont" "*[{")) 'textual)))
+ LaTeX-dialect)
 
 (defvar LaTeX-captcont-package-options '("figbotcap" "figtopcap" "tabbotcap"
                                         "tabtopcap")
diff --git a/style/comment.el b/style/comment.el
index c842d20..ac33ebd 100644
--- a/style/comment.el
+++ b/style/comment.el
@@ -64,6 +64,7 @@
                              'variable)
      ;; Tell font-lock about the update.
      (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults))))
+     (font-lock-set-defaults)))
+ LaTeX-dialect)
 
 ;;; comment.el ends here
diff --git a/style/csquotes.el b/style/csquotes.el
index 50aa1f9..fd112f8 100644
--- a/style/csquotes.el
+++ b/style/csquotes.el
@@ -240,6 +240,7 @@ the insertion of optional arguments."
                                ("SetBlockThreshold" "{")
                                ("SetBlockEnvironment" "{")
                                ("SetCiteCommand" "{"))
-                             'variable)))))
+                             'variable))))
+ LaTeX-dialect)
 
 ;;; csquotes.el ends here
diff --git a/style/czech.el b/style/czech.el
index 6168189..7d709ed 100644
--- a/style/czech.el
+++ b/style/czech.el
@@ -5,4 +5,5 @@
  (lambda ()
    (unless (eq (car TeX-quote-language) 'override)
      (setq TeX-quote-language `("czech" "\\uv{" "}" ,TeX-quote-after-quote)))
-   (run-hooks 'TeX-language-cz-hook)))
+   (run-hooks 'TeX-language-cz-hook))
+ LaTeX-dialect)
diff --git a/style/danish.el b/style/danish.el
index 775fee0..fa9ab6f 100644
--- a/style/danish.el
+++ b/style/danish.el
@@ -12,6 +12,7 @@
    (when (fboundp 'font-latex-add-quotes)
      (font-latex-add-quotes '("\"`" "\"'"))
      (font-latex-add-quotes '("\">" "\"<" german)))
-   (run-hooks 'TeX-language-dk-hook)))
+   (run-hooks 'TeX-language-dk-hook))
+ LaTeX-dialect)
 
 ;;; danish.el ends here
diff --git a/style/dinbrief.el b/style/dinbrief.el
index 8a20519..cb9fb6b 100644
--- a/style/dinbrief.el
+++ b/style/dinbrief.el
@@ -60,7 +60,8 @@
      '("backaddress" "Retouradresse: ")
      '("signature" "Unterschrift: ")
      '("opening" "Anrede: ")
-     '("closing" "Schluss: ")))))
+     '("closing" "Schluss: "))))
+ LaTeX-dialect)
 
 (defmacro LaTeX-dinbrief-insert (&rest args)
   "Insert text ignoring active markers."
diff --git a/style/dk.el b/style/dk.el
index a508d8d..01a7411 100644
--- a/style/dk.el
+++ b/style/dk.el
@@ -4,6 +4,7 @@
 
 (TeX-add-style-hook "dk"
  (function (lambda ()
-   (run-hooks 'TeX-language-dk-hook))))
+            (run-hooks 'TeX-language-dk-hook)))
+ LaTeX-dialect)
 
 ;;; dk.el ends here
diff --git a/style/doc.el b/style/doc.el
index e45f0f7..3176368 100644
--- a/style/doc.el
+++ b/style/doc.el
@@ -151,7 +151,8 @@
     "GetFileInfo"
     "filename"
     "fileinfo")
-   (TeX-run-style-hooks "shortvrb")))
+   (TeX-run-style-hooks "shortvrb"))
+ LaTeX-dialect)
 
 ;; Local Variables:
 ;; coding: iso-8859-1
diff --git a/style/dutch.el b/style/dutch.el
index 3e7c1ec..c2c56a5 100644
--- a/style/dutch.el
+++ b/style/dutch.el
@@ -4,6 +4,7 @@
 
 (TeX-add-style-hook "dutch"
  (function (lambda ()
-   (run-hooks 'TeX-language-nl-hook))))
+            (run-hooks 'TeX-language-nl-hook)))
+ LaTeX-dialect)
 
 ;;; dutch.el ends here
diff --git a/style/emp.el b/style/emp.el
index 4e5f867..16400ee 100644
--- a/style/emp.el
+++ b/style/emp.el
@@ -38,7 +38,8 @@
      '("empdef" LaTeX-env-emp-gen)
      '("empgraph" LaTeX-env-emp-gen)
      '("empcmds")
-     ))))
+     )))
+ LaTeX-dialect)
 
 (defun LaTeX-env-emp-gen (environment-name)
    "Ask for file, width and length. Insert environment-name environment
diff --git a/style/english.el b/style/english.el
index f385a24..90254c2 100644
--- a/style/english.el
+++ b/style/english.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook
  "english"
  (lambda ()
-   (run-hooks 'TeX-language-en-hook)))
+   (run-hooks 'TeX-language-en-hook))
+ LaTeX-dialect)
 
 ;;; english.el ends here
diff --git a/style/epigraph.el b/style/epigraph.el
index 942daf5..c25b148 100644
--- a/style/epigraph.el
+++ b/style/epigraph.el
@@ -60,7 +60,8 @@
                                ("qitem" "{{")
                                ("dropchapter" "{")
                                ("epigraphhead" "{")) 'function)
-     (font-latex-add-keywords '("cleartoevenpage") 'warning))))
+     (font-latex-add-keywords '("cleartoevenpage") 'warning)))
+ LaTeX-dialect)
 
 (defvar LaTeX-epigraph-package-options nil
   "Package options for the epigraph package.")
diff --git a/style/epsf.el b/style/epsf.el
index f8b2c9f..797f801 100644
--- a/style/epsf.el
+++ b/style/epsf.el
@@ -14,7 +14,8 @@
     "epsflly" "epsfury" "testit" "epsfgetlitbb"
     "epsfnormal" "epsfgetbb" "other" "epsfsetgraph"
     "PsFragSpecialArgs" "epsfaux" "testit" "epsfgrab"
-    "epsfllx" "epsflly" "epsfury" "epsfverbosetrue")))
+    "epsfllx" "epsflly" "epsfury" "epsfverbosetrue"))
+ LaTeX-dialect)
 
 (defun TeX-arg-epsfsize (optional &optional prompt definition)
   "Create a line that print epsf figures at a certain percentage"
diff --git a/style/everysel.el b/style/everysel.el
index cd69322..da6101d 100644
--- a/style/everysel.el
+++ b/style/everysel.el
@@ -36,7 +36,8 @@
     ;; adds a hook (the argument code) to be called after \\selectfont
     '("EverySelectfont" 1)
     ;; adds a hook to be called after the next \\selectfont
-    '("AtNextSelectont" 1))))
+    '("AtNextSelectont" 1)))
+ LaTeX-dialect)
 
 (defvar LaTeX-everysel-package-options nil
   "Package options for the everysel package.")
diff --git a/style/exercise.el b/style/exercise.el
index 6dfb179..5fe3092 100644
--- a/style/exercise.el
+++ b/style/exercise.el
@@ -54,7 +54,8 @@
     '("DifficultyMarker")
     '("listofexercises")
     '("ListOfExerciseInToc")
-    '("ExerciseLevelInToc"))))
+    '("ExerciseLevelInToc")))
+ LaTeX-dialect)
 
 (defvar LaTeX-exercise-package-options '("noexercise" "noanswer" 
"exerciseonly" "answeronly" "nothing" "answerdelayed" "exercisedelayed" 
"lastexercise")
   "Package options for the exercise package.")
diff --git a/style/fancyhdr.el b/style/fancyhdr.el
index 3d777b6..76f33c7 100644
--- a/style/fancyhdr.el
+++ b/style/fancyhdr.el
@@ -82,7 +82,8 @@
                                 ("plainfootrulewidth" "")) 'variable)
      ;; Tell font-lock about the update.
      (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults))))
+     (font-lock-set-defaults)))
+ LaTeX-dialect)
 
 ;; Because there can be many positions, `TeX-completing-read-multiple' is used
 ;; instead of just `completing-read', and a `collection' argument is provided 
as
diff --git a/style/fancynum.el b/style/fancynum.el
index 967b9c2..a04be76 100644
--- a/style/fancynum.el
+++ b/style/fancynum.el
@@ -36,7 +36,8 @@
     '("fnum" t)
     '("setfnumdsym" t)
     '("setfnummsym" t)
-    '("setfnumgsym" t))))
+    '("setfnumgsym" t)))
+ LaTeX-dialect)
 
 (defvar LaTeX-fancynum-package-options
   '("english" "french" "tight" "loose" "commas" "thinspaces" "plain")
diff --git a/style/fancyref.el b/style/fancyref.el
index 2aa9c8c..9d870e7 100644
--- a/style/fancyref.el
+++ b/style/fancyref.el
@@ -92,7 +92,8 @@
      ;; Fontification
      (when (and (featurep 'font-latex)
                (eq TeX-install-font-lock 'font-latex-setup))
-       (font-latex-add-keywords '(("fref" "[{") ("Fref" "[{")) 'reference))))
+       (font-latex-add-keywords '(("fref" "[{") ("Fref" "[{")) 'reference)))
+   LaTeX-dialect)
 
 ;; The following list keeps a list of available format names
 ;; Note that this list is only updated when a format is used, not
diff --git a/style/fancyvrb.el b/style/fancyvrb.el
index 3723ea8..92718b4 100644
--- a/style/fancyvrb.el
+++ b/style/fancyvrb.el
@@ -197,7 +197,8 @@
      (font-latex-set-syntactic-keywords)
      ;; Tell font-lock about the update.
      (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults))))
+     (font-lock-set-defaults)))
+ LaTeX-dialect)
 
 (defvar LaTeX-fancyvrb-package-options nil
   "Package options for the fancyvrb package.")
diff --git a/style/filecontents.el b/style/filecontents.el
index 776c768..ea3c60a 100644
--- a/style/filecontents.el
+++ b/style/filecontents.el
@@ -38,7 +38,8 @@
  (lambda ()
    (LaTeX-add-environments
     '("filecontents" LaTeX-env-filecontents)
-    '("filecontents*" LaTeX-env-filecontents))))
+    '("filecontents*" LaTeX-env-filecontents)))
+ LaTeX-dialect)
 
 (defun LaTeX-env-filecontents (environment)
   "Insert ENVIRONMENT with filename for contents."
diff --git a/style/flashcards.el b/style/flashcards.el
index 27e96d1..6f26c15 100644
--- a/style/flashcards.el
+++ b/style/flashcards.el
@@ -55,6 +55,7 @@
                                ("cardbackstyle" "[{")
                                ("cardfrontheadstyle" "[{")
                                ("cardfrontfootstyle" "[{"))
-                             'variable))))
+                             'variable)))
+ LaTeX-dialect)
 
 ;;; flashcards.el ends here
diff --git a/style/foils.el b/style/foils.el
index f4e7e77..e3fedd8 100644
--- a/style/foils.el
+++ b/style/foils.el
@@ -11,7 +11,8 @@
     (setq LaTeX-default-style "foils")
     (setq LaTeX-default-options '("landscape"))
     (TeX-add-symbols
-     '("foilhead" [ "Rubric-body separation" ] "Foil rubric")))))
+     '("foilhead" [ "Rubric-body separation" ] "Foil rubric"))))
+ LaTeX-dialect)
 
 (defun LaTeX-style-foils nil
   "Prompt for and insert foiltex options."
diff --git a/style/fontspec.el b/style/fontspec.el
index f9137fb..c483d0a 100644
--- a/style/fontspec.el
+++ b/style/fontspec.el
@@ -225,7 +225,8 @@ to retrieve the list of fonts."
                                ("addfontfeature" "{")
                                ("newfontscript" "{{")
                                ("newfontlanguage" "{{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-fontspec-package-options
   '("math" "no-math" "config" "no-config" "quiet" "silent")
diff --git a/style/footmisc.el b/style/footmisc.el
index 2efe526..dec612e 100644
--- a/style/footmisc.el
+++ b/style/footmisc.el
@@ -60,7 +60,8 @@
                                 ("DefineFNsymbolsTM" "{{")
                                 ("DefineFNsymbolsTM*" "{{")
                                ("setfnsymbol" "{")) 'function)
-     (font-latex-add-keywords '(("footnoteref")) 'reference))))
+     (font-latex-add-keywords '(("footnoteref")) 'reference)))
+ LaTeX-dialect)
 
 (defvar LaTeX-footmisc-package-options '("perpage" "side" "ragged"
                                          "para" "symbol" "symbol*"
diff --git a/style/francais.el b/style/francais.el
index 323d545..1723b59 100644
--- a/style/francais.el
+++ b/style/francais.el
@@ -36,6 +36,7 @@
 (TeX-add-style-hook
  "francais"
  (lambda ()
-   (TeX-run-style-hooks "frenchb")))
+   (TeX-run-style-hooks "frenchb"))
+ LaTeX-dialect)
 
 ;;; francais.el ends here
diff --git a/style/french.el b/style/french.el
index 31a468a..7aefe3d 100644
--- a/style/french.el
+++ b/style/french.el
@@ -43,6 +43,7 @@
              (not (member "frenchpro" TeX-active-styles))
              (not (member "frenchle" TeX-active-styles))
              (not (member "mlp" TeX-active-styles)))
-     (TeX-run-style-hooks "frenchb"))))
+     (TeX-run-style-hooks "frenchb")))
+ LaTeX-dialect)
 
 ;;; french.el ends here
diff --git a/style/frenchb.el b/style/frenchb.el
index 83f9002..71ef1f4 100644
--- a/style/frenchb.el
+++ b/style/frenchb.el
@@ -73,6 +73,7 @@
               (concat "\\fg"
                       (unless (member "xspace" TeX-active-styles) "{}")))
             ,TeX-quote-after-quote)))
-   (run-hooks 'TeX-language-fr-hook)))
+   (run-hooks 'TeX-language-fr-hook))
+ LaTeX-dialect)
 
 ;;; frenchb.el ends here
diff --git a/style/german.el b/style/german.el
index d1acbbf..51a35fe 100644
--- a/style/german.el
+++ b/style/german.el
@@ -44,6 +44,7 @@
      (font-latex-add-quotes '("\">" "\"<" german))
      ;; Prevent "| from leading to color bleed.
      (font-latex-add-to-syntax-alist (list (cons ?\" "\\"))))
-   (run-hooks 'TeX-language-de-hook)))
+   (run-hooks 'TeX-language-de-hook))
+ LaTeX-dialect)
 
 ;;; german.el ends here
diff --git a/style/graphics.el b/style/graphics.el
index bffabc9..ffe5bd1 100644
--- a/style/graphics.el
+++ b/style/graphics.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook "graphics"
  (function
   (lambda ()
-    (TeX-run-style-hooks "graphicx"))))
+    (TeX-run-style-hooks "graphicx")))
+ LaTeX-dialect)
 
 ;;; graphics.el ends here.
diff --git a/style/graphicx.el b/style/graphicx.el
index a35d151..a06aabf 100644
--- a/style/graphicx.el
+++ b/style/graphicx.el
@@ -50,7 +50,8 @@
                                ("rotatebox" "[{{")
                                ("scalebox" "{[{"))
                              'textual)
-     (font-latex-add-keywords '(("includegraphics" "*[[{")) 'reference))))
+     (font-latex-add-keywords '(("includegraphics" "*[[{")) 'reference)))
+ LaTeX-dialect)
 
 (defun LaTeX-includegraphics-extensions (&optional list)
   "Return appropriate extensions for input files to \\includegraphics."
diff --git a/style/harvard.el b/style/harvard.el
index b1f12bc..d0a37cb 100644
--- a/style/harvard.el
+++ b/style/harvard.el
@@ -104,7 +104,8 @@
 
     ;; Tell RefTeX
     (when (fboundp 'reftex-set-cite-format)
-      (reftex-set-cite-format 'harvard)))))
+      (reftex-set-cite-format 'harvard))))
+ LaTeX-dialect)
 
 (defun LaTeX-env-harvardbib (environment &optional ignore)
   "Insert ENVIRONMENT with label for harvarditem."
diff --git a/style/hyperref.el b/style/hyperref.el
index bfd47a4..ad1c628 100644
--- a/style/hyperref.el
+++ b/style/hyperref.el
@@ -226,7 +226,8 @@
 
    ;; RefTeX
    (when (fboundp 'reftex-ref-style-activate)
-     (reftex-ref-style-activate "Hyperref"))))
+     (reftex-ref-style-activate "Hyperref")))
+ LaTeX-dialect)
 
 (defun LaTeX-hyperref-package-options ()
   "Read the hyperref package options from the user."
diff --git a/style/icelandic.el b/style/icelandic.el
index f7750dd..427a88d 100644
--- a/style/icelandic.el
+++ b/style/icelandic.el
@@ -48,6 +48,7 @@
    (when (fboundp 'font-latex-add-quotes)
      (font-latex-add-quotes '("\"`" "\"'"))
      (font-latex-add-quotes '("\"<" "\">" french)))
-   (run-hooks 'TeX-language-is-hook)))
+   (run-hooks 'TeX-language-is-hook))
+ LaTeX-dialect)
 
 ;;; icelandic.el ends here
diff --git a/style/imakeidx.el b/style/imakeidx.el
index f82d335..d361cbd 100644
--- a/style/imakeidx.el
+++ b/style/imakeidx.el
@@ -89,7 +89,8 @@
          '(("|see{\\([^{}\n\r]*\\)" 1 LaTeX-index-entry-list))
          TeX-complete-list))
    (and (fboundp 'reftex-add-index-macros)
-       (reftex-add-index-macros '(default)))))
+       (reftex-add-index-macros '(default))))
+ LaTeX-dialect)
 
 (defvar LaTeX-imakeidx-package-options
   '("makeindex" "xindy" "texindy" "truexindy" "noautomatic" "nonewpage" "quiet"
diff --git a/style/index.el b/style/index.el
index f14630b..66e52da 100644
--- a/style/index.el
+++ b/style/index.el
@@ -75,7 +75,8 @@
 
     ;; RefTeX support
     (and (fboundp 'reftex-add-index-macros)
-        (reftex-add-index-macros '(index)))))
+        (reftex-add-index-macros '(index))))
+  LaTeX-dialect)
 
 (defvar LaTeX-index-package-options nil
   "Package options for the index package.")
diff --git a/style/inputenc.el b/style/inputenc.el
index 8b7be5c..7d00ca7 100644
--- a/style/inputenc.el
+++ b/style/inputenc.el
@@ -77,7 +77,8 @@
  (lambda ()
    ;; New symbols
    (TeX-add-symbols
-    '("inputencoding" LaTeX-arg-inputenc-inputenc))))
+    '("inputencoding" LaTeX-arg-inputenc-inputenc)))
+ LaTeX-dialect)
 
 ;; Local Variables:
 ;; coding: iso-8859-1
diff --git a/style/italian.el b/style/italian.el
index 4578f6f..a7fa3d9 100644
--- a/style/italian.el
+++ b/style/italian.el
@@ -54,6 +54,7 @@
    ;; Fontification of quotation marks.
    (when (fboundp 'font-latex-add-quotes)
      (font-latex-add-quotes '("\"<" "\">" french)))
-   (run-hooks 'TeX-language-it-hook)))
+   (run-hooks 'TeX-language-it-hook))
+ LaTeX-dialect)
 
 ;;; italian.el ends here
diff --git a/style/j-article.el b/style/j-article.el
index bf0b790..5a26de5 100644
--- a/style/j-article.el
+++ b/style/j-article.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook
  "j-article"
  (lambda ()
-   (LaTeX-largest-level-set "section")))
+   (LaTeX-largest-level-set "section"))
+ LaTeX-dialect)
 
 ;;; j-article.el ends here
diff --git a/style/j-book.el b/style/j-book.el
index 82db61e..932fe45 100644
--- a/style/j-book.el
+++ b/style/j-book.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook
  "j-book"
  (lambda ()
-   (LaTeX-largest-level-set "chapter")))
+   (LaTeX-largest-level-set "chapter"))
+ LaTeX-dialect)
 
 ;;; j-book.el ends here
diff --git a/style/j-report.el b/style/j-report.el
index a70da4f..07dfcb5 100644
--- a/style/j-report.el
+++ b/style/j-report.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook
  "j-report"
  (lambda ()
-   (LaTeX-largest-level-set "chapter")))
+   (LaTeX-largest-level-set "chapter"))
+ LaTeX-dialect)
 
 ;;; j-report.el ends here
diff --git a/style/jarticle.el b/style/jarticle.el
index 98d3ae0..5d38668 100644
--- a/style/jarticle.el
+++ b/style/jarticle.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook
  "jarticle"
  (lambda ()
-   (LaTeX-largest-level-set "section")))
+   (LaTeX-largest-level-set "section"))
+ LaTeX-dialect)
 
 ;;; jarticle.el ends here
diff --git a/style/jbook.el b/style/jbook.el
index 0200200..beb8748 100644
--- a/style/jbook.el
+++ b/style/jbook.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook
  "jbook"
  (lambda ()
-   (LaTeX-largest-level-set "chapter")))
+   (LaTeX-largest-level-set "chapter"))
+ LaTeX-dialect)
 
 ;;; jbook.el ends here
diff --git a/style/jreport.el b/style/jreport.el
index 8bf93cf..751ecc1 100644
--- a/style/jreport.el
+++ b/style/jreport.el
@@ -5,7 +5,8 @@
 (TeX-add-style-hook
  "jreport"
  (lambda ()
-   (LaTeX-largest-level-set "chapter")))
+   (LaTeX-largest-level-set "chapter"))
+ LaTeX-dialect)
 
 
 ;;; jreport.el ends here
diff --git a/style/jsarticle.el b/style/jsarticle.el
index 2c8755d..9e50fbb 100644
--- a/style/jsarticle.el
+++ b/style/jsarticle.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook
  "jsarticle"
  (lambda ()
-   (LaTeX-largest-level-set "section")))
+   (LaTeX-largest-level-set "section"))
+ LaTeX-dialect)
 
 ;;; jsarticle.el ends here
diff --git a/style/jsbook.el b/style/jsbook.el
index 0505861..fae2713 100644
--- a/style/jsbook.el
+++ b/style/jsbook.el
@@ -5,6 +5,7 @@
 (TeX-add-style-hook
  "jsbook"
  (lambda () 
-   (LaTeX-largest-level-set "chapter")))
+   (LaTeX-largest-level-set "chapter"))
+ LaTeX-dialect)
 
 ;;; jsbook.el ends here
diff --git a/style/jura.el b/style/jura.el
index 2f149c4..4baac97 100644
--- a/style/jura.el
+++ b/style/jura.el
@@ -32,7 +32,8 @@
 (TeX-add-style-hook
  "jura"
  (lambda ()
-   (TeX-run-style-hooks "alphanum")))
+   (TeX-run-style-hooks "alphanum"))
+ LaTeX-dialect)
 
 ;; Local Variables:
 ;; coding: iso-8859-1
diff --git a/style/jurabib.el b/style/jurabib.el
index c48e383..1919c06 100644
--- a/style/jurabib.el
+++ b/style/jurabib.el
@@ -629,6 +629,7 @@
     "urldatecomment"
     "volname"
     "volumename"
-    "volumeofname")))
+    "volumeofname"))
+ LaTeX-dialect)
 
 ;;; jurabib.el ends here
diff --git a/style/kantlipsum.el b/style/kantlipsum.el
index 395fceb..cdf510f 100644
--- a/style/kantlipsum.el
+++ b/style/kantlipsum.el
@@ -36,7 +36,8 @@
     '("kant" [ "Range of paragraph (max: 164)" ])
     '("kant*" [ "Range of paragraph (max: 164)" ])
     '("kantdef" TeX-arg-define-macro "Paragraph number"))
-   (TeX-run-style-hooks "xparse")))
+   (TeX-run-style-hooks "xparse"))
+ LaTeX-dialect)
 
 (defvar LaTeX-kantlipsum-package-options
   '("par" "nopar" "numbers" "index")
diff --git a/style/kpfonts.el b/style/kpfonts.el
index a93ba36..026c81f 100644
--- a/style/kpfonts.el
+++ b/style/kpfonts.el
@@ -570,7 +570,8 @@ following commands are defined:
                              'bold-declaration)
      (font-latex-add-keywords '(("scslshape")
                                ("otherscslshape"))
-                             'italic-declaration))))
+                             'italic-declaration)))
+ LaTeX-dialect)
 
 (defvar LaTeX-kpfonts-package-options
   '(;; Main global options
diff --git a/style/latexinfo.el b/style/latexinfo.el
index 18e8965..be64bca 100644
--- a/style/latexinfo.el
+++ b/style/latexinfo.el
@@ -175,6 +175,7 @@ This fails when the user types in the label of something 
else"
 
     ;; need the following stuff to let xref and pxref work
     (make-local-variable 'LaTeX-section-label)
-    (setq LaTeX-section-label ""))))
+    (setq LaTeX-section-label "")))
+ LaTeX-dialect)
 
 ;;; latexinfo.el ends here
diff --git a/style/letter.el b/style/letter.el
index a5bbc71..d02f8f4 100644
--- a/style/letter.el
+++ b/style/letter.el
@@ -80,7 +80,8 @@
                                ("cc" "{")
                                ("encl" "{")
                                ("ps" "{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defun LaTeX-env-recipient (environment)
   "Insert ENVIRONMENT and prompt for recipient and address."
diff --git a/style/lettrine.el b/style/lettrine.el
index f595c43..ed32a70 100644
--- a/style/lettrine.el
+++ b/style/lettrine.el
@@ -66,7 +66,8 @@
    ;; Fontification
    (when (and (fboundp 'font-latex-add-keywords)
               (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("lettrine" "[{{")) 'textual))))
+     (font-latex-add-keywords '(("lettrine" "[{{")) 'textual)))
+ LaTeX-dialect)
 
 (defvar LaTeX-lettrine-package-options nil
   "Package options for the lettrine package.")
diff --git a/style/lipsum.el b/style/lipsum.el
index a0c0c04..e198480 100644
--- a/style/lipsum.el
+++ b/style/lipsum.el
@@ -36,7 +36,8 @@
     '("lipsum" [ "Range of paragraph (max: 150)" ])
     '("lipsum*" [ "Range of paragraph (max: 150)" ])
     '("setlipsumdefault" [ "Default range of paragraph (max: 150)" ])
-    '("ChangeLipsumPar" 0))))
+    '("ChangeLipsumPar" 0)))
+ LaTeX-dialect)
 
 (defvar LaTeX-lipsum-package-options
   '("nopar")
diff --git a/style/listings.el b/style/listings.el
index 82ebd71..534de62 100644
--- a/style/listings.el
+++ b/style/listings.el
@@ -271,7 +271,8 @@
      (font-latex-set-syntactic-keywords)
      ;; Tell font-lock about the update.
      (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults))))
+     (font-lock-set-defaults)))
+ LaTeX-dialect)
 
 (defvar LaTeX-listings-package-options '("draft" "final" "savemem" 
                                         "noaspects"
diff --git a/style/longtable.el b/style/longtable.el
index 7b5ae00..c0c7cf4 100644
--- a/style/longtable.el
+++ b/style/longtable.el
@@ -88,6 +88,7 @@
      ;; argument, not an optional one, the following is a workaround
      ;; to fontify correctly also the standard `\caption[]{}' macro.
      (font-latex-add-keywords '(("caption" "*[{"))
-                             'textual))))
+                             'textual)))
+ LaTeX-dialect)
 
 ;; longtable.el ends here
diff --git a/style/lscape.el b/style/lscape.el
index 44992df..8079c63 100644
--- a/style/lscape.el
+++ b/style/lscape.el
@@ -36,7 +36,8 @@
    (LaTeX-add-environments
     "landscape")
    ;; lscape uses graphics internally to handle the work
-   (TeX-run-style-hooks "graphics")))
+   (TeX-run-style-hooks "graphics"))
+ LaTeX-dialect)
 
 (defvar LaTeX-lscape-package-options '("pdftex")
   "Package options for the lscape package.")
diff --git a/style/ltx-base.el b/style/ltx-base.el
index 27034a2..a586a7a 100644
--- a/style/ltx-base.el
+++ b/style/ltx-base.el
@@ -79,7 +79,8 @@
      '("message" "Log Message")
      '("@ifundefined" "Macro Name" 2)
      '("@ifnextchar" (TeX-arg-literal " ") (TeX-arg-free "character") 2 )
-     "expandafter"))))
+     "expandafter")))
+ LaTeX-dialect)
 
 ;; Local Variables:
 ;; coding: iso-8859-1
diff --git a/style/ltxdoc.el b/style/ltxdoc.el
index 113e0df..7edf178 100644
--- a/style/ltxdoc.el
+++ b/style/ltxdoc.el
@@ -33,7 +33,8 @@
  "ltxdoc"
  (lambda ()
    (TeX-run-style-hooks "doc")
-   (TeX-run-style-hooks "ltx-base")))
+   (TeX-run-style-hooks "ltx-base"))
+ LaTeX-dialect)
 
 ;; Local Variables:
 ;; coding: iso-8859-1
diff --git a/style/luacode.el b/style/luacode.el
index a43c1d9..9d29c64 100644
--- a/style/luacode.el
+++ b/style/luacode.el
@@ -54,7 +54,8 @@
                                ("luastringO" "{")
                                ("LuaCodeDebugOn")
                                ("LuaCodeDebugOff"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-luacode-package-options nil
   "Package options for the luacode package.")
diff --git a/style/makeidx.el b/style/makeidx.el
index 3425e49..b80ee47 100644
--- a/style/makeidx.el
+++ b/style/makeidx.el
@@ -40,7 +40,8 @@
 
     ;; RefTeX support
     (and (fboundp 'reftex-add-index-macros)
-        (reftex-add-index-macros '(default)))))
+        (reftex-add-index-macros '(default))))
+  LaTeX-dialect)
 
 (defvar LaTeX-makeidx-package-options nil
   "Package options for the makeidx package.")
diff --git a/style/mathtools.el b/style/mathtools.el
index e550403..ab4065b 100644
--- a/style/mathtools.el
+++ b/style/mathtools.el
@@ -166,7 +166,8 @@
         (append '(("lgathered"    . LaTeX-amsmath-label)
                   ("rgathered"   . LaTeX-amsmath-label)
                   ("multlined"    . LaTeX-amsmath-label)
-                  LaTeX-label-alist)))))
+                  LaTeX-label-alist))))
+ LaTeX-dialect)
 
 (defun LaTeX-mathtools-env-matrix-starred (env)
   (let ((where (read-string "(optional) Vertical placement of columns: ")))
diff --git a/style/mdwlist.el b/style/mdwlist.el
index 2e2634d..af6c9b9 100644
--- a/style/mdwlist.el
+++ b/style/mdwlist.el
@@ -55,7 +55,8 @@
      (font-latex-add-keywords '(("makecompactlist" "{{")
                                ("suspend" "[{")
                                ("resume" "[{["))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-mdwlist-package-options nil
   "Package options for the mdwlist package.")
diff --git a/style/memoir.el b/style/memoir.el
index fa4c593..68b74dc 100644
--- a/style/memoir.el
+++ b/style/memoir.el
@@ -77,6 +77,7 @@
     "tabularx" "titleref" "titling" "tocbibind" "tocloft"
     "verbatim" "verse")
 
-   (LaTeX-largest-level-set "chapter")))
+   (LaTeX-largest-level-set "chapter"))
+ LaTeX-dialect)
 
 ;;; memoir.el ends here
diff --git a/style/metalogo.el b/style/metalogo.el
index 1cec81e..055347e 100644
--- a/style/metalogo.el
+++ b/style/metalogo.el
@@ -76,7 +76,8 @@
                                ("setLaTeXee" "{")
                                ("seteverylogo" "{")
                                ("everylogo" "{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-metalogo-package-options nil
   "Package options for the metalogo package.")
diff --git a/style/mflogo.el b/style/mflogo.el
index 6cda90e..957e86d 100644
--- a/style/mflogo.el
+++ b/style/mflogo.el
@@ -40,7 +40,8 @@
              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("logofamily" "{")
                                ("textlogo" "{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-mflogo-package-options nil
   "Package options for the mflogo package.")
diff --git a/style/multicol.el b/style/multicol.el
index 5d73221..f57f609 100644
--- a/style/multicol.el
+++ b/style/multicol.el
@@ -53,7 +53,8 @@
     '("columnseprulecolor" 0)
     '("raggedcolumns" 0)
     '("flushcolumns" 0)
-    "columnbreak")))
+    "columnbreak"))
+ LaTeX-dialect)
 
 (defvar LaTeX-multicol-package-options
   '("errorshow" "infoshow" "balancingshow" "markshow" "debugshow" "grid")
diff --git a/style/multido.el b/style/multido.el
index 786185e..c9c3a6a 100644
--- a/style/multido.el
+++ b/style/multido.el
@@ -47,6 +47,7 @@
      "multidostop"
      "multidocount"
      '("fpAdd" "Summand 1" "Summand 2" "Register")
-     '("fpSub" "Minuend" "Subtrahend" "Register")))))
+     '("fpSub" "Minuend" "Subtrahend" "Register"))))
+ LaTeX-dialect)
 
 ;;; multido.el ends here
diff --git a/style/multind.el b/style/multind.el
index 45c710b..76eabfe 100644
--- a/style/multind.el
+++ b/style/multind.el
@@ -53,7 +53,8 @@
 
     ;; RefTeX support
     (and (fboundp 'reftex-add-index-macros)
-        (reftex-add-index-macros '(multind)))))
+        (reftex-add-index-macros '(multind))))
+  LaTeX-dialect)
 
 (defvar LaTeX-multind-package-options nil
   "Package options for the multind package.")
diff --git a/style/multirow.el b/style/multirow.el
index abe1fa6..6d00d5e 100644
--- a/style/multirow.el
+++ b/style/multirow.el
@@ -43,7 +43,8 @@
    ;; Fontification
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("multirow" "{[{")) 'function))))
+     (font-latex-add-keywords '(("multirow" "{[{")) 'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-multirow-package-options nil
   "Package options for the multirow package.")
diff --git a/style/nameref.el b/style/nameref.el
index 8744bef..d09ddbe 100644
--- a/style/nameref.el
+++ b/style/nameref.el
@@ -43,7 +43,8 @@
    (when (and (fboundp 'font-latex-add-keywords)
              (fboundp 'font-latex-set-syntactic-keywords)
              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("nameref" "{")) 'reference))))
+     (font-latex-add-keywords '(("nameref" "{")) 'reference)))
+ LaTeX-dialect)
 
 (defvar LaTeX-nameref-package-options nil
   "Package options for nameref.")
diff --git a/style/natbib.el b/style/natbib.el
index bf9971e..522656c 100644
--- a/style/natbib.el
+++ b/style/natbib.el
@@ -105,7 +105,8 @@
 
     ;; Tell RefTeX
     (if (fboundp 'reftex-set-cite-format)
-       (reftex-set-cite-format 'natbib)))))
+       (reftex-set-cite-format 'natbib))))
+ LaTeX-dialect)
 
 (defun natbib-note-args (optional &optional prompt definition)
   "Prompt for two note arguments a natbib citation command."
diff --git a/style/naustrian.el b/style/naustrian.el
index 0eb1294..99a7e30 100644
--- a/style/naustrian.el
+++ b/style/naustrian.el
@@ -34,6 +34,7 @@
 (TeX-add-style-hook
  "naustrian"
  (lambda ()
-   (TeX-run-style-hooks "ngerman")))
+   (TeX-run-style-hooks "ngerman"))
+ LaTeX-dialect)
 
 ;;; naustrian.el ends here
diff --git a/style/ngerman.el b/style/ngerman.el
index 8acd2f5..9c49ee6 100644
--- a/style/ngerman.el
+++ b/style/ngerman.el
@@ -44,6 +44,7 @@
      (font-latex-add-quotes '("\">" "\"<" german))
      ;; Prevent "| from leading to color bleed.
      (font-latex-add-to-syntax-alist (list (cons ?\" "\\"))))
-   (run-hooks 'TeX-language-de-hook)))
+   (run-hooks 'TeX-language-de-hook))
+ LaTeX-dialect)
 
 ;;; ngerman.el ends here
diff --git a/style/nicefrac.el b/style/nicefrac.el
index 77aee51..3bd308e 100644
--- a/style/nicefrac.el
+++ b/style/nicefrac.el
@@ -37,7 +37,8 @@
    ;; Fontification
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("nicefrac" "[{{")) 'textual))))
+     (font-latex-add-keywords '(("nicefrac" "[{{")) 'textual)))
+ LaTeX-dialect)
 
 (defvar LaTeX-nicefrac-package-options '("nice" "ugly")
   "Package options for the nicefrac package.")
diff --git a/style/nomencl.el b/style/nomencl.el
index 3b04d7b..b22c054 100644
--- a/style/nomencl.el
+++ b/style/nomencl.el
@@ -65,6 +65,7 @@
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("nomenclature" "[{{"))
-                             'reference))))
+                             'reference)))
+ LaTeX-dialect)
 
 ;;; nomencl.el ends here
diff --git a/style/paralist.el b/style/paralist.el
index 61b50ac..e528de4 100644
--- a/style/paralist.el
+++ b/style/paralist.el
@@ -92,7 +92,8 @@
      (font-latex-add-keywords '(("setdefaultitem" "{{{{")
                                ("setdefaultenum" "{{{{")
                                ("setdefaultleftmargin" "{{{{{{"))
-                             'variable))))
+                             'variable)))
+ LaTeX-dialect)
 
 (defvar LaTeX-paralist-package-options '("newitem" "olditem" "newenum"
                                         "oldenum" "alwaysadjust"
diff --git a/style/pdfsync.el b/style/pdfsync.el
index a366fd7..39345f4 100644
--- a/style/pdfsync.el
+++ b/style/pdfsync.el
@@ -86,6 +86,7 @@
 (TeX-add-style-hook
  "pdfsync"
  (lambda ()
-   (setq TeX-source-correlate-output-page-function 
'LaTeX-pdfsync-output-page)))
+   (setq TeX-source-correlate-output-page-function 'LaTeX-pdfsync-output-page))
+ LaTeX-dialect)
 
 ;;; pdfsync.el ends here
diff --git a/style/placeins.el b/style/placeins.el
index f0f5cf8..cb4fb33 100644
--- a/style/placeins.el
+++ b/style/placeins.el
@@ -33,7 +33,8 @@
  "placeins"
  (lambda ()
    (TeX-add-symbols
-    '("FloatBarrier" 0))))
+    '("FloatBarrier" 0)))
+ LaTeX-dialect)
 
 (defvar LaTeX-placeins-package-options 
   '("section" "above" "below" "verbose")
diff --git a/style/plext.el b/style/plext.el
index 062bced..9afefc0 100644
--- a/style/plext.el
+++ b/style/plext.el
@@ -46,7 +46,8 @@
        (concat "\\(?:<[tyz]>\\)?[ \t]*" (regexp-opt '("[t]" "[b]" ""))))
    (set (make-local-variable 'LaTeX-tabular*-skipping-regexp)
        (concat "\\(?:<[tyz]>\\)?[ \t]*{[^}]*}[ \t]*"
-               (regexp-opt '("[t]" "[b]" ""))))))
+               (regexp-opt '("[t]" "[b]" "")))))
+ LaTeX-dialect)
 
 (defun LaTeX-plext-env-array (env)
   (let ((dir (read-string "(Optional) Direction (t or y or z): "))
diff --git a/style/plfonts.el b/style/plfonts.el
index 9576501..9df8739 100644
--- a/style/plfonts.el
+++ b/style/plfonts.el
@@ -24,6 +24,7 @@
    (setq TeX-close-quote "\">")
    (setq TeX-quote-after-quote t)
    (setq TeX-command-default "plLaTeX")
-   (run-hooks 'TeX-language-pl-hook))))
+   (run-hooks 'TeX-language-pl-hook)))
+ LaTeX-dialect)
 
 ;;; plfonts.el ends here
diff --git a/style/plhb.el b/style/plhb.el
index 918c1e0..0705550 100644
--- a/style/plhb.el
+++ b/style/plhb.el
@@ -24,6 +24,7 @@
    (setq TeX-close-quote "\">")
    (setq TeX-quote-after-quote t)
    (setq TeX-command-default "plLaTeX")
-   (run-hooks 'TeX-language-pl-hook))))
+   (run-hooks 'TeX-language-pl-hook)))
+ LaTeX-dialect)
 
 ;;; plhb.el ends here
diff --git a/style/polish.el b/style/polish.el
index 1538f9c..dac3451 100644
--- a/style/polish.el
+++ b/style/polish.el
@@ -47,6 +47,7 @@
    (when (fboundp 'font-latex-add-quotes)
      (font-latex-add-quotes '("\"`" "\"'"))
      (font-latex-add-quotes '("\"<" "\">" french)))
-   (run-hooks 'TeX-language-pl-hook)))
+   (run-hooks 'TeX-language-pl-hook))
+ LaTeX-dialect)
 
 ;;; polish.el ends here
diff --git a/style/polski.el b/style/polski.el
index 7b6fcfc..ef1985b 100644
--- a/style/polski.el
+++ b/style/polski.el
@@ -50,6 +50,7 @@
    ;; Fontification of quotation marks.
    (when (fboundp 'font-latex-add-quotes)
      (font-latex-add-quotes '(",," "''")))
-   (run-hooks 'TeX-language-pl-hook)))
+   (run-hooks 'TeX-language-pl-hook))
+ LaTeX-dialect)
 
 ;;; polski.el ends here
diff --git a/style/prosper.el b/style/prosper.el
index 77b63e0..3b6de6d 100644
--- a/style/prosper.el
+++ b/style/prosper.el
@@ -185,7 +185,8 @@
                        '("PDForPS" TeX-arg-conditional)
                        '("onlyInPS" t)
                        '("onlyInPDF" t)
-                       '("FromSlide" "Number")))))
+                       '("FromSlide" "Number"))))
+                   LaTeX-dialect)
 
 
 ;;; prosper.el ends here
diff --git a/style/psfig.el b/style/psfig.el
index 70fef60..cf8954f 100644
--- a/style/psfig.el
+++ b/style/psfig.el
@@ -20,7 +20,8 @@
     (LaTeX-add-environments
      '("psfigure" LaTeX-env-psfigure)
      )
-    )))
+    ))
+ LaTeX-dialect)
 
 (defun TeX-arg-psfig (optional)
    "Ask for file, width and length. Insert psfig macro"
diff --git a/style/pst-grad.el b/style/pst-grad.el
index b177561..1e74d8a 100644
--- a/style/pst-grad.el
+++ b/style/pst-grad.el
@@ -60,6 +60,7 @@
     (make-local-variable 'LaTeX-pst-parameters-name-list)
     (setq LaTeX-pst-parameters-name-list
           (append LaTeX-pstgrad-parameters-name-list
-                  LaTeX-pst-parameters-name-list)))))
+                  LaTeX-pst-parameters-name-list))))
+ LaTeX-dialect)
 
 ;;; pst-grad.el ends here
diff --git a/style/pst-node.el b/style/pst-node.el
index 6475e7b..5da0553 100644
--- a/style/pst-node.el
+++ b/style/pst-node.el
@@ -186,6 +186,7 @@
      '("psrowhook" t)
      '("pscolhook" t))
     (TeX-run-style-hooks
-     "pstricks"))))
+     "pstricks")))
+ LaTeX-dialect)
 
 ;;; pst-node.el ends here
diff --git a/style/pst-plot.el b/style/pst-plot.el
index beae60a..74a2946 100644
--- a/style/pst-plot.el
+++ b/style/pst-plot.el
@@ -132,6 +132,7 @@
     (make-local-variable 'LaTeX-pst-parameters-name-list)
     (setq LaTeX-pst-parameters-name-list
           (append LaTeX-pstplot-parameters-name-list
-                  LaTeX-pst-parameters-name-list)))))
+                  LaTeX-pst-parameters-name-list))))
+ LaTeX-dialect)
 
 ;;; pst-plot.el ends here
diff --git a/style/pst-slpe.el b/style/pst-slpe.el
index 2c82454..a3f456f 100644
--- a/style/pst-slpe.el
+++ b/style/pst-slpe.el
@@ -62,6 +62,7 @@
     (make-local-variable 'LaTeX-pst-parameters-name-list)
     (setq LaTeX-pst-parameters-name-list
           (append LaTeX-pstslpe-parameters-name-list
-                  LaTeX-pst-parameters-name-list)))))
+                  LaTeX-pst-parameters-name-list))))
+ LaTeX-dialect)
 
 ;;; pst-slpe.el ends here
diff --git a/style/pstricks.el b/style/pstricks.el
index b54dd58..161370c 100644
--- a/style/pstricks.el
+++ b/style/pstricks.el
@@ -861,7 +861,8 @@ comma separated list. Point has to be within the sexp to 
modify."
       (TeX-arg-eval LaTeX-pst-angle) LaTeX-pst-point-in-parens t)
     '("uput" LaTeX-pst-macro-uput t)
     '("multirput" (LaTeX-pst-macro-multirputps t) t)
-    '("multips" (LaTeX-pst-macro-multirputps nil) t))))
+    '("multips" (LaTeX-pst-macro-multirputps nil) t)))
+ LaTeX-dialect)
 
 (defvar LaTeX-pstricks-package-options
   '("97" "plain" "DIA" "vtex" "distiller" "noxcolor")
diff --git a/style/ragged2e.el b/style/ragged2e.el
index 52d2f34..8614425 100644
--- a/style/ragged2e.el
+++ b/style/ragged2e.el
@@ -56,7 +56,8 @@
    (LaTeX-add-environments 
     "FlushLeft" "FlushRight" "Center" "justify")
 
-   (TeX-run-style-hooks "footmisc" "everysel")))
+   (TeX-run-style-hooks "footmisc" "everysel"))
+ LaTeX-dialect)
 
 (defvar LaTeX-ragged2e-package-options 
   '("originalcommands" "newcommands" "originalparameters" "document"
diff --git a/style/report.el b/style/report.el
index 945109b..6a4e638 100644
--- a/style/report.el
+++ b/style/report.el
@@ -15,6 +15,7 @@
    (LaTeX-largest-level-set "chapter")
    (LaTeX-add-counters "part" "chapter" "section" "subsection" "subsubsection"
                       "paragraph" "subparagraph" "figure" "table")
-   (LaTeX-add-pagestyles "headings" "myheadings")))
+   (LaTeX-add-pagestyles "headings" "myheadings"))
+ LaTeX-dialect)
 
 ;;; report.el ends here
diff --git a/style/ruby.el b/style/ruby.el
index 0a96e57..38451f9 100644
--- a/style/ruby.el
+++ b/style/ruby.el
@@ -44,6 +44,7 @@
     '("rubylatin" 0)
     '("rubysize" 0)
     '("rubysep" 0)
-    '("ruby" t nil))))
+    '("ruby" t nil)))
+ LaTeX-dialect)
 
 ;;; ruby.el ends here
diff --git a/style/scrartcl.el b/style/scrartcl.el
index 88b3e0a..74b83d5 100644
--- a/style/scrartcl.el
+++ b/style/scrartcl.el
@@ -20,6 +20,7 @@
    (lambda ()
      (LaTeX-largest-level-set "section")
      ;; load basic definitons
-     (TeX-run-style-hooks "scrbase")))
+     (TeX-run-style-hooks "scrbase"))
+   LaTeX-dialect)
 
 ;;; scrartcl.el ends here
diff --git a/style/scrbase.el b/style/scrbase.el
index e203bc9..2414763 100644
--- a/style/scrbase.el
+++ b/style/scrbase.el
@@ -182,7 +182,8 @@
       ;; Sectioning keywords
       (font-latex-add-keywords '(("addpart" "[{")) 'sectioning-1)
       (font-latex-add-keywords '(("addsec" "[{")) 'sectioning-2)
-      (font-latex-add-keywords '(("minisec" "[{")) 'sectioning-4))))
+      (font-latex-add-keywords '(("minisec" "[{")) 'sectioning-4)))
+  LaTeX-dialect)
 
 (defun TeX-arg-KOMA-setpreamble (optional &optional prompt)
   "Prompt for KOMA-Script's \\set*preamble position with completion."
diff --git a/style/scrbook.el b/style/scrbook.el
index 6cada7d..d4e7152 100644
--- a/style/scrbook.el
+++ b/style/scrbook.el
@@ -57,6 +57,7 @@
                                 ("dictum" "[{"))
                               'textual)
       ;; Sectioning keywords
-      (font-latex-add-keywords '(("addchap" "[{")) 'sectioning-1))))
+      (font-latex-add-keywords '(("addchap" "[{")) 'sectioning-1)))
+  LaTeX-dialect)
 
 ;;; scrbook.el ends here
diff --git a/style/scrlttr2.el b/style/scrlttr2.el
index 136b1c5..44d6270 100644
--- a/style/scrlttr2.el
+++ b/style/scrlttr2.el
@@ -197,7 +197,8 @@
      (font-latex-add-keywords '("cleardoublestandardpage"
                                "cleardoubleplainpage"
                                "cleardoubleemptypage")
-                             'warning))))
+                             'warning)))
+  LaTeX-dialect)
 
 (defun TeX-arg-KOMA-scrlttr-vars (optional &optional prompt)
   "Prompt for KOMA-Script's scrlttr2 predefined variables with completion."
diff --git a/style/scrpage2.el b/style/scrpage2.el
index ed3d500..34b8497 100644
--- a/style/scrpage2.el
+++ b/style/scrpage2.el
@@ -110,7 +110,8 @@
                                ("newpagestyle" "{{{")
                                ("renewpagestyle" "{{{")
                                ("providepagestyle" "{{{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-scrpage2-package-options '("headinclude" "headexclude"
                                         "footinclude" "footexclude"
diff --git a/style/scrreprt.el b/style/scrreprt.el
index 2ffe3ad..57ec0af 100644
--- a/style/scrreprt.el
+++ b/style/scrreprt.el
@@ -58,6 +58,7 @@
                                ("dictum" "[{"))
                              'textual)
      ;; Sectioning keywords
-     (font-latex-add-keywords '(("addchap" "[{")) 'sectioning-1))))
+     (font-latex-add-keywords '(("addchap" "[{")) 'sectioning-1)))
+ LaTeX-dialect)
 
 ;;; scrreprt.el ends here
diff --git a/style/setspace.el b/style/setspace.el
index 07db8ca..206033e 100644
--- a/style/setspace.el
+++ b/style/setspace.el
@@ -52,7 +52,8 @@
      (font-latex-add-keywords '(("singlespacing" "")
                                ("doublespacing" "")
                                ("onehalfspacing" ""))
-                              'function))))
+                              'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-setspace-package-options 
   '("doublespacing" "onehalfspacing" "singlespacing" "nodisplayskipstretch")
diff --git a/style/shortvrb.el b/style/shortvrb.el
index 2a5a9aa..0bc3ffb 100644
--- a/style/shortvrb.el
+++ b/style/shortvrb.el
@@ -74,7 +74,8 @@ your document actually defines shortvrb chars using
      (let (syntax-alist)
        (dolist (char LaTeX-shortvrb-chars)
         (add-to-list 'syntax-alist (cons char "|")))
-       (font-latex-add-to-syntax-alist syntax-alist)))))
+       (font-latex-add-to-syntax-alist syntax-alist))))
+ LaTeX-dialect)
 
 ;; Don't look for file-local variables before this line, so that the example in
 ;; the docstring isn't picked up.
diff --git a/style/siunitx.el b/style/siunitx.el
index aa73bba..ec7cda0 100644
--- a/style/siunitx.el
+++ b/style/siunitx.el
@@ -613,7 +613,8 @@ string."
                                ("DeclareSIPrePower" "|{\\{")
                                ("DeclareSIQualifier" "|{\\{")
                                ("highlight" "{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defun LaTeX-siunitx-package-options nil
   "Prompt for package options for the siunitx package."
diff --git a/style/slides.el b/style/slides.el
index 0094616..e73826a 100644
--- a/style/slides.el
+++ b/style/slides.el
@@ -45,6 +45,7 @@
                           "note")
    (LaTeX-add-counters "minutes" "seconds")
    (LaTeX-add-pagestyles "headings" "slide" "overlay" "note")
-   (setq LaTeX-default-document-environment "slide")))
+   (setq LaTeX-default-document-environment "slide"))
+ LaTeX-dialect)
 
 ;;; slides.el ends here
diff --git a/style/slovak.el b/style/slovak.el
index d147573..3dc107e 100644
--- a/style/slovak.el
+++ b/style/slovak.el
@@ -8,4 +8,5 @@
    (when (fboundp 'font-latex-add-quotes)
      (font-latex-add-quotes '("\"`" "\"'"))
      (font-latex-add-quotes '("\"<" "\">" french)))
-   (run-hooks 'TeX-language-sk-hook)))
+   (run-hooks 'TeX-language-sk-hook))
+ LaTeX-dialect)
diff --git a/style/subfigure.el b/style/subfigure.el
index 3fcb587..e129e62 100644
--- a/style/subfigure.el
+++ b/style/subfigure.el
@@ -58,7 +58,8 @@
                              'textual)
      (font-latex-add-keywords '(("Subref" "{")
                                ("subref" "{"))
-                             'reference))))
+                             'reference)))
+ LaTeX-dialect)
 
 (defvar LaTeX-subfigure-package-options '("normal" "hang" "center"
                                          "centerlast" "nooneline"
diff --git a/style/swedish.el b/style/swedish.el
index 75f6337..adbfdda 100644
--- a/style/swedish.el
+++ b/style/swedish.el
@@ -11,4 +11,5 @@
      (setq TeX-quote-language
           `("swedish" "''" ,TeX-close-quote ,TeX-quote-after-quote)))
    (setq LaTeX-babel-hyphen-language "swedish")
-   (run-hooks 'TeX-language-sv-hook)))
+   (run-hooks 'TeX-language-sv-hook))
+ LaTeX-dialect)
diff --git a/style/tabularx.el b/style/tabularx.el
index e499b5a..a0f3ee3 100644
--- a/style/tabularx.el
+++ b/style/tabularx.el
@@ -55,6 +55,7 @@
     '("tabularx" LaTeX-env-tabular*))
    
    ;; `tabularx' requires array to define the column types
-   (TeX-run-style-hooks "array")))
+   (TeX-run-style-hooks "array"))
+ LaTeX-dialect)
 
 ;;; tabularx.el ends here
diff --git a/style/tabulary.el b/style/tabulary.el
index eb20d24..c17b96e 100644
--- a/style/tabulary.el
+++ b/style/tabulary.el
@@ -52,6 +52,7 @@
     '("tabulary" LaTeX-env-tabular*))
 
    ;; `tabulary' requires the array package
-   (TeX-run-style-hooks "array")))
+   (TeX-run-style-hooks "array"))
+ LaTeX-dialect)
 
 ;;; tabulary.el ends here
diff --git a/style/ulem.el b/style/ulem.el
index 8e3ecb9..c3b3491 100644
--- a/style/ulem.el
+++ b/style/ulem.el
@@ -58,7 +58,8 @@
      (font-latex-add-keywords '(("uline" "{")
                                ("uwave" "{")
                                ("sout" "{")
-                               ("xout" "{")) 'textual))))
+                               ("xout" "{")) 'textual)))
+ LaTeX-dialect)
 
 (defvar LaTeX-arg-fontdecl
   (mapcar (lambda (str) (concat "\\" str))
diff --git a/style/unicode-math.el b/style/unicode-math.el
index 87943f7..d7ed089 100644
--- a/style/unicode-math.el
+++ b/style/unicode-math.el
@@ -64,7 +64,8 @@
              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("setmathfont" "[{")
                                ("unimathsetup" "{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defun LaTeX-unicode-math-package-options ()
   "Prompt for package options for the unicode-math package."
diff --git a/style/units.el b/style/units.el
index 88ba73d..8320e52 100644
--- a/style/units.el
+++ b/style/units.el
@@ -41,7 +41,8 @@
    ;; Fontification
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("unit" "[{") ("unitfrac" "[{{")) 'textual))))
+     (font-latex-add-keywords '(("unit" "[{") ("unitfrac" "[{{")) 'textual)))
+ LaTeX-dialect)
 
 (defvar LaTeX-units-package-options '("tight" "loose")
   "Package options for the units package.")
diff --git a/style/url.el b/style/url.el
index 0084be4..efdc297 100644
--- a/style/url.el
+++ b/style/url.el
@@ -78,7 +78,8 @@
      (font-latex-set-syntactic-keywords)
      ;; Tell font-lock about the update.
      (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults))))
+     (font-lock-set-defaults)))
+ LaTeX-dialect)
 
 (defun TeX-arg-urlstyle (optional &optional prompt)
   "Prompt for style used in \\urlstyle with completion."
diff --git a/style/varioref.el b/style/varioref.el
index c1556ee..8811391 100644
--- a/style/varioref.el
+++ b/style/varioref.el
@@ -64,7 +64,8 @@
               ("\\\\fullref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
               ("\\\\vpageref\\*?\\(\\[[^]]*\\]\\)*{\\([^{}\n\r\\%,]*\\)"
               2 LaTeX-label-list "}"))
-           TeX-complete-list))))
+           TeX-complete-list)))
+   LaTeX-dialect)
 
 (defvar LaTeX-varioref-package-options
   '("draft" "final" "afrikaans" "american" "austrian" "naustrian" "basque"
diff --git a/style/verbatim.el b/style/verbatim.el
index 2c95def..1fb7bdd 100644
--- a/style/verbatim.el
+++ b/style/verbatim.el
@@ -35,7 +35,8 @@
     (LaTeX-add-environments
      "comment")
     (TeX-add-symbols
-     '("verbatiminput" TeX-arg-file)))))
+     '("verbatiminput" TeX-arg-file))))
+ LaTeX-dialect)
 
 (defvar LaTeX-verbatim-package-options nil
   "Package options for the verbatim package.")
diff --git a/style/virtex.el b/style/virtex.el
index 18f58bc..e774b46 100644
--- a/style/virtex.el
+++ b/style/virtex.el
@@ -77,6 +77,7 @@
                     "vcenter" "vfil" "vfill" "vfilneg" "vfuzz"
                     "voffset" "vrule" "vsize" "vskip" "vss" "vtop"
                     "wd" "widowpenalty" "write" "xdef" "xleaders"
-                    "xspaceskip" "year")))
+                    "xspaceskip" "year"))
+  LaTeX-dialect)
 
 ;;; virtex.el ends here
diff --git a/style/xparse.el b/style/xparse.el
index 7b57108..00a76a3 100644
--- a/style/xparse.el
+++ b/style/xparse.el
@@ -104,7 +104,8 @@
                                ("NewDocumentEnvironment" "{{{{")
                                ("RenewDocumentEnvironment" "{{{{")
                                ("ProvideDocumentEnvironment" "{{{{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defun LaTeX-xparse-package-options ()
   "Read the xparse package options from the user."
diff --git a/style/xspace.el b/style/xspace.el
index c94a653..dda6238 100644
--- a/style/xspace.el
+++ b/style/xspace.el
@@ -44,7 +44,8 @@
      (font-latex-add-keywords '(("xspace" "")
                                ("xspaceaddexception" "{")
                                ("xspaceremoveexception" "{"))
-                             'function))))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-xspace-package-options nil
   "Package options for the xspace package.")
diff --git a/tex-info.el b/tex-info.el
index 41d674f..2c94b6a 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -35,15 +35,14 @@
   (defalias 'texinfo-mode 'TeX-texinfo-mode))
 
 ;;; Environments:
-
 (defvar Texinfo-environment-list
   '(("cartouche") ("command") ("copying") ("defcv") ("deffn") ("defivar")
     ("defmac") ("defmethod") ("defop") ("defopt") ("defspec")
     ("deftp") ("deftypefn") ("deftypefun") ("deftypevar") ("deftypevr")
     ("defun") ("defvar") ("defvr") ("description") ("detailmenu")
     ("direntry") ("display") ("documentdescription") ("enumerate")
-    ("example") ("flushleft") ("flushright") ("format") ("ftable")
-    ("group") ("ifclear") ("ifdocbook") ("ifhtml") ("ifinfo")
+    ("example") ("float") ("flushleft") ("flushright") ("format") ("ftable")
+    ("group") ("html") ("ifclear") ("ifdocbook") ("ifhtml") ("ifinfo")
     ("ifnotdocbook") ("ifnothtml") ("ifnotinfo") ("ifnotplaintext")
     ("ifnottex") ("ifnotxml") ("ifplaintext") ("ifset") ("iftex")
     ("ifxml") ("ignore") ("itemize") ("lisp") ("macro") ("menu")
@@ -603,6 +602,7 @@ value of `Texinfo-mode-hook'."
 
   (set (make-local-variable 'TeX-font-list) Texinfo-font-list)
   (set (make-local-variable 'TeX-font-replace-function) 
'TeX-font-replace-macro)
+  (set (make-local-variable 'TeX-style-hook-dialect) :texinfo)
 
   (add-hook 'find-file-hooks (lambda ()
                               (unless (file-exists-p (buffer-file-name))
@@ -626,6 +626,10 @@ value of `Texinfo-mode-hook'."
    '("bullet")
    '("bye")
    '("c" (TeX-arg-literal " ") (TeX-arg-free "Comment"))
+   '("caption" "Caption"
+     ;; TODO: caption is meaningful only inside float env. Maybe some checking
+     ;; and warning would be good.
+     )
    '("center" (TeX-arg-literal " ") (TeX-arg-free "Line of text"))
    '("chapheading" (TeX-arg-literal " ") (TeX-arg-free "Title"))
    '("chapter" (TeX-arg-literal " ") (TeX-arg-free "Title"))
diff --git a/tex.el b/tex.el
index f3316d5..82434f9 100644
--- a/tex.el
+++ b/tex.el
@@ -2376,15 +2376,51 @@ 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.
+
+A hook HOOKN may be a hook function HOOK-FUN to be run in
+all TeX dialects (LaTeX, Texinfo, etc.), or a vector like:
+
+     [TeX-style-hook HOOK-FUN DIALECT-SET]
+
+where HOOK-FUN is the hook function to be run, and DIALECT-SET is
+a non-empty set of dialects in which the hook function may be
+run.
+
+This set is instantiated by function `TeX-add-style-hook' through
+functions manipulating style hook dialect expression named with a
+`TeX-shdex-' prefix.
+
+For supported dialects, see variables `TeX-style-hook-dialect'.")
+
+(defvar TeX-style-hook-dialect :latex
+  "Dialect for running hooks locally to the considered file.
+Supported values are described below:
+
+* `:bibtex'  for files in BibTeX mode.
+* `:latex'   for files in LaTeX mode, or any mode derived 
+             thereof.
+* `:texinfo' for Texinfo files.
+
+Purpose is notably 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'.")
 
 (defcustom TeX-byte-compile nil
   "*Not nil means try to byte compile auto files before loading."
   :group 'TeX-parse
   :type 'boolean)
 
+(defun TeX-bibtex-set-BibTeX-dialect ()
+  "Set `TeX-style-hook-dialect' to `:bibtex' locally to BibTeX buffers."
+  (set (make-local-variable 'TeX-style-hook-dialect) :bibtex))
+
 (defun TeX-load-style (style)
   "Search for and load each definition for STYLE in `TeX-style-path'."
   (cond ((assoc style TeX-style-hook-list)) ; We already found it
@@ -2431,9 +2467,79 @@ active.")
          ((file-readable-p el)
           (load-file el)))))
 
-(defun TeX-add-style-hook (style hook)
-  "Give STYLE yet another HOOK to run."
-  (let ((entry (assoc style TeX-style-hook-list)))
+(defconst TeX-style-hook-dialect-weight-alist
+  '((:latex . 1) (:texinfo . 2) (:bibtex . 4))
+  "Association list to map dialects to binary weight, in order to
+  implement dialect sets as bitmaps."  )
+
+(defun TeX-shdex-eval (dialect-expr)
+  "Evaluate a style hook dialect expression DIALECT-EXPR."
+  (cond
+   ((symbolp dialect-expr)
+    (let ((cell (assq dialect-expr TeX-style-hook-dialect-weight-alist)))
+      (if cell (cdr cell)
+       (error "Invalid dialect expression : %S." dialect-expr))))
+   ((and (consp dialect-expr)
+        (memq (car dialect-expr) '(or not and nor)))
+    (apply (intern
+           (concat "TeX-shdex-" (symbol-name  (car dialect-expr))))
+          (cdr dialect-expr)))
+   (t
+    (error "Invalid dialect expression : %S." dialect-expr))))
+
+(defsubst TeX-shdex-or (&rest args)
+  "OR operator for style hook dialect expressions."
+  (apply 'logior (mapcar 'TeX-shdex-eval args)))
+
+(defsubst TeX-shdex-and (&rest args)
+  "AND operator for style hook dialect expressions."
+  (apply 'logand (mapcar 'TeX-shdex-eval args)))
+
+(defsubst TeX-shdex-nor (&rest args)
+  "NOR operator for style hook dialect expressions."
+  (lognot (apply 'TeX-shdex-or args)))
+
+(defsubst TeX-shdex-not (arg)
+  "NOT operator for style hook dialect expressions."
+   (lognot (TeX-shdex-eval arg)))
+
+(defsubst TeX-shdex-in-p (dialect dialect-set)
+  "Test whether dialect DIALECT is in dialect set DIALECT-SET."
+  (let ((cell (assq dialect TeX-style-hook-dialect-weight-alist)))
+    (if cell
+       (/= 0 (logand (cdr cell) dialect-set))
+      (error "Invalid dialect %S" dialect))))
+
+(defsubst TeX-shdex-listify (dialect-set)
+  "Converts a dialect set DIALECT-SET to a list of all dialect
+comprised in this set, where dialects are symbols"
+  (let (ret)
+    (dolist (c dialect-set)
+      (when (/= 0 (logand (cdr c) dialect-set))
+       (push (car c) ret)))
+    ret))
+
+(defun TeX-add-style-hook (style hook &optional dialect-expr)
+  "Give STYLE yet another HOOK to run.
+
+DIALECT-EXPR serves the purpose of marking the hook to be run only in
+that dicontext. 
+
+DIALECT-EXPR may be a single symbol defining the dialect, see
+variable `TeX-style-hook-dialect' for supported dialects.
+
+DIALECT-EXPR can also be an expression like one of the following:
+
+* (or  DIALECT1 DIALECT2 ...)
+* (nor DIALECT1 DIALECT2 ...)
+* (and DIALECT1 DIALECT2 ...)
+* (not DIALECT )
+
+When omitted DIALECT-EXPR is equivalent to `(nor )', ie all
+dialected are allowed."
+  (let ((entry (TeX-assoc-string style TeX-style-hook-list)))
+    (and dialect-expr (setq hook (vector 'TeX-style-hook hook
+                                        (TeX-shdex-eval dialect-expr))))
     (cond ((null entry)
           ;; New style, add entry.
           (setq TeX-style-hook-list (cons (list style hook)
@@ -2445,11 +2551,30 @@ active.")
           ;; Old style, new hook.
           (setcdr entry (cons hook (cdr entry)))))))
 
-(defun TeX-unload-style (style)
-  "Forget that we once loaded STYLE."
+(defun TeX-keep-hooks-in-dialect (hooks dialect-list)
+  "Scan HOOKS for all hooks the associated dialect of which is
+found in DIALECT-LIST and return the list thereof."
+  (let (ret dialect-list-1)
+    (dolist (hook hooks)
+      (setq dialect-list-1 (and (vectorp hook) (eq (aref hook 0) 
'TeX-style-hook)
+                               (TeX-shdex-listify (aref hook 2))))
+      (while dialect-list-1
+       (when (memq (pop dialect-list-1) dialect-list)
+         (push hook ret)
+         (setq dialect-list-1 nil)))
+    ret)))
+           
+(defun TeX-unload-style (style &optional dialect-list)
+  "Forget that we once loaded STYLE. If DIALECT-LIST is provided
+the STYLE is only removed for those dialects in DIALECT-LIST. 
+
+See variable `TeX-style-hook-dialect' for supported dialects."
   (let ((style-data (TeX-assoc-string style TeX-style-hook-list)))
     (if style-data
-       (setq TeX-style-hook-list (delq style-data TeX-style-hook-list)))))
+       (let ((hooks (and dialect-list (TeX-keep-hooks-in-dialect (cdr 
style-data) dialect-list))))
+         (if hooks
+             (setcdr style-data hooks)
+           (setq TeX-style-hook-list (delq style-data 
TeX-style-hook-list)))))))
 
 (defcustom TeX-virgin-style (if (and TeX-auto-global
                                     (file-directory-p TeX-auto-global))
@@ -2482,7 +2607,15 @@ active.")
                        style (substring style
                                         (match-beginning 2) (match-end 2))))
                (condition-case err
-                   (mapcar 'funcall
+                   (mapcar (lambda (hook)
+                             (cond
+                              ((functionp hook)
+                               (funcall hook))
+                              ((and (vectorp hook)
+                                    (eq (aref hook 0) 'TeX-style-hook))
+                               (and (TeX-shdex-in-p TeX-style-hook-dialect 
(aref hook 2))
+                                    (funcall (aref hook 1))))
+                              (t (error "Invalid style hook %S" hook))))
                            (cdr-safe (TeX-assoc-string style 
TeX-style-hook-list)))
                  ;; This happens in case some style added a new parser, and
                  ;; now the style isn't used anymore (user deleted

reply via email to

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