abo-abo / lispy

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

Question about 'lispy-tab' (where in the code is it adding a space between '@{}') #530

Open ahungry opened 4 years ago

ahungry commented 4 years ago

Question about 'lispy-tab' (where in the code is it adding a space between '@{}')

Given I have some code such as this (in a .janet file for these purposes, but it'd likely occur in Clojure I think, as the janet work I did was modeled after that):

(var x @{})

When I go to the end and execute 'special-lispy-tab', it seems to adjust it to:

(var x @ {})

(A space after the '@' sign)

Is there a setting to disable this space insertion? If not, could you point me towards the code segment that is inserting it?

ahungry commented 4 years ago

Oh, I found it, it was the logic near clojure-deref-list. If I copy it and add a new entry for clojure-deref-map, all works as I'd expect.

Would this be worth making a PR for? (granted, its likely not a real clojure feature to deref, perhaps true janet support needs to be enabled if willing)

ahungry commented 4 years ago

Since the other janet updates I added were merged in some time ago, I made a PR for this.

Currently the "best fit" (assuming clojure users do not legitimately need a space there - I don't think a floating '@' ever is of use in clojure?) is to just add it in this area, as this replacement table seems to have the concept of clojure and elisp (not a full cond for other langs atm).

Let me know what you think :)

https://github.com/abo-abo/lispy/pull/531

abo-abo commented 4 years ago

I think it's fine to introduce lispy--insert-replace-alist-janet. Please PR if possible.