drym-org / symex.el

An intuitive way to edit Lisp symbolic expressions ("symexes") structurally in Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove hard dependency on undo-tree?

devcarbon-com opened this issue · comments

Seems only to be included for assigning the key-bind.

I really like corkey's idea of signals, which decouple conceptual operations (e.g. "eval current form") from concrete and mode-specific implementations.

There is a lightweight (57 sloc) package around this idea here:
https://github.com/lilactown/kitten/blob/main/lisp/reflex.el

that let's you write code like this:

binding keys to signals:
https://github.com/lilactown/kitten/blob/main/user/keybinds.el#L91-L112

providing functionality to the signals for a given mode:
https://github.com/lilactown/kitten/blob/main/modules/kitten-clojure.el#L40-L57

@devcarbon-com I think your PR #64 closes this issue, right? Re: "signals" above, that's interesting and it sounds like a more general discussion not specific to undo-tree, so if you think we should consider this pattern more broadly for Symex, mind creating it as a separate issue?

Correct on both accounts.

With regard to "signals", I feel like the biggest application would be in your "mode-mode" (I forget what that was called at the moment).

When it comes to Symex, it could be utilized here as well I reckon, although I will need to spend some more time before I could make a detailed separate issue for it.

Off the top of my head, though, it would probably simplify the dispatch for things like symex-eval. Also, it would allow for symex to have all the triggers/signals ready for other package features, but let that decision live in the end-users config, instead of being a hard requirement.

For undo tree, for example, let's pretend you wanted to a key in your hydra for undo-tree-visualize, you could bind to the signal. Then the end user could have in their config:

(reflex/provide-signals
  global-map
  (:editor/visualize-undo-tree undo-tree-visualize)

But then say there are users that prefer vundo. All they need to do is swap out the signal binding in their own config:

(reflex/provide-signals
  global-map
  (:editor/visualize-undo-tree vundo)

edit: moved conversation to #65 .