lispy icon indicating copy to clipboard operation
lispy copied to clipboard

special-lispy-tab breaks clojure anonymous/lamda function with multiple arguments

Open rgkirch opened this issue 4 years ago • 5 comments

#(+ %1 %2) indented with special-lispy-tab or i gives #(+ % 1 % 2) which is not the same...

(#(+ %1 %2) 1 2) gives 3 while (#(+ % 1 % 2) 1 2) gives 5

rgkirch avatar Apr 04 '21 15:04 rgkirch

Consider using clojure-align instead (with a custom binding or with a wrapper around lispy-tab).

Andre0991 avatar Apr 04 '21 21:04 Andre0991

Oh, just realized that lispy already calls clojure-align. Personally, I don't miss the other features from this command [1] so I'd just use the clojure one. [1]: http://oremacs.com/lispy/#lispy-tab

EDIT: it only calls clojure-align is some specific clojure-mode opt is enabled.

Andre0991 avatar Apr 04 '21 21:04 Andre0991

Ok, thanks. That helps since I didn't know about clojure-align but I'm not sure how to turn that into a solution.

rgkirch avatar Apr 05 '21 00:04 rgkirch

Here's some untested code that might help:

(defun my-lispy-tab ()
(interactive)
   (if (memq major-mode lispy-clojure-modes)
       (call-interactively 'clojure-align)
     (call-interactively 'lispy-tab)))
 (lispy-define-key lispy-mode-map "i" 'my-lispy-tab)

Andre0991 avatar Apr 06 '21 01:04 Andre0991

Thanks for this! I think it's like you said; this leaves out some features but I'm happy so far and I've put it in my init.el.

rgkirch avatar Apr 08 '21 13:04 rgkirch