emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/clojure-mode 222fdafa2a: [Fix #671] Font-lock properly mul


From: ELPA Syncer
Subject: [nongnu] elpa/clojure-mode 222fdafa2a: [Fix #671] Font-lock properly multi-digit lambda args (#672)
Date: Fri, 24 Nov 2023 12:59:17 -0500 (EST)

branch: elpa/clojure-mode
commit 222fdafa2add56a171ded245339a383e5e3078ec
Author: Dave Liepmann <dave.liepmann@gmail.com>
Commit: GitHub <noreply@github.com>

    [Fix #671] Font-lock properly multi-digit lambda args (#672)
---
 CHANGELOG.md                        |  4 ++++
 clojure-mode.el                     |  2 +-
 test/clojure-mode-font-lock-test.el | 13 ++++++++++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 416a855a14..80b0c00b23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
 
 ## master (unreleased)
 
+### Bugs fixed
+
+* [#671](https://github.com/clojure-emacs/clojure-mode/issues/671): Syntax 
highlighting for digits after the first in % args
+
 ## 5.18.1 (2023-11-24)
 
 ### Bugs fixed
diff --git a/clojure-mode.el b/clojure-mode.el
index fba4211501..40fb0924f2 100644
--- a/clojure-mode.el
+++ b/clojure-mode.el
@@ -1058,7 +1058,7 @@ any number of matches of 
`clojure--sym-forbidden-rest-chars'."))
        1 'clojure-character-face)
       ;; lambda arguments - %, %&, %1, %2, etc
       ;; must come after character literals for \% to be handled properly
-      ("\\<%[&1-9]?" (0 font-lock-variable-name-face))
+      ("\\<%[&1-9]*" (0 font-lock-variable-name-face))
       ;; namespace definitions: (ns foo.bar)
       (,(concat "(\\<ns\\>[ \r\n\t]*"
                 ;; Possibly metadata, shorthand and/or longhand
diff --git a/test/clojure-mode-font-lock-test.el 
b/test/clojure-mode-font-lock-test.el
index 5e578ba13d..e25fb571fd 100644
--- a/test/clojure-mode-font-lock-test.el
+++ b/test/clojure-mode-font-lock-test.el
@@ -901,13 +901,24 @@ DESCRIPTION is the description of the spec."
      (2 3 font-lock-keyword-face)
      ( 5 7 font-lock-function-name-face)))
 
-  (when-fontifying-it "should handle lambda-params"
+  (when-fontifying-it "should handle lambda-params %, %1, %n..."
     ("#(+ % %2 %3 %&)"
      (5 5 font-lock-variable-name-face)
      (7 8 font-lock-variable-name-face)
      (10 11 font-lock-variable-name-face)
      (13 14 font-lock-variable-name-face)))
 
+  (when-fontifying-it "should handle multi-digit lambda-params"
+    ;; % args with >1 digit are rare and unidiomatic but legal up to
+    ;; `MAX_POSITIONAL_ARITY` in Clojure's compiler, which as of today is 20
+    ("#(* %10 %15 %19 %20)"
+     ;; it would be better if this were just `font-lock-variable-name-face` but
+     ;; it seems to work as-is
+     (5 7   various-faces)
+     (9 11  font-lock-variable-name-face)
+     (13 15 font-lock-variable-name-face)
+     (17 19 various-faces)))
+
   (when-fontifying-it "should handle nils"
     ("(= nil x)"
      (4 6 font-lock-constant-face))



reply via email to

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