[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
From: |
Allen Li |
Subject: |
bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3> |
Date: |
Tue, 8 Aug 2017 10:16:13 -0700 |
That does make a kind of sense, but it seems to make the feature
useless for half the cases where you would want to use it.
I found others with the same use case asking the same question:
https://emacs.stackexchange.com/questions/3211/how-to-resume-an-incomplete-keyboard-macro-recording
Having any input error cause the macro recording to die makes
recording macros precarious. One accidental typo, say C-x instead of
C-c, and you can't even C-g out of it, without having to start over or
take a detour through lossage.
I can understand a bare C-g canceling the macro definition, but why
not have errors save the macro definition? I can't think of any case
where I would want an error to not save the macro I have been
painstakingly defining, but plenty of cases where I would want to
resume or edit a macro definition after an error. Heck, there's the
macro ring if you really wanted the previous macro.
On Mon, Aug 7, 2017 at 10:26 PM, Tino Calancha <tino.calancha@gmail.com> wrote:
> Allen Li <vianchielfaura@gmail.com> writes:
>
>> Reproduction:
>>
>> 1. emacs -Q
>> 2. F3
>> 3. Type some stuff (asdfasdf)
>> 4. C-g
>> 5. C-u C-u F3
>>
>> Expected: kmacro definition resumes
>>
>> Actual: error
>>
>> Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
>> start-kbd-macro(t t)
> Thank you for the report.
> I)
> Isn't it this behavior expected?
> C-g ends `start-kbd-macro' before any macro has
> being saved; i.e., `last-kbd-macro' is nil, so we cannot append to it.
>
> You must have a saved macro to append:
> emacs -Q
> F3
> (insert "a") RET
> F4 ; save it in `last-kbd-macro'
>
> C-u C-u F3 ; Apped to it.
> (insert "b") RET
> F4 ; Save it.
>
> F4 ; This insert "ab" in the current buffer.
>
> 2)
> Expected or not, i think `kmacro-start-macro' might throw an error
> when the user wants to append and `start-kbd-macro' is nil.
>
> --8<-----------------------------cut
> here---------------start------------->8---
> commit 9c86eed0b015950a4ae06243c5807d9b864eb69f
> Author: Tino Calancha <tino.calancha@gmail.com>
> Date: Tue Aug 8 14:14:55 2017 +0900
>
> Append kbd macro only if last-kbd-macro is non-nil
>
> * lisp/kmacro.el (kmacro-start-macro): Append only if
> last-kbd-macro is non-nil (Bug#28008).
>
> diff --git a/lisp/kmacro.el b/lisp/kmacro.el
> index 2db8061fa4..8eff7e5c2e 100644
> --- a/lisp/kmacro.el
> +++ b/lisp/kmacro.el
> @@ -584,7 +584,8 @@ kmacro-start-macro
> kmacro-last-counter kmacro-counter
> kmacro-counter-format kmacro-default-counter-format
> kmacro-counter-format-start kmacro-default-counter-format))
> -
> + (when (and append (null last-kbd-macro))
> + (user-error "No kbd macro has been defined"))
> (start-kbd-macro append
> (and append
> (if kmacro-execute-before-append
> --8<-----------------------------cut
> here---------------end--------------->8---
> In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
> of 2017-08-08
> Repository revision: c3445aed51944becb3e58f5dace8121c0021f6c7
- bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>, Allen Li, 2017/08/08
- bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>, Tino Calancha, 2017/08/08
- bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>,
Allen Li <=
- bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>, Tino Calancha, 2017/08/11
- bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>, Eli Zaretskii, 2017/08/11
- bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>, Tino Calancha, 2017/08/11
- bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>, Tino Calancha, 2017/08/11
- bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>, Allen Li, 2017/08/13