@@ -638,6 +638,14 @@ point) to check."
638
638
(replace-match (clojure-docstring-fill-prefix))))
639
639
(lisp-indent-line )))
640
640
641
+ (defun clojure--symbol-get (function-name property )
642
+ " 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))))
648
+
641
649
(defun clojure-indent-function (indent-point state )
642
650
" When indenting a line within a function call, indent properly.
643
651
@@ -687,13 +695,8 @@ This function also returns nil meaning don't specify the indentation."
687
695
(let* ((function (buffer-substring (point )
688
696
(progn (forward-sexp 1 ) (point ))))
689
697
(open-paren (elt state 1 ))
690
- (method nil )
691
698
(forward-sexp-function #'clojure-forward-logical-sexp )
692
- (function-tail (car
693
- (reverse
694
- (split-string (substring-no-properties function) " /" )))))
695
- (setq method (or (get (intern-soft function) 'clojure-indent-function )
696
- (get (intern-soft function-tail) 'clojure-indent-function )))
699
+ (method (clojure--symbol-get function 'clojure-indent-function )))
697
700
; ; Maps, sets, vectors and reader conditionals.
698
701
(cond ((or (member (char-after open-paren) '(?\[ ?\{ ))
699
702
(ignore-errors
@@ -734,15 +737,15 @@ move upwards in an sexp to check for contextual indenting."
734
737
(when (looking-at " \\ sw\\ |\\ s_" )
735
738
(let* ((start (point ))
736
739
(fn (buffer-substring start (progn (forward-sexp 1 ) (point ))))
737
- (meth (get ( intern-soft fn) 'clojure-backtracking-indent )))
740
+ (meth (clojure--symbol- get fn 'clojure-backtracking-indent )))
738
741
(let ((n 0 ))
739
742
(when (< (point ) indent-point)
740
743
(condition-case ()
741
744
(progn
742
745
(forward-sexp 1 )
743
746
(while (< (point ) indent-point)
744
747
(parse-partial-sexp (point ) indent-point 1 t )
745
- (incf n)
748
+ (cl- incf n)
746
749
(forward-sexp 1 )))
747
750
(error nil )))
748
751
(push n path))
@@ -762,7 +765,7 @@ move upwards in an sexp to check for contextual indenting."
762
765
(condition-case ()
763
766
(progn
764
767
(backward-up-list 1 )
765
- (incf depth))
768
+ (cl- incf depth))
766
769
(error (setq depth clojure-max-backtracking)))))
767
770
indent))
768
771
0 commit comments