From f639b09181c737b3225e1e0f551a0f0e6d235d4d Mon Sep 17 00:00:00 2001 From: Andrea Richiardi Date: Wed, 15 Jun 2016 13:16:39 -0700 Subject: [PATCH] Fix bug when passing lambda to define-clojure-indent, closes #383 --- clojure-mode.el | 6 +++--- test/clojure-mode-indentation-test.el | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/clojure-mode.el b/clojure-mode.el index 9d429c13..8705003a 100644 --- a/clojure-mode.el +++ b/clojure-mode.el @@ -1012,6 +1012,9 @@ Implementation function for `clojure--find-indent-spec'." (when (numberp method) (setq method (list method))) (pcase method + ((pred functionp) + (when (= pos 0) + method)) ((pred sequencep) (pcase (length method) (`0 nil) @@ -1024,9 +1027,6 @@ Implementation function for `clojure--find-indent-spec'." ((or `defun `:defn) (when (= pos 0) :defn)) - ((pred functionp) - (when (= pos 0) - method)) (_ (message "Invalid indent spec for `%s': %s" function method) nil)))))) diff --git a/test/clojure-mode-indentation-test.el b/test/clojure-mode-indentation-test.el index 30659fd1..5c2171df 100644 --- a/test/clojure-mode-indentation-test.el +++ b/test/clojure-mode-indentation-test.el @@ -164,6 +164,17 @@ values of customisable variables." (ala/bala top |one)") +;; we can pass a lambda to explicitely set the column +(put-clojure-indent 'arsymbol (lambda (indent-point state) 0)) + +(check-indentation symbol-with-lambda + " +(arsymbol + |one)" + " +(arsymbol +|one)") + (check-indentation form-with-metadata " (ns ^:doc app.core