Skip to content

Commit 6fbc706

Browse files
committed
Refactor clojure-indent-function a bit
1 parent 1c5f3fb commit 6fbc706

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

clojure-mode.el

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,16 +1038,21 @@ This function also returns nil meaning don't specify the indentation."
10381038
(+ lisp-body-indent containing-form-column))
10391039
((pred functionp)
10401040
(funcall method indent-point state))
1041-
((and `nil
1042-
(guard (let ((function (thing-at-point 'sexp)))
1043-
(or (and clojure-defun-style-default-indent
1044-
;; largely to preserve useful alignment of :require, etc in ns
1045-
(not (string-match "^:" function)))
1046-
(and (string-match "\\`\\(?:\\S +/\\)?\\(def[a-z]*\\|with-\\)"
1047-
function)
1048-
(not (string-match "\\`default" (match-string 1 function))))))))
1049-
(+ lisp-body-indent containing-form-column))
1050-
(_ (clojure--normal-indent calculate-lisp-indent-last-sexp))))))
1041+
;; No indent spec, do the default.
1042+
(`nil
1043+
(let ((function (thing-at-point 'symbol)))
1044+
(cond
1045+
;; largely to preserve useful alignment of :require, etc in ns
1046+
((and function (string-match "^:" function))
1047+
(let ((clojure-defun-style-default-indent nil))
1048+
(clojure--normal-indent calculate-lisp-indent-last-sexp)))
1049+
((or clojure-defun-style-default-indent
1050+
(and function
1051+
(string-match "\\`\\(?:\\S +/\\)?\\(def[a-z]*\\|with-\\)"
1052+
function)
1053+
(not (string-match "\\`default" (match-string 1 function)))))
1054+
(+ lisp-body-indent containing-form-column))
1055+
(t (clojure--normal-indent calculate-lisp-indent-last-sexp)))))))))
10511056

10521057
;;; Setting indentation
10531058
(defun put-clojure-indent (sym indent)

0 commit comments

Comments
 (0)