abo-abo / lispy

Short and sweet LISP editing
http://oremacs.com/lispy/
1.2k stars 130 forks source link

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

Open rgkirch opened 3 years ago

rgkirch commented 3 years ago

#(+ %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

Andre0991 commented 3 years ago

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

Andre0991 commented 3 years ago

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.

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

rgkirch commented 3 years ago

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

Andre0991 commented 3 years ago

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)
rgkirch commented 3 years ago

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.