Modify repeat keys?

Frank Fischer frank.fischer at mathematik.tu-chemnitz.de
Thu Aug 11 16:02:58 CEST 2011


On Thu, Aug 11, 2011 at 03:35:31PM +0200, Vegard Øye wrote:
> On 2011-08-11 14:42 +0200, Frank Fischer wrote:
> 
> > Alternatively one would have to modify the functions
> > `evil-put-property' and `evil-get-property' so they can handle
> > lambda-expressions as well.
> 
> Actually, it is possible to assign command properties to lambda
> functions already. I added this some time ago because I wanted
> to be able to define throwaway commands for testing purposes.
> 
> There are two ways to set command properties for lambda functions:
> 
> (1) Define the lambda function first and then pass it to
>     `evil-add-command-properties'.

Of course, you're right. The tricky thing was that I tested the
following code:

(let ((f '(lambda (x))))
  (evil-add-command-properties f :repeat t)
  (evil-get-command-property f :repeat))

This code returns t the first time it is called but nil all other
times, which confused me. I assume the reason is that add-to-list,
which is used by `evil-put-property', uses equal internally instead of
eq, and so the second time the lambda f is not added to
evil-command-properties (there is already an equal lambda in there).
Perhaps it's better either not to use `add-to-list' (so that non-eq
lambdas are always considered different, also on put, otherwise it
would be impossible to store two different lambdas that happen to be
equal) or to use `assoc'. I think the first one is better.

Frank



More information about the implementations-list mailing list