[vial-devel] darcs patch: normal mode commands, cc, c<motion>, s, S, -, +, J, X

Brad Beveridge brad.beveridge at gmail.com
Mon Oct 23 20:50:13 UTC 2006


>  I think that reusing commands inside other commands is ugly too, I'm
> correcting some of those ugly things now.
> I did it to avoid code repetition though.
> I also noticed that there are some patterns in the commands code that we
> could try to avoid, i.e:
> (defun command-function (args) body) (define-pattern ...#' command-function
> ...)
> This one could be better expressed with a macro that outputs those two
> forms, maybe something like
>
> (define-command command-function (args)
>    (body)
>    (<arguments for define-pattern, without the
> #'command-function))
Once upon a time I actually did have code like that, but a lot of what
the commands do are generally useful primitive functions, such as
moving the cursor forward.  In that case the current method is
probably better because the function to call already exists.  For now
I'd like to keep it the same.  Infact, one of the things I thought
about doing was splitting key-normal, so that the (DEFINE-PATTERN ...)
forms are in a file by themselves, to make it less cluttered.

> also we could then specialize this macro, to avoid the pattern
> (defun command-function2 (args)
>   (active-register-needs-updating)
>   body)
I can't remember exactly what active-register-needs-updating does, so
that is a sign that function needs work, possible it ought to become a
macro like
(with-deletes-saved-to-active-register
  ... body ....)


> (define-bindings
>   (*join-lines-command-binding* "J")
>   (*change-single-line-from-active-binding* "cc")
>    .....)
> This would make changing actual bindings clearer I think. Also I think that
> surely there's a better way to do something like this than "defining a bunch
> of variables", but I'm a noob and now i
> thought of it as a simple method =)
Hmm, I don't understand what you mean exactly here, but just looking
at the code I don't really like the way it sits on the page :)  I'm
not sure why we need the global vars.

> We also have a bunch of commands that go into insert-mode, thus creating the
> pattern
> (defun foo (args)
>    body
>    (enter-insert-mode))
> so.... what about erasing this pattern too?
This could be worth changing, any ideas about what the new pattern
should look like?

BTW, it's nice to have somebody to chat with about Vial - please don't
think that I am being too harsh about your ideas.  I am very open to
doing things different ways, but I might need convincing sometimes :)

Cheers
Brad



More information about the Vial-devel mailing list