drym-org / symex.el

An intuitive way to edit Lisp symbolic expressions ("symexes") structurally in Emacs
Other
271 stars 22 forks source link

Make spatial orientation (up/down vs left/right) customizable #49

Open hxegon opened 2 years ago

hxegon commented 2 years ago

Hi, just starting to use symex now. Tried pretty much every other structural editing plugin (parinfer, paredit, lispy/ville, smartparens, etc) and I'm liking this one a lot so far. Seems to really fit into evil mode a lot more naturally by being a state you can trigger from everywhere that doesn't interfere with anything else :)

Perhaps there's a good reason for this, but it seems like if this is supposed to be somewhat 'vim-ey' navigation wise, except with the AST. If symex is supposed to be tree navigation, then I'd think going 'up' the tree would mean toward the root node. the default binding functions for j and k are specifically name with up and down, but bound in the opposite directions of vim.

Not a huge issue as these are easy to rebind, but wondering if the defaults could be better.

hxegon commented 2 years ago

Realizing this might be an issue with the function names rather than the keys their bound to. Going to close this issue, maybe reopen it at some point with other binding suggestions once I have more time with symex under my belt.

tommy-mor commented 2 years ago

I agree with your intuition about up and down. I switched/(rotated?) my keybinds to have h go towards the root node. maybe we have both keybinds layouts supported? or at least have a diagram with arrows that gives intuition for directions

hxegon commented 2 years ago

Hmm... I'm wondering if there should be a var for this with options for root as up, root as down, and root as left. another thing I was thinking about, technically the way the files are structured, the root can be thought of as up an indent level which is thought about from left->right. so left would be toward the root in that case, swapping the intentions of jk and hl. Might make a PR for this myself if I have some time.

countvajhula commented 2 years ago

Having it be configurable as a defcustom is a great idea @hxegon . I've gone ahead and reopened/renamed this issue to reflect this. PRs are of course appreciated, if you feel inspired and once you're more familiar 🙂

Re: the default, you may be right that that flipping up/down as the default would be the most common expectation. On the basis of the principle of least surprise, I would not be opposed to changing the default when the defcustom is introduced.

hxegon commented 2 years ago

Tried out the "left as up" paradigm, yuck. I'm a bit busy rn (and still trying to get my bindings / workflow comfy) but I'll see if I can get to this in about a month

hxegon commented 2 years ago

Nvm, nice job dalanicolai