auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] Changes to auctex/font-latex.el


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/font-latex.el
Date: Sun, 05 Jun 2005 10:05:11 -0400

Index: auctex/font-latex.el
diff -u auctex/font-latex.el:5.121 auctex/font-latex.el:5.122
--- auctex/font-latex.el:5.121  Sun Jun  5 13:59:10 2005
+++ auctex/font-latex.el        Sun Jun  5 14:05:11 2005
@@ -347,6 +347,40 @@
 list but puts a conditional into the keyword highlighter which
 tests for `font-latex-fontify-sectioning'.")
 
+(defcustom font-latex-deactivated-keyword-classes nil
+  "List of strings for built-in keyword classes to be deactivated.
+
+Valid entries are \"warning\", \"variable\", \"reference\",
+\"function\" , \"sectioning-0\", \"sectioning-1\", \"sectioning-2\",
+\"sectioning-3\", \"sectioning-4\", \"sectioning-5\", \"textual\",
+\"bold-command\", \"italic-command\", \"math-command\", \"type-command\",
+\"bold-declaration\", \"italic-declaration\", \"type-declaration\".
+
+You have to restart Emacs for a change of this variable to take effect."
+  :group 'font-latex-keywords
+  :type `(set ,@(mapcar
+                (lambda (spec)
+                  `(const :tag ,(concat
+                                 ;; Name of the keyword class
+                                 (let ((name (split-string (car spec) "-")))
+                                   (setcar name (capitalize (car name)))
+                                   (mapconcat 'identity name " "))
+                                 " keywords in `"
+                                 ;; Name of the face
+                                 (symbol-name (nth 2 spec)) "'.\n"
+                                 ;; List of keywords
+                                 (with-temp-buffer
+                                   (insert "  Keywords: "
+                                           ;; Better idea than `s-q-a' for
+                                           ;; preserving "\\" and "\\*"?
+                                           (mapconcat 'shell-quote-argument
+                                                      (nth 1 spec) ", "))
+                                   (fill-paragraph nil)
+                                   (buffer-substring-no-properties
+                                    (point-min) (point-max))))
+                          ,(car spec)))
+                font-latex-built-in-keyword-classes)))
+
 (defun font-latex-make-match-defun (prefix name type)
   "Return a function definition for keyword matching.
 The variable holding the keywords to match are determined by the
@@ -419,20 +453,19 @@
 
 (defun font-latex-make-built-in-keywords ()
   "Build defuns, defvars and defcustoms for built-in keyword fontification."
-  (let ((keyword-specs font-latex-built-in-keyword-classes))
-    (dolist (item keyword-specs)
-      (let ((prefix "font-latex-match-")
-           (name (nth 0 item))
-           (keywords (nth 1 item))
-           (face (nth 2 item))
-           (level (nth 3 item))
-           (type (nth 4 item)))
-
-       ;; defvar font-latex-match-*-keywords-local
-       (eval `(defvar ,(intern (concat prefix name "-keywords-local"))
-                ',keywords
-                ,(concat "Buffer-local keywords to add to `"
-                         prefix name "-keywords'.
+  (dolist (item font-latex-built-in-keyword-classes)
+    (let ((prefix "font-latex-match-")
+         (name (nth 0 item))
+         (keywords (nth 1 item))
+         (face (nth 2 item))
+         (level (nth 3 item))
+         (type (nth 4 item)))
+
+      ;; defvar font-latex-match-*-keywords-local
+      (eval `(defvar ,(intern (concat prefix name "-keywords-local"))
+              ',keywords
+              ,(concat "Buffer-local keywords to add to `"
+                       prefix name "-keywords'.
 This must be a list of keyword strings \(not regular expressions\) omitting
 the leading backslash.  It will get transformed into a regexp using
 `" prefix name "-make'.  This variable is not for end users; they
@@ -445,24 +478,26 @@
  (" prefix name "-make)
 
 Generated by `font-latex-make-built-in-keywords'.")))
-       (eval `(make-variable-buffer-local
-               ',(intern (concat prefix name "-keywords-local"))))
+      (eval `(make-variable-buffer-local
+             ',(intern (concat prefix name "-keywords-local"))))
 
-       ;; defun font-latex-match-*-make
-       ;; Note: The functions are byte-compiled at the end of font-latex.el.
-       (eval `(defun ,(intern (concat prefix name "-make")) ()
-                ,(concat "Make or remake the variable `" prefix name "'.
+      ;; defun font-latex-match-*-make
+      ;; Note: The functions are byte-compiled at the end of font-latex.el.
+      (eval `(defun ,(intern (concat prefix name "-make")) ()
+              ,(concat "Make or remake the variable `" prefix name "'.
 
 Generated by `font-latex-make-built-in-keywords'.")
-                (let ((keywords
-                       (append
-                        ,(intern (concat prefix name "-keywords-local"))
-                        ,(intern (concat prefix name "-keywords"))))
-                      multi-char-macros single-char-macros)
-                  (dolist (elt keywords)
-                    (if (string-match "^[A-Za-z]" elt)
-                        (add-to-list 'multi-char-macros elt)
-                      (add-to-list 'single-char-macros elt)))
+              (let ((keywords
+                     (append
+                      (unless (member ,name
+                                      font-latex-deactivated-keyword-classes)
+                        ,(intern (concat prefix name "-keywords-local")))
+                      ,(intern (concat prefix name "-keywords"))))
+                    multi-char-macros single-char-macros)
+                (dolist (elt keywords)
+                  (if (string-match "^[A-Za-z]" elt)
+                      (add-to-list 'multi-char-macros elt)
+                    (add-to-list 'single-char-macros elt)))
                 (setq ,(intern (concat prefix name))
                       (concat
                        "\\\\\\("
@@ -475,39 +510,40 @@
                           "\\(?:" (regexp-opt single-char-macros) "\\)"))
                        "\\)")))))
 
-       ;; defcustom font-latex-match-*-keywords
-       (eval `(defcustom ,(intern (concat prefix name "-keywords")) nil
-                ,(concat "List of keyword strings for " name " face.
+      ;; defcustom font-latex-match-*-keywords
+      (eval `(defcustom ,(intern (concat prefix name "-keywords")) nil
+              ,(concat "List of keyword strings for " name " face.
 Each string has to be the name of a macro omitting the leading backslash.
 
 Setting this variable directly does not take effect;
 restart Emacs.
 
 Generated by `font-latex-make-built-in-keywords'.")
-                :type '(repeat (string :tag "Keyword"))
-                :set (lambda (symbol value)
-                       (set-default symbol value)
-                       (funcall ',(intern (concat prefix name "-make"))))
-                :group 'font-latex-keywords))
-
-       ;; defvar font-latex-match-*
-       (eval `(defvar ,(intern (concat prefix name))
-                ,(intern (concat prefix name "-keywords"))))
-       (eval `(make-variable-buffer-local
-               ',(intern (concat prefix name))))
-
-       ;; defun font-latex-match-*
-       (font-latex-make-match-defun prefix name type)
-
-       ;; Add matchers and highlighters to `font-latex-keywords-{1,2}'.
-       (let ((keywords-entry (font-latex-keyword-matcher prefix name face
-                              (if (listp type) (car type) type))))
-         (add-to-list (intern (concat "font-latex-keywords-"
-                                      (number-to-string level)))
-                      keywords-entry t)
-         (when (= level 1)
-           (add-to-list (intern (concat "font-latex-keywords-2"))
-                        keywords-entry t)))))))
+              :type '(repeat (string :tag "Keyword"))
+              :set (lambda (symbol value)
+                     (set-default symbol value)
+                     (funcall ',(intern (concat prefix name "-make"))))
+              :group 'font-latex-keywords))
+
+      ;; defvar font-latex-match-*
+      (eval `(defvar ,(intern (concat prefix name))
+              ,(intern (concat prefix name "-keywords"))))
+      (eval `(make-variable-buffer-local
+             ',(intern (concat prefix name))))
+
+      ;; defun font-latex-match-*
+      (font-latex-make-match-defun prefix name type)
+
+      ;; Add matchers and highlighters to `font-latex-keywords-{1,2}'.
+      (let ((keywords-entry (font-latex-keyword-matcher
+                            prefix name face
+                            (if (listp type) (car type) type))))
+       (add-to-list (intern (concat "font-latex-keywords-"
+                                    (number-to-string level)))
+                    keywords-entry t)
+       (when (= level 1)
+         (add-to-list (intern (concat "font-latex-keywords-2"))
+                      keywords-entry t))))))
 (font-latex-make-built-in-keywords)
 
 (defcustom font-latex-user-keyword-classes nil




reply via email to

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