@@ -638,13 +638,17 @@ point) to check."
638638 (replace-match (clojure-docstring-fill-prefix))))
639639 (lisp-indent-line )))
640640
641- (defun clojure--symbol-get (function-name property )
641+ (defun clojure--symbol-get (function-name )
642642 " Return the symbol PROPERTY for the symbol named FUNCTION-NAME.
643- FUNCTION-NAME is a string. If it contains a `/' , also try only the part after the `/' ."
644- (or (get (intern-soft function-name) property)
645- (and (string-match " /\\ ([^/]+\\ )\\ '" function-name)
646- (get (intern-soft (match-string 1 function-name))
647- property))))
643+ FUNCTION-NAME is a string. If it contains a `/' , also try only
644+ the part after the `/' ."
645+ (or (get (intern-soft function-name) 'clojure-indent-function )
646+ (get (intern-soft function-name) 'clojure-backtracking-indent )
647+ (when (string-match " /\\ ([^/]+\\ )\\ '" function-name)
648+ (or (get (intern-soft (match-string 1 function-name))
649+ 'clojure-indent-function )
650+ (get (intern-soft (match-string 1 function-name))
651+ 'clojure-backtracking-indent )))))
648652
649653(defun clojure-indent-function (indent-point state )
650654 " When indenting a line within a function call, indent properly.
@@ -666,6 +670,7 @@ The property value can be
666670- a function to call just as this function was called.
667671 If that function returns nil, that means it doesn't specify
668672 the indentation.
673+ - a list, which is used by `clojure-backtracking-indent' .
669674
670675This function also returns nil meaning don't specify the indentation."
671676 (let ((normal-indent (current-column )))
@@ -696,7 +701,7 @@ This function also returns nil meaning don't specify the indentation."
696701 (progn (forward-sexp 1 ) (point ))))
697702 (open-paren (elt state 1 ))
698703 (forward-sexp-function #'clojure-forward-logical-sexp )
699- (method (clojure--symbol-get function 'clojure-indent-function )))
704+ (method (clojure--symbol-get function)))
700705 ; ; Maps, sets, vectors and reader conditionals.
701706 (cond ((or (member (char-after open-paren) '(?\[ ?\{ ))
702707 (ignore-errors
@@ -717,7 +722,7 @@ This function also returns nil meaning don't specify the indentation."
717722 ((integerp method)
718723 (lisp-indent-specform method state
719724 indent-point normal-indent))
720- (method
725+ (( functionp method)
721726 (funcall method indent-point state))
722727 (clojure-use-backtracking-indent
723728 (clojure-backtracking-indent
@@ -737,7 +742,7 @@ move upwards in an sexp to check for contextual indenting."
737742 (when (looking-at " \\ sw\\ |\\ s_" )
738743 (let* ((start (point ))
739744 (fn (buffer-substring start (progn (forward-sexp 1 ) (point ))))
740- (meth (clojure--symbol-get fn 'clojure-backtracking-indent )))
745+ (meth (clojure--symbol-get fn)))
741746 (let ((n 0 ))
742747 (when (< (point ) indent-point)
743748 (condition-case ()
@@ -749,7 +754,8 @@ move upwards in an sexp to check for contextual indenting."
749754 (forward-sexp 1 )))
750755 (error nil )))
751756 (push n path))
752- (when meth
757+ (when (and (listp meth)
758+ (not (functionp meth)))
753759 (let ((def meth))
754760 (dolist (p path)
755761 (if (and (listp def)
@@ -771,17 +777,17 @@ move upwards in an sexp to check for contextual indenting."
771777
772778; ; clojure backtracking indent is experimental and the format for these
773779; ; entries are subject to change
774- (put 'implement 'clojure-backtracking- indent '(4 (2 )))
775- (put 'letfn 'clojure-backtracking- indent '((2 ) 2 ))
776- (put 'proxy 'clojure-backtracking- indent '(4 4 (2 )))
777- (put 'reify 'clojure-backtracking- indent '((2 )))
778- (put 'deftype 'clojure-backtracking- indent '(4 4 (2 )))
779- (put 'defrecord 'clojure-backtracking- indent '(4 4 (2 )))
780- (put 'defprotocol 'clojure-backtracking- indent '(4 (2 )))
781- (put 'extend-type 'clojure-backtracking- indent '(4 (2 )))
782- (put 'extend-protocol 'clojure-backtracking- indent '(4 (2 )))
783- (put 'specify 'clojure-backtracking- indent '(4 (2 )))
784- (put 'specify! 'clojure-backtracking- indent '(4 (2 )))
780+ (put 'implement 'clojure-indent-function '(4 (2 )))
781+ (put 'letfn 'clojure-indent-function '((2 ) 2 ))
782+ (put 'proxy 'clojure-indent-function '(4 4 (2 )))
783+ (put 'reify 'clojure-indent-function '((2 )))
784+ (put 'deftype 'clojure-indent-function '(4 4 (2 )))
785+ (put 'defrecord 'clojure-indent-function '(4 4 (2 )))
786+ (put 'defprotocol 'clojure-indent-function '(4 (2 )))
787+ (put 'extend-type 'clojure-indent-function '(4 (2 )))
788+ (put 'extend-protocol 'clojure-indent-function '(4 (2 )))
789+ (put 'specify 'clojure-indent-function '(4 (2 )))
790+ (put 'specify! 'clojure-indent-function '(4 (2 )))
785791
786792(defun put-clojure-indent (sym indent )
787793 " Instruct `clojure-indent-function' to indent the body of SYM by INDENT."
0 commit comments