branch: main
commit 9cc4dcb0707a4e2c3a54f45247d4f1845c072892
Author: Arash Esbati <[email protected]>
Commit: Arash Esbati <[email protected]>

    Update style/babel.el to package v26.4
    
    * style/babel.el (LaTeX-babel-babelprovide-key-val-options):
    Update key-values.
    ("babel"): Rearrange macros according to current babel manual.
    Add missing macros and environments incl. fontification.
    (LaTeX-babel-package-options-list): Update options.
---
 style/babel.el | 321 +++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 233 insertions(+), 88 deletions(-)

diff --git a/style/babel.el b/style/babel.el
index 2561317e..f33c3c6d 100644
--- a/style/babel.el
+++ b/style/babel.el
@@ -1,4 +1,4 @@
-;;; babel.el --- AUCTeX style for `babel.sty' version 3.88.  -*- 
lexical-binding: t; -*-
+;;; babel.el --- AUCTeX style for `babel.sty' v26.4  -*- lexical-binding: t; 
-*-
 
 ;; Copyright (C) 2005-2026 Free Software Foundation, Inc.
 
@@ -24,7 +24,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `babel.sty' version 3.88 from 2023/04/18.
+;; This file adds support for `babel.sty' v26.4 from 2026-03-08.
 
 ;;; Code:
 
@@ -101,7 +101,14 @@
     ("main")
     ("script")
     ("language")
-    ("mapfont")
+    ("alph")
+    ("Alph")
+    ("casing")
+    ("onchar" ("ids" "fonts" "letters"))
+    ("transforms")
+    ("interchar")
+    ("justification" ("unhyphenated" "kashida" "elongated" "padding"))
+    ("linebreaking" ("unhyphenated" "kashida" "elongated" "padding"))
     ("intraspace")
     ("intrapenalty"))
   "Key=value options for `\\babelprovide' macro from `babel' package.")
@@ -249,7 +256,29 @@
    ;; New symbols
    (TeX-add-symbols
 
-    ;; 1.7 Basic language selectors
+    ;; 1.8. Fonts in Unicode engines
+    `("babelfont"
+      [TeX-arg-completing-read-multiple LaTeX-babel-language-list
+                                        "Language(s)"]
+      (TeX-arg-completing-read ("rm" "sf" "tt") "Font family")
+      [TeX-arg-key-val (LaTeX-fontspec-font-features)]
+      LaTeX-fontspec-arg-font
+      ,(lambda (_)
+         ;; Run `TeX-check-engine-add-engines' and then
+         ;; load `fontspec.el' if not already loaded and
+         ;; make sure the key-vals are up to date.
+         (unless (member "fontspec" (TeX-style-list))
+           (TeX-check-engine-add-engines 'luatex 'xetex)
+           (TeX-run-style-hooks "fontspec")
+           (LaTeX-fontspec-auto-cleanup))
+         ;; Now search back for the Font family arg:
+         (save-excursion
+           (re-search-backward "\\\\babelfont\\(?:\\[[^]]*\\]\\)?{\\([^}]+\\)}"
+                               (line-beginning-position) t)
+           (LaTeX-add-babel-babelfonts (match-string-no-properties 1))
+           (LaTeX-babel-cleanup-babelfont))))
+
+    ;; 1.9 Basic language selectors
     '("selectlanguage"
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
                                "Language"))
@@ -259,7 +288,8 @@
                                "Language")
       t)
 
-    ;; 1.9 More on selection
+    ;; 2. More on language loading and selection
+    ;; 2.1. A few tools
     '("babeltags" t)
     '("babelensure"
       (TeX-arg-key-val
@@ -274,81 +304,166 @@
                     "LY1" "LV1" "LGR"))))
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
                                "Language"))
-    ;; 1.10 Shorthands
-    '("shorthandon"    "Shorthands list")
-    '("shorthandoff"   "Shorthands list")
-    '("shorthandoff*"  "Shorthands list")
-    '("useshorthands"  "Character")
-    '("useshorthands*" "Character")
-    '("defineshorthand"
-      [TeX-arg-completing-read-multiple (LaTeX-babel-active-languages)
-                                        "Language(s)"]
+    '("AfterBabelLanguage"
+      (TeX-arg-completing-read LaTeX-babel-language-list "Language")
+      t)
+
+    ;; 2.2. Accessing language info
+    '("localename"     0)
+    '("mainlocalename" 0)
+    '("languagename"   0)
+    '("iflanguage"
+      (TeX-arg-completing-read (LaTeX-babel-active-languages)
+                               "Language")
       t nil)
-    '("languageshorthands"
+    '("localeinfo"
+      (TeX-arg-completing-read ("name.english"
+                                "tag.ini"
+                                "tag.bcp47"
+                                "language.tag.bcp47"
+                                "tag.opentype"
+                                "script.name"
+                                "script.tag.bcp47"
+                                "script.tag.opentype"
+                                "region.tag.bcp47"
+                                "variant.tag.bcp47"
+                                "extension.x.tag.bcp47"
+                                "extension.t.tag.bcp47"
+                                "extension.u.tag.bcp47")
+                               "Field"))
+    '("localeinfo*"
+      (TeX-arg-completing-read ("name.english"
+                                "tag.ini"
+                                "tag.bcp47"
+                                "language.tag.bcp47"
+                                "tag.opentype"
+                                "script.name"
+                                "script.tag.bcp47"
+                                "script.tag.opentype"
+                                "region.tag.bcp47"
+                                "variant.tag.bcp47"
+                                "extension.x.tag.bcp47"
+                                "extension.t.tag.bcp47"
+                                "extension.u.tag.bcp47")
+                               "Field"))
+    '("getlocaleproperty"  TeX-arg-define-macro "Locale" t)
+    '("getlocaleproperty*" TeX-arg-define-macro "Locale" t)
+    '("localeid" 0)
+    '("ShowLocaleProperties"
+      (TeX-arg-completing-read LaTeX-babel-language-list "Language"))
+    '("LocaleForEach" t)
+
+    ;; 2.6. Selection based on BCP 47 tags
+    '("babeladjust"
+      (TeX-arg-key-val (("autoload.bcp47" ("on" "off"))
+                        ("autoload.bcp47.options" ("import"))
+                        ("autoload.bcp47.prefix"))))
+
+    ;; 3.1. Captions
+    '("setlocalecaption"
+      (TeX-arg-completing-read (LaTeX-babel-active-languages))
+      (TeX-arg-completing-read ("preface"
+                                "ref"
+                                "abstract"
+                                "bib"
+                                "chapter"
+                                "appendix"
+                                "contents"
+                                "listfigure"
+                                "listtable"
+                                "index"
+                                "figure"
+                                "table"
+                                "part"
+                                "encl"
+                                "cc"
+                                "headto"
+                                "page"
+                                "see"
+                                "also"
+                                "proof"
+                                "glossary"))
+      "New value")
+
+    ;; 3.3. Language attributes
+    '("languageattribute"
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
-                               "Language"))
-    '("babelshorthand"   "Short hand")
-    '("ifbabelshorthand" "Character" t nil)
-    '("aliasshorthand"   "Original" "Alias")
+                               "Language")
+      t)
 
-    ;; 1.12 The base option
-    '("AfterBabelLanguage"
-      (TeX-arg-completing-read LaTeX-babel-language-list "Language")
+    ;; 3.6. Hooks
+    '("AddBabelHook"
+      [TeX-arg-completing-read (LaTeX-babel-active-languages)
+                               "Language"]
+      "Name"
+      (TeX-arg-completing-read ("adddialect"
+                                "patterns"
+                                "hyphenation"
+                                "defaultcommands"
+                                "encodedcommands"
+                                "stopcommands"
+                                "write"
+                                "beforeextras"
+                                "afterextras"
+                                "stringprocess"
+                                "initiateactive"
+                                "afterreset"
+                                "begindocument"
+                                "foreign"
+                                "everylanguage"
+                                "loadkernel"
+                                "loadpatterns"
+                                "loadexceptions")
+                               "Event")
       t)
 
-    ;; 1.14 Selecting fonts
-    `("babelfont"
-      [TeX-arg-completing-read-multiple LaTeX-babel-language-list
-                                        "Language(s)"]
-      (TeX-arg-completing-read ("rm" "sf" "tt") "Font family")
-      [TeX-arg-key-val (LaTeX-fontspec-font-features)]
-      LaTeX-fontspec-arg-font
-      ,(lambda (_)
-         ;; Run `TeX-check-engine-add-engines' and then
-         ;; load `fontspec.el' if not already loaded and
-         ;; make sure the key-vals are up to date.
-         (unless (member "fontspec" (TeX-style-list))
-           (TeX-check-engine-add-engines 'luatex 'xetex)
-           (TeX-run-style-hooks "fontspec")
-           (LaTeX-fontspec-auto-cleanup))
-         ;; Now search back for the Font family arg:
-         (save-excursion
-           (re-search-backward "\\\\babelfont\\(?:\\[[^]]*\\]\\)?{\\([^}]+\\)}"
-                               (line-beginning-position) t)
-           (LaTeX-add-babel-babelfonts (match-string-no-properties 1))
-           (LaTeX-babel-cleanup-babelfont))))
+    ;; 3.7. Manage auxiliary files
+    '("BabelContentsFiles" 0)
 
-    ;; 1.16 Creating a language
+    ;; 3.8. Code based on the selector
+    '("IfBabelSelectorTF"
+      (TeX-arg-completing-read-multiple ("select"
+                                         "other"
+                                         "other*"
+                                         "foreign")
+                                        "Selectors")
+      2)
+
+    ;; 4. Creating a language
     '("babelprovide"
       [TeX-arg-key-val LaTeX-babel-babelprovide-key-val-options]
       (TeX-arg-completing-read LaTeX-babel-language-list "Language"))
 
-    ;; 1.19 Accessing language info
-    '("languagename" 0)
-    '("iflanguage"
-      (TeX-arg-completing-read (LaTeX-babel-active-languages)
-                               "Language")
-      t nil)
-
-    ;; 1.20 Hyphenation and line breaking
-    '("babelhyphen"
-      (TeX-arg-completing-read ("soft" "hard" "repeat" "nobreak" "empty") 
"Type/Text"))
-    '("babelhyphen*"
-      (TeX-arg-completing-read ("soft" "hard" "repeat" "nobreak" "empty") 
"Type/Text"))
 
+    ;; 5.1. Hyphenation and line breaking - 1. Commands
     '("babelhyphenation"
       [TeX-arg-completing-read-multiple LaTeX-babel-language-list
                                         "Language(s)"]
       t)
 
-    ;; 1.23 Selecting scripts
-    '("ensureascii" "Text")
+    '("babelhyphen"
+      (TeX-arg-completing-read ("soft" "hard" "repeat" "nobreak" "empty") 
"Type/Text"))
+    '("babelhyphen*"
+      (TeX-arg-completing-read ("soft" "hard" "repeat" "nobreak" "empty") 
"Type/Text"))
 
-    ;; 1.25 Language attributes
-    '("languageattribute"
+    ;; 5.3. Shorthands – 1. Commands
+    '("shorthandon"    "Shorthands list")
+    '("shorthandoff"   "Shorthands list")
+    '("shorthandoff*"  "Shorthands list")
+    '("useshorthands"  "Character")
+    '("useshorthands*" "Character")
+    '("defineshorthand"
+      [TeX-arg-completing-read-multiple (LaTeX-babel-active-languages)
+                                        "Language(s)"]
+      t nil)
+    '("languageshorthands"
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
-                               "Language")
-      t))
+                               "Language"))
+    '("babelshorthand"   "Short hand")
+    '("ifbabelshorthand" "Character" t nil)
+
+    ;; 5.9. Scripts
+    '("ensureascii" "Text") )
 
    ;; Don't increase indentation at various \if* macros:
    (let ((exceptions '("ifbabelshorthand"
@@ -357,8 +472,14 @@
        (add-to-list 'LaTeX-indent-begin-exceptions-list elt t))
      (LaTeX-indent-commands-regexp-make))
 
-   ;; New environments: 1.8 Auxiliary language selectors
+   ;; New environments:
    (LaTeX-add-environments
+    ;; 1.9. Basic language selectors
+    '("selectlanguage" LaTeX-env-args
+      (TeX-arg-completing-read (LaTeX-babel-active-languages)
+                               "Language"))
+
+    ;; 1.10. Auxiliary language selectors
     '("otherlanguage" LaTeX-env-args
       (TeX-arg-completing-read (LaTeX-babel-active-languages)
                                "Language"))
@@ -373,21 +494,45 @@
    ;; Fontification
    (when (and (featurep 'font-latex)
               (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("selectlanguage"     "{")
+     (font-latex-add-keywords '(;; 1.8. Fonts in Unicode engines
+                                ("babelfont"          "[{[{")
+                                ;; 1.9 Basic language selectors
+                                ("selectlanguage"     "{")
+                                ;; 2.1. A few tools
                                 ("babeltags"          "{")
                                 ("babelensure"        "{{")
+                                ("AfterBabelLanguage" "{")
+                                ;; 2.2. Accessing language info
+                                ("languagename"       "")
+                                ("iflanguage"         "{{{")
+                                ("localeinfo"         "*{")
+                                ("getlocaleproperty"  "*|{\\{{")
+                                ("localeid"           "*{")
+                                ("ShowLocaleProperties" "{")
+                                ("LocaleForEach"      "")
+                                ;; 2.6. Selection based on BCP 47 tags
+                                ("babeladjust"        "{")
+                                ;; 3.1. Captions
+                                ("setlocalecaption"   "{{{")
+                                ;; 3.3. Language attributes
+                                ("languageattribute"  "{")
+                                ;; 3.6. Hooks
+                                ("AddBabelHook"       "[{{")
+                                ;; 3.7. Manage auxiliary files
+                                ("BabelContentsFiles" "")
+                                ;; 3.8. Code based on the selector
+                                ("IfBabelSelectorTF"  "{")
+                                ;; 4. Creating a language
+                                ("babelprovide"       "[{")
+                                ("babelhyphenation"   "[{")
+                                ("babelhyphen"        "*{")
+                                ;; 5.3. Shorthands – 1. Commands
                                 ("shorthandon"        "{")
                                 ("shorthandoff"       "*{")
                                 ("useshorthands"      "*{")
                                 ("languageshorthands" "{")
                                 ("babelshorthand"     "{")
-                                ("AfterBabelLanguage" "{")
-                                ("babelfont"          "[{[{")
-                                ("babelprovide"       "[{")
-                                ("languagename"       "")
-                                ("iflanguage"         "{{{")
-                                ("babelhyphen"        "*{")
-                                ("babelhyphenation"   "[{")
+                                ;; 5.9. Scripts
                                 ("ensureascii"        "{"))
                               'function)
      (font-latex-add-keywords '(("defineshorthand"    "[{{")
@@ -402,24 +547,13 @@
   (progn
     (TeX-load-style "fontenc")
     (append
+     ;; 2.3. Package options
      `(("KeepShorthandsActive")
-       ("activeacute")
-       ("activegrave")
-       ("shorthands" ("off"))
-       ("safe" ("none" "ref" "bib"))
-       ("math" ("active" "normal"))
-       ("config")
-       ("main" ,LaTeX-babel-language-list)
        ("headfoot" ,LaTeX-babel-language-list)
        ("noconfigs")
-       ("nocase")
-       ("silent")
+       ("config")
        ("showlanguages")
-       ("nocase")
        ("silent")
-       ("strings" ,(append
-                    LaTeX-fontenc-package-options
-                    '("generic" "unicode" "encoded")))
        ("hyphenmap" ("off" "first" "select"
                      "other" "other*"))
        ("bidi" ("default" "basic" "basic-r"
@@ -427,10 +561,21 @@
        ("layout" ("sectioning" "counters" "lists"
                   "contents" "footnotes"  "captions"
                   "columns" "graphics" "extras"))
-       ("provide" ("*"))
-       ("provide+" ("*"))
-       ("provide*" ("*"))
-       ("base"))
+       ("provide"  ("*" "!"))
+       ("provide+" ("*" "!"))
+       ("provide*" ("*" "!"))
+       ("main" ,LaTeX-babel-language-list)
+       ;; 2.4. The baseoption
+       ("base")
+       ;; 5.4. Shorthands - 2. Package options
+       ("activeacute")
+       ("activegrave")
+       ("shorthands" ("off"))
+       ("safe" ("none" "ref" "bib"))
+       ("math" ("active" "normal"))
+       ("strings" ,(append
+                    LaTeX-fontenc-package-options
+                    '("generic" "unicode" "encoded"))))
      (mapcar #'list LaTeX-babel-language-list)))
   "Package options for the babel package.")
 

Reply via email to