Skip to content

Commit 8431e0d

Browse files
committed
New variable: clojure-get-indent-function
This variable provides a way of overriding the clojure-indent-function symbol property on a buffer-local basis.
1 parent 25ae34d commit 8431e0d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

clojure-mode.el

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,17 @@ point) to check."
638638
(replace-match (clojure-docstring-fill-prefix))))
639639
(lisp-indent-line)))
640640

641+
(defvar clojure-get-indent-function nil
642+
"Function to get the indent spec of a symbol.
643+
This function should take one argument, the name of the symbol as
644+
a string. This name will be exactly as it appears in the buffer,
645+
so it might start with a namespace alias.
646+
647+
This function is analogous to the `clojure-indent-function'
648+
symbol property, and its return value should match one of the
649+
allowed values of this property. See `clojure-indent-function'
650+
for more information.")
651+
641652
(defun clojure--symbol-get (function-name)
642653
"Return the symbol PROPERTY for the symbol named FUNCTION-NAME.
643654
FUNCTION-NAME is a string. If it contains a `/', also try only
@@ -648,7 +659,9 @@ the part after the `/'."
648659
(or (get (intern-soft (match-string 1 function-name))
649660
'clojure-indent-function)
650661
(get (intern-soft (match-string 1 function-name))
651-
'clojure-backtracking-indent)))))
662+
'clojure-backtracking-indent)))
663+
(when (functionp clojure-get-indent-function)
664+
(funcall clojure-get-indent-function function-name))))
652665

653666
(defun clojure-indent-function (indent-point state)
654667
"When indenting a line within a function call, indent properly.

0 commit comments

Comments
 (0)