File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,44 @@ values of customisable variables."
298298 " (msg' 1
299299 10)" )
300300
301+
302+ (defun indent-cond (indent-point state )
303+ (goto-char (elt state 1 ))
304+ (let ((pos -1 )
305+ (base-col (current-column )))
306+ (forward-char 1 )
307+ ; ; `forward-sexp' will error if indent-point is after
308+ ; ; the last sexp in the current sexp.
309+ (condition-case nil
310+ (while (and (<= (point ) indent-point)
311+ (not (eobp )))
312+ (clojure-forward-logical-sexp 1 )
313+ (cl-incf pos))
314+ ; ; If indent-point is _after_ the last sexp in the
315+ ; ; current sexp, we detect that by catching the
316+ ; ; `scan-error' . In that case, we should return the
317+ ; ; indentation as if there were an extra sexp at point.
318+ (scan-error (cl-incf pos)))
319+ (+ base-col (if (evenp pos) 0 2 ))))
320+ (put-clojure-indent 'test-cond #'indent-cond )
321+
322+ (defun indent-cond-0 (_indent-point _state ) 0 )
323+ (put-clojure-indent 'test-cond-0 #'indent-cond-0 )
324+
325+ (def-full-indent-test function-spec
326+ " (when me
327+ (test-cond
328+ x
329+ 1
330+ 2
331+ 3))"
332+ " (when me
333+ (test-cond-0
334+ x
335+ 1
336+ 2
337+ 3))" )
338+
301339
302340; ;; Misc
303341
You can’t perform that action at this time.
0 commit comments