[phemlock-devel] hemlock clone on gitorious

Nikodemus Siivola nikodemus at random-state.net
Sun Mar 14 13:56:44 UTC 2010


On 1 January 2010 16:45, David Lichteblau <david at lichteblau.com> wrote:

>  - Although I have merged bbea34ea including the "Pull out and export
>    HEMLOCK:GOTO-BUFFER-START" change, I'm inclined to propose a
>    different plan:
>
>    Hemlock commands are already callable as ordinary Lisp functions,
>    i.e.  the function beginning-of-buffer-command already exists, and
>    I think GNU Emacs got it right when it made the distinction between
>    commands and functions as small as possible: Commands _should_ be
>    called in other Lisp code whenever it makes sense  -- or to describe
>    it in the opposite way: It's okay to take Lisp API functions and
>    turn them into commands.
>
>    So the steps are:
>      1. change defcommand so that it doesn't append -COMMAND to the
>         function name.
>      2. As a convention, write &optional prefix for such functions, so
>         callers don't have to supply a prefix where none is needed.
>         (And keep your change to declare it ignorable automatically.)
>      3. (optionally) change the name of commands as stated in the code
>         from strings to symbols.  DEFCOMMAND would still define the
>         space-separated command name in the command table, so this
>         change would not be end-user-visible.  But C-c C-w C-c would
>         work no the command name, etc.
>
>    As a result, the function would be called beginning-of-buffer
>    (rather than goto-buffer-start), just like the command is already
>    called.  GNU Emacs has the same name, which is a plus.

I made some steps in this direction.

  http://gitorious.org/~nikodemus/hemlock/nikodemus-hemlock/commits/defcommand-hax

Basically:

1. Existing DEFCOMMAND forms work just like they used to, and append
-COMMAND to names to avoid need for wholesale renaming.

2. (defcommand ("My Foo" my-foo) ...) uses MY-FOO as the function name.

3. DEFCOMMAND also accepts empty lambda-lists, taking them to mean
(&OPTIONAL #:PREFIX). IMO this leads to easier to read command when
they don't use prefix arguments.

I also went over some exiting commands and made them use the new-style
naming: FORWARD-CHARACTER, BEGINNING-OF-BUFFER, etc.

Let me know how this looks,

 -- Nikodemus




More information about the phemlock-devel mailing list