auctex-diffs
[Top][All Lists]
Advanced

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

master cb7b4422: Improve fontification of indexing macros


From: Arash Esbati
Subject: master cb7b4422: Improve fontification of indexing macros
Date: Wed, 9 Nov 2022 14:45:04 -0500 (EST)

branch: master
commit cb7b44227d23366996fa94c1ffe19208add6c127
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    Improve fontification of indexing macros
    
    * font-latex.el (font-latex-built-in-keyword-classes): Add entries
    for \makeindex and \makeglossary macros.
    
    * style/imakeidx.el ("imakeidx"):
    * style/makeidx.el ("makeidx"):
    * style/multind.el ("multind"):
    * style/splitidx.el ("splitidx"): Improve fontification of
    indexing macros.
---
 font-latex.el     |  2 +-
 style/imakeidx.el | 23 ++++++++++++++++++++---
 style/makeidx.el  | 17 ++++++++++++++---
 style/multind.el  | 20 +++++++++++++++++---
 style/splitidx.el |  2 ++
 5 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/font-latex.el b/font-latex.el
index 52c0fca1..4067564d 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -378,7 +378,7 @@ variable `font-latex-fontify-sectioning'." ',num)
       ("TeX" "") ("LaTeX" "") ("LaTeXe" "")
       ("normalfont" "") ("normalshape" "")
       ("tableofcontents" "") ("listoffigures" "") ("listoftables" "")
-      ("maketitle" ""))
+      ("maketitle" "") ("makeindex" "") ("makeglossary" ""))
      font-lock-function-name-face 2 command)
     ("sectioning-0"
      (("part" "*[{"))
diff --git a/style/imakeidx.el b/style/imakeidx.el
index 325631ef..ef434137 100644
--- a/style/imakeidx.el
+++ b/style/imakeidx.el
@@ -1,6 +1,6 @@
 ;;; imakeidx.el --- AUCTeX style for `imakeidx.sty'.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2012-2013, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2022 Free Software Foundation, Inc.
 
 ;; Maintainer: auctex-devel@gnu.org
 ;; Author: Mosè Giordano <giordano.mose@libero.it>
@@ -29,6 +29,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
 (require 'tex)
 (require 'latex)
 
@@ -65,7 +70,7 @@
                    '(("headers")))))
 
    (TeX-add-symbols
-    '("makeindex" [ (TeX-arg-key-val LaTeX-imakeidx-makeindex-options) ])
+    '("makeindex" [TeX-arg-key-val LaTeX-imakeidx-makeindex-options])
     '("indexsetup" (TeX-arg-key-val LaTeX-imakeidx-indexsetup-options))
     '("splitindexoptions" "Command line option")
     '("index" [ "Index name" ] TeX-arg-index)
@@ -92,7 +97,19 @@
           '(("|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)))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("makeindex"         "[")
+                                ("indexsetup"        "{")
+                                ("splitindexoptions" "{")
+                                ("indexprologue"     "[{")
+                                ("printindex"        "["))
+                              'function)
+     (font-latex-add-keywords '(("index" "[{"))
+                              'reference)))
  TeX-dialect)
 
 (defvar LaTeX-imakeidx-package-options
diff --git a/style/makeidx.el b/style/makeidx.el
index 4fe7ce46..658094c3 100644
--- a/style/makeidx.el
+++ b/style/makeidx.el
@@ -1,6 +1,6 @@
 ;;; makeidx.el --- AUCTeX support for makeidx.sty  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2020, 2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
 ;; Maintainer: auctex-devel@gnu.org
@@ -24,13 +24,18 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
 (require 'tex)
 
 (TeX-add-style-hook
  "makeidx"
  (lambda ()
    (TeX-add-symbols
-    "printindex" "indexspace")
+    "printindex")
 
    ;; Parsing the default index macro is defined in latex.el
    ;; The same is true form completion in the index macro
@@ -43,7 +48,13 @@
 
    ;; RefTeX support
    (and (fboundp 'reftex-add-index-macros)
-        (reftex-add-index-macros '(default))))
+        (reftex-add-index-macros '(default)))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("printindex" ""))
+                              'function)))
  TeX-dialect)
 
 (defvar LaTeX-makeidx-package-options nil
diff --git a/style/multind.el b/style/multind.el
index 68a4ab6a..b3ced132 100644
--- a/style/multind.el
+++ b/style/multind.el
@@ -1,6 +1,6 @@
 ;;; multind.el --- AUCTeX support for multiple indices with multind.sty.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1999, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 1999--2022 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
 ;; Maintainer: auctex-devel@gnu.org
@@ -24,6 +24,11 @@
 
 ;;; Code:
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                  "font-latex"
+                  (keywords class))
+
 (require 'tex)
 (require 'latex)
 
@@ -36,7 +41,7 @@
     '("makeindex" "Indextag")
     '("index" TeX-arg-index-tag TeX-arg-index)
     '("printindex" TeX-arg-index-tag "Title")
-    "printindex" "indexspace")
+    "indexspace")
 
    ;; Parsing index macros
    (setq LaTeX-auto-regexp-list
@@ -57,7 +62,16 @@
 
    ;; RefTeX support
    (and (fboundp 'reftex-add-index-macros)
-        (reftex-add-index-macros '(multind))))
+        (reftex-add-index-macros '(multind)))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("makeindex"  "{")
+                                ("printindex" "{{"))
+                              'function)
+     (font-latex-add-keywords '(("index" "{{"))
+                              'reference)))
  TeX-dialect)
 
 (defvar LaTeX-multind-package-options nil
diff --git a/style/splitidx.el b/style/splitidx.el
index a638a8d4..37d36be6 100644
--- a/style/splitidx.el
+++ b/style/splitidx.el
@@ -281,6 +281,8 @@
                                 ("AtWriteToIndex"     "{{")
                                 ("AtNextWriteToIndex" "{{")
                                 ("newprotectedindex"  "[{")
+                                ("printindex"         "*[[")
+                                ("printsubindex"      "*[[")
                                 ("setindexpreamble"   "[{")
                                 ("useindexpreamble"   "[")
                                 ("extendtheindex"     "{{{{"))



reply via email to

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