Confused by what command is "dot repeatable"

Frank Fischer frank-fischer at shadow-soft.de
Fri Jul 13 09:21:50 CEST 2012


Hi York,

sorry for not answering immediately, but I've been on a business trip
last weak and had simply no time. The same will be true for large
parts of the next few months so please excuse if responses take some
time. I'll always try to answer as soon as possible.

On 2012-07-12, York Zhao <gtdplatform at gmail.com> wrote:
>> Hi,
>>
>> I still find myself confused by the "dot repeating" in Evil. I have
>> many commands, some of them are "automatically" dot repeatable but
>> others are not. For example, I have these two commands:
>>
>> (defun foo ()
>>   (interactive)
>>
>>   ...
>>
>>   (kill-region beg end)
>>
>>   ...
>>
>>   (insert ...)
>>
>>   ...)
>>
>>
>> (defun bar ()
>>   (interactive)
>>
>>   ...
>>   (insert ...))

I'm not sure what the problem is. I've just tried the following example

(defun bar ()
  (interactive)
  (save-excursion (insert "abc")))

(define-key evil-normal-state-map (kbd "C-q") 'bar)

and then in some empty buffer (after :new) 'C-q .' resulting in the
buffer content "abcabc" as expected.

Note that currently repeating only works for commands bound to
some key-bindings, calling them via M-x COMMAND RET may fail.

So please provide a complete example (full function definition, key
sequences, ...), preferably starting from a fresh emacs instance, that
demonstrates the problem. Otherwise it is really hard to isolate the
problem.

>> I don't see any essential difference between these two commands,
>> except that `foo' was being executed in org-mode while `bar' in
>> c++-mode. And I have no idea why command "foo" is dot repeatable
>> but "bar" is not. I had tried using

The mode *should* not make difference ...

>> (evil-declare-change-repeat 'bar)
>>
>> but still, "bar" is not "dot" repeatable. I'm confused by what has
>> made "foo" repeatable. I don't have time to look deeply in the
>> repeat system in Evil so I would appreciate it if someone could
>> give me some quick answer to my question.

The repeat system is always triggered by pre-command-hooks,
post-command-hooks and sometimes after-change-functions. Maybe some calls
in the body of "bar" confuse the system (something like
call-interactively could do, possibly others), but without an example
it's hard to give a definite answer.

Bye,
Frank




More information about the implementations-list mailing list