On 2011-02-28 14:09 +0100, Frank Fischer wrote:
The more I think about it I wonder if this is really the right idea using the full power of interactive. One could easily use custom interactive statements with lisp expressions like
(interactive (list (region-beginning) (region-end) (vimu:current-motion-type) (vimu:current-motion-register)))
(or similar) to provide all the required information. I think this would fit nicely into the usual Emacs commands and provides the additional information for vimu and they can be called non-interactively as any other function. Of course we can hide this rather complicate interactive statements behind some macros. I think this could solve all issues I mentioned in the last post and should be a good compromise.
Sounds good to me.
The other question that comes into my mind is the following. In vim-mode, as I told, I prevent an operator to be executed until the following motion has been executed. This can be done as above if the interactive form uses some kind of recursive edit (right?).
I don't understand ... the motion is executed in the operator's `interactive' specification, /before/ the operator's body. When you press "dw", "d" calls `delete', `delete' reads "w", "w" is bound to `forward-word', `forward-word' is executed to get buffer positions, and the positions are passed to the operator's arguments. Then the operator's body is executed. Are we talking about the same thing?
And I have a further question. We must certainly specify some additional properties for commands, e.g., some commands are repeatable while others are not repeatable, some should preserve visual-mode (e.g., several window and scrolling commands which are not really motions - they cannot be used with an operator and sometimes don't even change point) while others disable visual-mode (most editing commands). How do we specify theses properties?
I prefer to use keyword arguments: (vimpulse-define-operator vimpulse-indent (beg end) "Indent text." :repeat nil :whole-lines t (indent-region beg end nil)) These determine how the operator is defined. -- Vegard