Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion clojure-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion test/clojure-mode-font-lock-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down