[Top][All Lists]

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

[AUCTeX-devel] Fontification for + after macro names

From: Arash Esbati
Subject: [AUCTeX-devel] Fontification for + after macro names
Date: Wed, 19 Apr 2017 17:49:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2

Hi all,

fontspec.sty has a macro:

    \defaultfontfeatures+[<font name>]{<font features>}

which appends <font features> to any already-selected defaults.  I think
I can make font-latex.el support fontification of `+' with a small

--8<---------------cut here---------------start------------->8---
diff --git a/font-latex.el b/font-latex.el
index e1c8e555..60fc5515 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1614,9 +1614,10 @@ Returns nil if none of KEYWORDS is found."
               (parse-sexp-ignore-comments t)) ; scan-sexps ignores comments
          (goto-char (match-end 0))
          ;; Check for starred macro if first spec is an asterisk.
-         (when (eq (car spec-list) ?*)
+         (when (or (eq (car spec-list) ?*)
+                   (eq (car spec-list) ?+))
            (setq spec-list (cdr spec-list))
-           (skip-chars-forward "*" (1+ (point))))
+           (skip-chars-forward "*+" (1+ (point))))
          ;; Add current point to match data and use keyword face for
          ;; region from start to point.
          (nconc match-data (list (point)))
@@ -1643,7 +1644,7 @@ Returns nil if none of KEYWORDS is found."
                                     (if (zerop (skip-syntax-forward "_w"))
                                         (forward-char) ; Single-char macro.
-                                      (skip-chars-forward "*"))
+                                      (skip-chars-forward "*+"))
                      (nconc font-latex-matched-faces (list face))
                      (setq end (max end (point)))
--8<---------------cut here---------------end--------------->8---

The result looks like this:

Attachment: x.png
Description: PNG image

It is just a hack to make it work and the right way would be probably to
define a variable instead of hard-coded "*+".  Can others please try
this or give a me hint if I'm missing something?

TIA, Arash

reply via email to

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