Description
While working on #670 I noticed that syntax highlighting for %<n>
args does not match Clojure reader syntax or behavior.
Disclaimer: I acknowledge that %15
is unidiomatic and this is an insignificant corner case that shouldn't arise in 99.999% of Clojure programming. Nevertheless I'm reporting it because it's a clear bug.
Expected behavior
Reader-legal numbered percent-style parameters %1
, %2
...%n
to shorthand-syntax anonymous functions #()
should be syntax-highlighted.
Actual behavior
Only the first digit of %<n>
anonymous functions #()
parameters is syntax-highlighted. Additional digits are not. So %1
, %2
, ... %9
work, but %10
and further display incorrectly.

Steps to reproduce the problem
It is legal Clojure to provide up to MAX_POSITIONAL_ARITY
args, per Compiler.java. More than that throws an exception "Can't specify more than 20 params". This matches observed behavior, which clearly supports up to %20
:
(apply #(max %1 %10 %20)
(take 20 (range)))
;; => 19
(apply #(max %1 %10 %21)
(take 21 (range)))
;; => syntax error: Can't specify more than 20 params

(I don't think it's important or necessarily our job to distinguish between functional % args and syntax-legal ones, especially since the limit is parameterized (see below), so I say we fix %999
as well as %19
.)
Environment & Version information
clojure-mode version
clojure-mode (version 5.18.0)
Emacs version
28.2
Operating system
macOS 13.5