York Zhao | 9 Jul 2012 02:14
Picon

Confused by what command is "dot repeatable"

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 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

(evil-declare-change-repeat 'bar)
(Continue reading)

York Zhao | 12 Jul 2012 18:18
Picon

Re: Confused by what command is "dot repeatable"

> 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 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
>
(Continue reading)

Frank Fischer | 13 Jul 2012 09:21
Picon

Re: Confused by what command is "dot repeatable"

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)
(Continue reading)

York Zhao | 13 Jul 2012 21:31
Picon

Re: Confused by what command is "dot repeatable"

> 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.

Really appreciate that you have taken your valuable time to answer my question,
and your answer have been very useful so far.

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

Yes, you are right, I never binded these functions to any key, I used "M-x". And
if I bind my command "bar" to a key the dot repeating works. What I still don't
understand however, is that "M-x foo" is dot repeatable but not "M-x bar".

> 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.

Here's the scenario:

First, in "scratch" buffer, input the following:

(defun york-bar ()
  (interactive)
  (save-excursion
    (insert "printf(\"checkpoint\")")))

Type "C-M-x" to instrument the command `york-bar'.
(Continue reading)

Barry OReilly | 16 Jul 2012 17:23
Picon

Re: Confused by what command is "dot repeatable"

I defined york-bar the same as you and invoked M-x york-bar while in
normal state.  Then I did the . command and entered the elisp debugger
because of error:

Debugger entered--Lisp error: (void-variable p)
  eval(p nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  execute-kbd-macro([115 101 120])
  evil-execute-repeat-info(([115 101 120]))
  evil-execute-repeat-info-with-count(nil ([115 101 120]))
  evil-repeat(nil nil)
  call-interactively(evil-repeat nil nil)

If I try to exit Emacs (such as clicking the Frame's close), the
minibuffer simply reports: "After 0 kbd macro iterations: Symbol's
function definition is void: t".  Only when I exit the debugger am I
able to quit Emacs.

I discovered that if I have an edit in the repeat ring, I witness the
behavior York describes instead of the the elisp errors.  I pasted the
york-bar from my web browser using X11, so it didn't go into the
repeat ring.

On 7/13/12, York Zhao <gtdplatform <at> gmail.com> wrote:
>> 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.
(Continue reading)


Gmane