unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Allen Li <vianchielfaura@gmail.com>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: 28008@debbugs.gnu.org
Subject: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
Date: Tue, 8 Aug 2017 10:16:13 -0700	[thread overview]
Message-ID: <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@mail.gmail.com> (raw)
In-Reply-To: <87d1867hpd.fsf@calancha-pc>

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





  reply	other threads:[~2017-08-08 17:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08  4:10 bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3> Allen Li
2017-08-08  5:26 ` Tino Calancha
2017-08-08 17:16   ` Allen Li [this message]
2017-08-11 12:41     ` Tino Calancha
2017-08-11 13:00       ` Eli Zaretskii
2017-08-11 13:17         ` Tino Calancha
2017-08-12  3:03           ` Tino Calancha
2017-08-13 21:13             ` Allen Li
2017-09-18 20:02           ` Allen Li
2017-09-19  7:42 ` Allen Li
2017-09-30  3:47   ` Allen Li
2017-09-30  4:20     ` Tino Calancha
2017-09-30 13:48   ` Eli Zaretskii
2020-08-24 14:07     ` Lars Ingebrigtsen
2018-09-09  0:23 ` Allen Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@mail.gmail.com \
    --to=vianchielfaura@gmail.com \
    --cc=28008@debbugs.gnu.org \
    --cc=tino.calancha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).