Contextual modes for operators.

Andreas Liljeqvist bonega at gmail.com
Wed Aug 15 20:13:45 CEST 2012


Hi, recently I have done a merge request for my nrepl-branch:
https://gitorious.org/evil/evil/merge_requests/33

That got me thinking, we should really have a system for providing
mode-specific operators or motions.
Of course one could just say that the end user just have to redefine the
associated function, but I think we could do better.

Dispatch on major-mode and on optional list of minor-modes.
I think many of the operations can be a simple dispatch on "(eq type
'line)".
Then doing a eventual modification on the beg-end area.

I am not really familiar with elisp though, what are the equivalence of
multimethods as found in clojure for example?

We can do context aware stuff like:

"cW" stopping in the case of structure(parenthesis etc) when in lispy-modes.
"gd" Using whatever we have available for definition.
"i" Going to the first available actual input-area. (mostly for repls)

I would leave visual selection as is.
All this can be done inline in the relevant function, but the core quickly
gets messy, so I would like the code to reside in evil-integration.el
Also the end user should be able to easy define a code path for their mode
without copy-pasting the original function.

This would be a bit of work though, but I would like if Evil could offer
sane operators for many frequently used modes.

I would like some feedback before I start hacking on this, since I have
very limited experience with both elisp and evil.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ourproject.org/pipermail/implementations-list/attachments/20120815/91897db4/attachment.htm 


More information about the implementations-list mailing list