GNU bug report logs - #28008
25.2; Resume kmacro definition errors C-u C-u <F3>

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Allen Li <vianchielfaura@HIDDEN>; dated Tue, 8 Aug 2017 04:12:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 28008 <at> debbugs.gnu.org:


Received: (at 28008) by debbugs.gnu.org; 18 Sep 2017 20:03:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 18 16:03:07 2017
Received: from localhost ([127.0.0.1]:46865 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1du2G3-0001e3-0A
	for submit <at> debbugs.gnu.org; Mon, 18 Sep 2017 16:03:07 -0400
Received: from mail-qt0-f196.google.com ([209.85.216.196]:35078)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vianchielfaura@HIDDEN>) id 1du2G0-0001dB-0b
 for 28008 <at> debbugs.gnu.org; Mon, 18 Sep 2017 16:03:05 -0400
Received: by mail-qt0-f196.google.com with SMTP id l25so1067102qtf.2
 for <28008 <at> debbugs.gnu.org>; Mon, 18 Sep 2017 13:03:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to
 :cc; bh=OofaU83KshIwSSz2aL8+W5Khi/REA3tcRZ1qz1ZuGMU=;
 b=T2SSz5toBI49tzfZOMn+ZUm7VctpwRn3VOunPg5tlk/CSQXDIPjEyqxEQGgVDJAiLC
 ZOfpiJiJBU3ErnEdcBIwSVfLcOwS/HEHNy2HtC/2iYnmV+6n0ztTQmMZ0IW+dHy05gGY
 FxGHBoiQ4fTKm9Qe9ahhoM+IKdwko/vYT7bxN6tjTkmrJR1bBNDMYKA+sGyhRpMsLK4u
 vNW2aUk5AVYSeA7s1HSU5+EWCbBOKi5OqD8lMMk8OcXS4kI1Sv+EpXa10HOi0RSudGuz
 QB52nPBb9Iim0kXAxwmxFG7GZWL18+QZ2pzLywcfbfW7Wyt0C81x8B6+gRsGN9VlgV4W
 WPCA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:in-reply-to:references:from:date
 :message-id:subject:to:cc;
 bh=OofaU83KshIwSSz2aL8+W5Khi/REA3tcRZ1qz1ZuGMU=;
 b=XqUEqcwyalI1hETM1/oF8P2ih9r0cKSrSVpWIdECDAhnez5egfflx4g4r6yzp4fziD
 DyF7ZkQMV9JxMEBvh3Poge/F7494z1X5GgeJFgnctNS79zznGwifvAWqxU7/qyUQAmRW
 zVphx7FItxb1Nk6LSkv/CSFkbqsSyOmCK8Itq3UA/7FC7cmD9Iqk4jXgGvIgXeFT1W9W
 DaK7BCnyYKNveGLAE3ACXbbh6qbjhp7kEpAt+cRn1Td7lCNoyaXGhVwjs7hcVt53PxXS
 PKMyiDJt6L4NZl/7zq429SNgK61BJnw51vjQxgN57J81VaPVygtV0lm1IKo2nZK+ENY9
 Nr4g==
X-Gm-Message-State: AHPjjUiWqrvTUwQNQOxxJTNqgOsgzAvgYWvnsVRZNnKPgPCd0vyLfzxu
 pUWioZYLXVmrF3LuT+nLZcV8EKEM3ZPcqxkEO7c=
X-Google-Smtp-Source: AOwi7QDHTccqgFNBT53dVmEoPQ6Ii7neaUgqmb+wO5iOW3X+5EoTGRwpSlCG3qoCRs5FSfquYDaI+2NmlBZRD7LIFug=
X-Received: by 10.200.2.147 with SMTP id p19mr48726283qtg.242.1505764978036;
 Mon, 18 Sep 2017 13:02:58 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.200.49.212 with HTTP; Mon, 18 Sep 2017 13:02:57 -0700 (PDT)
In-Reply-To: <alpine.DEB.2.20.1708112207420.17216@calancha-pc>
References: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
 <87d1867hpd.fsf@calancha-pc>
 <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@HIDDEN>
 <87d182p97t.fsf@calancha-pc> <83shgyqmwn.fsf@HIDDEN>
 <alpine.DEB.2.20.1708112207420.17216@calancha-pc>
From: Allen Li <vianchielfaura@HIDDEN>
Date: Mon, 18 Sep 2017 13:02:57 -0700
Message-ID: <CAJr1M6ePXynUvv0f2oKwhfwiL9wiTaewTQVZ83T5RpCRrxgd_Q@HIDDEN>
Subject: Re: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
To: Tino Calancha <tino.calancha@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On Fri, Aug 11, 2017 at 6:17 AM, Tino Calancha wrote: > >
 On Fri, 11 Aug 2017, Eli Zaretskii wrote: >> All these low-level changes just
 to support an obscure use case? Is >> really worth the risk to break macros
 to cater to that? > > That depends of how often someone uses kbd macros.
 I rarely use them, but > the people using them frequently might suffer D.2
 from time to time. > > Actually, the patch#1 is quite short: i included a
 docstring fix from > the patch#2 by mistake. > The C code changes in patch#1
 are just: > 3 files changed, 41 insertions(+), 2 deletions(-) [...] 
 Content analysis details:   (1.8 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (vianchielfaura[at]gmail.com)
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
 trust [209.85.216.196 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [209.85.216.196 listed in wl.mailspike.net]
 0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
 [209.85.216.196 listed in dnsbl.sorbs.net]
 1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
 0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 28008
Cc: Eli Zaretskii <eliz@HIDDEN>, 28008 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  On Fri, Aug 11, 2017 at 6:17 AM, Tino Calancha wrote: > >
   On Fri, 11 Aug 2017, Eli Zaretskii wrote: >> All these low-level changes just
    to support an obscure use case? Is >> really worth the risk to break macros
    to cater to that? > > That depends of how often someone uses kbd macros.
   I rarely use them, but > the people using them frequently might suffer D.2
    from time to time. > > Actually, the patch#1 is quite short: i included a
    docstring fix from > the patch#2 by mistake. > The C code changes in patch#1
    are just: > 3 files changed, 41 insertions(+), 2 deletions(-) [...] 
 
 Content analysis details:   (1.8 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
                             [209.85.216.196 listed in dnsbl.sorbs.net]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [209.85.216.196 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
                             trust
                             [209.85.216.196 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail provider
                             (vianchielfaura[at]gmail.com)
  1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
  0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders

On Fri, Aug 11, 2017 at 6:17 AM, Tino Calancha <tino.calancha@HIDDEN> wrote:
>
> On Fri, 11 Aug 2017, Eli Zaretskii wrote:
>> All these low-level changes just to support an obscure use case?  Is
>> really worth the risk to break macros to cater to that?
>
> That depends of how often someone uses kbd macros.  I rarely use them, but
> the people using them frequently might suffer D.2 from time to time.
>
> Actually, the patch#1 is quite short: i included a docstring fix from
> the patch#2 by mistake.
> The C code changes in patch#1 are just:
>  3 files changed, 41 insertions(+), 2 deletions(-)

I had to change a c to Qc in macros.c to get patch 1 to compile.
However, it does not seem to fix case D.2.  I don't think this was
made explicit, but case D.2 applies to all undefined keybindings, so
for example C-x C-g, but also C-c z.

We should at least fix the behavior for case D.2  The more invasive
patch 2 can be discussed later, but Emacs shouldn't just discard the
entire recorded macro on an undefined key press.  This makes me
nervous whenever I use kmacros.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.

Message received at 28008 <at> debbugs.gnu.org:


Received: (at 28008) by debbugs.gnu.org; 13 Aug 2017 21:13:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 13 17:13:15 2017
Received: from localhost ([127.0.0.1]:32849 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dh0CB-0000TZ-DF
	for submit <at> debbugs.gnu.org; Sun, 13 Aug 2017 17:13:15 -0400
Received: from mail-qk0-f180.google.com ([209.85.220.180]:37897)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vianchielfaura@HIDDEN>) id 1dh0C9-0000TR-Dg
 for 28008 <at> debbugs.gnu.org; Sun, 13 Aug 2017 17:13:14 -0400
Received: by mail-qk0-f180.google.com with SMTP id x191so42211157qka.5
 for <28008 <at> debbugs.gnu.org>; Sun, 13 Aug 2017 14:13:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to
 :cc; bh=I4HiI9upRiVM8KjDS/0OfOwF6X1v+95xzzO7S1EXkCM=;
 b=tB4VGjCM4DnhwWzFxrOTW//Hv1n/QFAqYShqe84PuHdV5/G+3z5jjRJa7dd1VIBRUC
 Baoab7cWrWEUwuIwote5caOmA0zXi4r3qvvEufgDu+hz0HFRS3mbD+/09GUrsEf2Eybh
 p5JqinSFj4rnFJ8SqSzmRZ43nCN2jstlDsZdauhYS/YT9kefc6KTOtoKe/MyOak5L8HA
 cYmiKPvkR9u2KALU37snXEBoa/j6uHkQ7UIbpWqSCJXIW2k7RPxM0CvChimiYmYHl5Aq
 /5/Cxs5PWHG04A77F0uXqR936bX1WQVUQHRnhgS50RLzIZlwBOciBbXao5QSJOHyYEds
 7k6Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:in-reply-to:references:from:date
 :message-id:subject:to:cc;
 bh=I4HiI9upRiVM8KjDS/0OfOwF6X1v+95xzzO7S1EXkCM=;
 b=IKiozQKV01OGvKHWNYmlf1APVd2JlY7k+3yjKo8F/wdt21MZxT5tCTKmQloFk02yfH
 XR15wld5bnXKbKnLmbG8NUQSaDALNBilOSR+9tnh+274zD+bJfcL+G4yI9SBj8zSJrqu
 xstXRfh4cGuMPgFK5G3JKK5sYde6EVciAeStdDUpocaS6wzJqtTus3zZV4bpnb0b1qaS
 QQlTFdP27KR6GrjIkcyHItcRu5EV1FenqVZewgVFJdRV3LFqxYw3VIDuAjt0CbYxDLIP
 AFKEWVi7FJSnzxIBLF+vJGvD7+kY0DzDdsIFZImXIDhJUuZo/vOaz0IhsIYaC2V7+CIq
 uZ2Q==
X-Gm-Message-State: AHYfb5g45AG5XR0ZV+tcvBVkvEB8CRLCA3ko95ozExal47rc2Emn0W3U
 rZakVw8DqqzJE0v/YJUpB2+HQ28olg==
X-Received: by 10.55.3.130 with SMTP id 124mr1568233qkd.78.1502658788041; Sun,
 13 Aug 2017 14:13:08 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.200.52.237 with HTTP; Sun, 13 Aug 2017 14:13:07 -0700 (PDT)
In-Reply-To: <8760dt32su.fsf@calancha-pc>
References: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
 <87d1867hpd.fsf@calancha-pc>
 <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@HIDDEN>
 <87d182p97t.fsf@calancha-pc> <83shgyqmwn.fsf@HIDDEN>
 <alpine.DEB.2.20.1708112207420.17216@calancha-pc>
 <8760dt32su.fsf@calancha-pc>
From: Allen Li <vianchielfaura@HIDDEN>
Date: Sun, 13 Aug 2017 14:13:07 -0700
Message-ID: <CAJr1M6dDZJtVJjaOircGpAToXZ2x2T5CiZXEkdbeGYa85CynVQ@HIDDEN>
Subject: Re: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
To: Tino Calancha <tino.calancha@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On Fri, Aug 11, 2017 at 5:41 AM, Tino Calancha wrote: > **
 Patch 1 always save the macro in `last-kbd-macro' after an error or 'C-g'.
 > Then, A. B. and D.2 behaves similarly. > > ** Patch 2 adds a new variable
 `last-aborted-kbd-macro': it saves the partial > macro there after an error
 or 'C-g'. Called `start-kbd-macro' with > APPEND non-nil offers to append
 on `last-aborted-kbd-macro'; possible answers > are 'yes', 'no' or 'del'
 (i.e., append on `last-aborted-kbd-macro' after delete > its last character).
 > > This is not backward compatible; for instance, the snippets A, B above
 won't be > saved in `last-kbd-macro' (currently they do). > It's more tidy;
 it separates 'good macros', i.e. those ended after > 'F4' or 'C-x )', from
 'partial macros', i.e., those ended after an error or 'C-g'. [...] 
 Content analysis details:   (1.8 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [209.85.220.180 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
 trust [209.85.220.180 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (vianchielfaura[at]gmail.com)
 0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
 [209.85.220.180 listed in dnsbl.sorbs.net]
 1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
 0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 28008
Cc: Eli Zaretskii <eliz@HIDDEN>, 28008 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  On Fri, Aug 11, 2017 at 5:41 AM, Tino Calancha wrote: > **
    Patch 1 always save the macro in `last-kbd-macro' after an error or 'C-g'.
    > Then, A. B. and D.2 behaves similarly. > > ** Patch 2 adds a new variable
    `last-aborted-kbd-macro': it saves the partial > macro there after an error
    or 'C-g'. Called `start-kbd-macro' with > APPEND non-nil offers to append
    on `last-aborted-kbd-macro'; possible answers > are 'yes', 'no' or 'del'
   (i.e., append on `last-aborted-kbd-macro' after delete > its last character).
    > > This is not backward compatible; for instance, the snippets A, B above
    won't be > saved in `last-kbd-macro' (currently they do). > It's more tidy;
    it separates 'good macros', i.e. those ended after > 'F4' or 'C-x )', from
    'partial macros', i.e., those ended after an error or 'C-g'. [...] 
 
 Content analysis details:   (1.8 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
                             [209.85.220.180 listed in dnsbl.sorbs.net]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [209.85.220.180 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
                             trust
                             [209.85.220.180 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail provider
                             (vianchielfaura[at]gmail.com)
  1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
  0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders

On Fri, Aug 11, 2017 at 5:41 AM, Tino Calancha <tino.calancha@HIDDEN> wrote:
>  ** Patch 1 always save the macro in `last-kbd-macro' after an error or 'C-g'.
>     Then, A. B. and D.2 behaves similarly.
>
>  ** Patch 2 adds a new variable `last-aborted-kbd-macro': it saves the partial
>     macro there after an error or 'C-g'.  Called `start-kbd-macro' with
>     APPEND non-nil offers to append on `last-aborted-kbd-macro'; possible answers
>     are 'yes', 'no' or 'del' (i.e., append on `last-aborted-kbd-macro' after delete
>     its last character).
>
>     This is not backward compatible; for instance, the snippets A, B above won't be
>     saved in `last-kbd-macro' (currently they do).
>     It's more tidy; it separates 'good macros', i.e. those ended after
>     'F4' or 'C-x )', from 'partial macros', i.e., those ended after an error or 'C-g'.

I'm not the best qualified to comment on the patches themselves, but 2
sounds like the best solution except that it breaks backward
compatibility. However, I hypothesize that no one is relying on the
old behavior (that non-quit errors stop the macro recording and yet
save it).

On Fri, Aug 11, 2017 at 6:00 AM, Eli Zaretskii <eliz@HIDDEN> wrote:
> All these low-level changes just to support an obscure use case?  Is
> really worth the risk to break macros to cater to that?

I suspect that this bug is one of the reasons that this is an obscure
use case, i.e. that people don't use kmacros as often as they would
like to.  Humans make mistakes, and when they make mistakes that
translates to either an error or a C-g stopping the kmacro definition,
which makes it impractical to use kmacros in the current form.  If it
were easy to recover from an error during kmacro definition, I know I
would use them more.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.

Message received at 28008 <at> debbugs.gnu.org:


Received: (at 28008) by debbugs.gnu.org; 12 Aug 2017 03:04:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 11 23:04:03 2017
Received: from localhost ([127.0.0.1]:56187 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dgMiW-0005HJ-Hh
	for submit <at> debbugs.gnu.org; Fri, 11 Aug 2017 23:04:00 -0400
Received: from mail-pf0-f177.google.com ([209.85.192.177]:35491)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tino.calancha@HIDDEN>) id 1dgMiU-0005H5-WA
 for 28008 <at> debbugs.gnu.org; Fri, 11 Aug 2017 23:03:59 -0400
Received: by mail-pf0-f177.google.com with SMTP id t86so22378160pfe.2
 for <28008 <at> debbugs.gnu.org>; Fri, 11 Aug 2017 20:03:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=eXVbFh3SYzvfCrvY/e7EIdTCHcozQvF4+ImxdgobwbY=;
 b=O6QXm6Vyp0lkwSLGfvNsEl98jhO48+e7pUh4UH1Bumchm4V8knC2cIWDnwqqd6i7CC
 RsvNAPqwcM3o1LIbrNyoh4HRDKpIGvU78Mr6HRNwGHGP5qLqouN2dYXo4HSwi4Tj2i/Q
 wbwdqMXB1LEHHCouc8OjKUHxNhuDY2eNJO9rX5S+rIODtslDMvKnHhOb5DsfO1lYlZcS
 FJgBxPQoeNjGUMEgteLoGmyh4eMId770zawvrBIil34x7JFR/bltXS6ntzxaO+Rh1LON
 nsj6x4KRQEMx3/oDx4XmwqPLy0+IRe+NcpSql8fSlVR6TV8LPVwgnbNVKXjFZF3V7VO+
 7Sqg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=eXVbFh3SYzvfCrvY/e7EIdTCHcozQvF4+ImxdgobwbY=;
 b=cltfoX8fRiz3BCZ+0qyyvfRssy70Td0vzyrSJXYBCV0lxzPdp9wE3HdG0F2WyLZwVX
 uIasOS2Oi6Z30/V/pxRxhKDy1D8xyT2i3NQdeSaTbQ+9YyGCLs5WYFB/zig+buc8MjeS
 YtVmYaQ/072nTC26L3MlSkTkd9vjdG3twm7I5diIxTyxTdwcXHKUxDwHgRXLKEaYzK2S
 XZ81s0rDX+hUuRAClLpJA7Vn/fbClRWaRMdC+NmtZ2/1t7T9gH2DdBl/DidJHv6Zqcf0
 6QKeyVIoDwJ/mQqcmRjHBRquZUcu5wLpWd2Zu2FWPzY8D5WsXMLcC4GJinIKdGkRwd5d
 zeTw==
X-Gm-Message-State: AHYfb5j0BMAJU3NQmTtxstOgeJ1W4BBX9P1PCHe0Dnn1XqgkkI+2ve6w
 lvY4Gf9yeiTNd9rC
X-Received: by 10.84.241.197 with SMTP id t5mr20539957plm.473.1502507033082;
 Fri, 11 Aug 2017 20:03:53 -0700 (PDT)
Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170])
 by smtp.gmail.com with ESMTPSA id
 69sm4471076pfh.186.2017.08.11.20.03.51
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 11 Aug 2017 20:03:52 -0700 (PDT)
From: Tino Calancha <tino.calancha@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
References: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
 <87d1867hpd.fsf@calancha-pc>
 <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@HIDDEN>
 <87d182p97t.fsf@calancha-pc> <83shgyqmwn.fsf@HIDDEN>
 <alpine.DEB.2.20.1708112207420.17216@calancha-pc>
Date: Sat, 12 Aug 2017 12:03:45 +0900
In-Reply-To: <alpine.DEB.2.20.1708112207420.17216@calancha-pc> (Tino
 Calancha's message of "Fri, 11 Aug 2017 22:17:57 +0900 (JST)")
Message-ID: <8760dt32su.fsf@calancha-pc>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.0 (-)
X-Debbugs-Envelope-To: 28008
Cc: vianchielfaura@HIDDEN, 28008 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Tino Calancha <tino.calancha@HIDDEN> writes:

> On Fri, 11 Aug 2017, Eli Zaretskii wrote:
>
>>>  ** Patch 1 always save the macro in `last-kbd-macro' after an error or 'C-g'.
>>>     Then, A. B. and D.2 behaves similarly.
> Actually, the patch#1 is quite short: i included a docstring fix from
> the patch#2 by mistake.
The commit message of patch#1 got too verbose.  It shouldn't mention
about 'last-aborted-kbd-macro' (that variable belongs to patch#2):
Following is a revisede commit message for patch#1:
--8<-----------------------------cut here---------------start------------->8---
Save aborted kbd macro definitions

While a defining a kbd macro, if we get an error or if the user inputs C-g,
then save the aborted kbd macro record (Bug#28008).

* lisp/kmacro.el (kmacro-start-macro): Signal an error if APPEND is non-nil
and last-kbd-macro is nil.

* src/keyboard.c (cmd_error): Increase buffer size for macroerror
to accommodate new error message.
If we are defining a kbd macro and we got an error, then save the
current progress in last-kbd-macro.

* src/macros.c (save_aborted_kbd_macro): New function.
(store_kbd_macro_char): Call save_aborted_kbd_macro when user inputs C-g.
--8<-----------------------------cut here---------------end--------------->8---




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.

Message received at 28008 <at> debbugs.gnu.org:


Received: (at 28008) by debbugs.gnu.org; 11 Aug 2017 13:18:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 11 09:18:09 2017
Received: from localhost ([127.0.0.1]:55191 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dg9pJ-0007xC-6s
	for submit <at> debbugs.gnu.org; Fri, 11 Aug 2017 09:18:09 -0400
Received: from mail-pf0-f196.google.com ([209.85.192.196]:33772)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tino.calancha@HIDDEN>) id 1dg9pG-0007wi-Jv
 for 28008 <at> debbugs.gnu.org; Fri, 11 Aug 2017 09:18:07 -0400
Received: by mail-pf0-f196.google.com with SMTP id c65so3491444pfl.0
 for <28008 <at> debbugs.gnu.org>; Fri, 11 Aug 2017 06:18:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:date:to:cc:subject:in-reply-to:message-id:references
 :user-agent:mime-version;
 bh=dIgyZbobCR1ZY5IE3zFubYgDHIgJmceROg1FKXHuvvo=;
 b=L9TDIf+M+OFgYIHzc4xotK5ZprUuamaap65+3XBoyN/My6DpNp+vR+Xf2D1n/pPtCP
 mXGuOs6Eo/HXyF/laAJgQen83MgZshJzRnq9B7tuBkSYEXR66glVp7et4Wf0p2mrRRCQ
 B9g3lAt5E6a71kSd0b/2cgzEABytUYJUUdiWpPlutqY51A0+J0ee1oV3LkxJGG5u4adO
 L22zjZnPM/99G2IdnIzDWSICvlvLXyaZkoWeE8zmxYc2hw4DNZRGngEISjJabHWds57j
 JB7VE4WcPEEZqDoNcFsBCo2r2er99odwaNK7IekAWBRh6kWziiwj8m9AcN+3GyiUpYsa
 Cyvw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id
 :references:user-agent:mime-version;
 bh=dIgyZbobCR1ZY5IE3zFubYgDHIgJmceROg1FKXHuvvo=;
 b=D0V1ib/n3VKdIPQhwmh55OGRzBfDmebUYBWggSUYaVuZX+h6A7BaVCQlMYmldYKUzy
 jQ77lDUSxC9/kNQrylhIxCPAiwI8hXGt1zRpO9egqgA1GffZyRqrJ82pd+rVUiIJH5sO
 I3z1lpVjy1REWh+kTRVJTR1sG2hb033+2HXk4uVo4v9vcKiR7DoZf43fPIGO93Ra6KAB
 WW1aZlYqkNs1g3RzBXFtFEVzY8AGxrtPyi2cdjHCv8IRd1pXX8Iw86EhgLF8JMoEUoo0
 mkKgiSlDwTtGbLTleaCMlCS58tB/XM6nfPg/gXgXfPeO3tTIdA6UAMPJbNyYHYN92ZbX
 nmIA==
X-Gm-Message-State: AHYfb5gSYtWAU+xwEy88XTtCfSCRl0+edBdQZJhDaFeYU1OJAvj9HSC1
 HAAaetSwEwE+5Q==
X-Received: by 10.84.218.65 with SMTP id f1mr17930104plm.295.1502457480725;
 Fri, 11 Aug 2017 06:18:00 -0700 (PDT)
Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170])
 by smtp.gmail.com with ESMTPSA id
 b4sm1827222pgc.9.2017.08.11.06.17.58
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 11 Aug 2017 06:18:00 -0700 (PDT)
From: Tino Calancha <tino.calancha@HIDDEN>
X-Google-Original-From: Tino Calancha <calancha@HIDDEN>
Date: Fri, 11 Aug 2017 22:17:57 +0900 (JST)
X-X-Sender: calancha@calancha-pc
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
In-Reply-To: <83shgyqmwn.fsf@HIDDEN>
Message-ID: <alpine.DEB.2.20.1708112207420.17216@calancha-pc>
References: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
 <87d1867hpd.fsf@calancha-pc>
 <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@HIDDEN>
 <87d182p97t.fsf@calancha-pc> <83shgyqmwn.fsf@HIDDEN>
User-Agent: Alpine 2.20 (DEB 67 2015-01-07)
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=US-ASCII
X-Spam-Score: -1.0 (-)
X-Debbugs-Envelope-To: 28008
Cc: vianchielfaura@HIDDEN, 28008 <at> debbugs.gnu.org,
 Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



On Fri, 11 Aug 2017, Eli Zaretskii wrote:

>>  ** Patch 1 always save the macro in `last-kbd-macro' after an error or 'C-g'.
>>     Then, A. B. and D.2 behaves similarly.
>>
>>  ** Patch 2 adds a new variable `last-aborted-kbd-macro': it saves the partial
>>     macro there after an error or 'C-g'.  Called `start-kbd-macro' with
>>     APPEND non-nil offers to append on `last-aborted-kbd-macro'; possible answers
>>     are 'yes', 'no' or 'del' (i.e., append on `last-aborted-kbd-macro' after delete
>>     its last character).
>>
>>     This is not backward compatible; for instance, the snippets A, B above won't be
>>     saved in `last-kbd-macro' (currently they do).
>>     It's more tidy; it separates 'good macros', i.e. those ended after
>>     'F4' or 'C-x )', from 'partial macros', i.e., those ended after an error or 'C-g'.
>
> All these low-level changes just to support an obscure use case?  Is
> really worth the risk to break macros to cater to that?
That depends of how often someone uses kbd macros.  I rarely use 
them, but the people using them frequently might suffer D.2 from time to 
time.

Actually, the patch#1 is quite short: i included a docstring fix from
the patch#2 by mistake.
The C code changes in patch#1 are just:
  3 files changed, 41 insertions(+), 2 deletions(-)

Here is patch#1 upated:

--8<-----------------------------cut here---------------start------------->8---
commit fe424d1371ec467b9a257fa75c8c3f734135e6dd
Author: Tino Calancha <tino.calancha@HIDDEN>
Date:   Fri Aug 11 22:11:08 2017 +0900

     Save aborted kbd macro definitions

     While a defining a kbd macro, if we get an error or if the user inputs C-g,
     then save the aborted kbd macro record (Bug#28008).

     * lisp/kmacro.el (kmacro-start-macro): Signal an error if APPEND is non-nil
     and last-kbd-macro is nil.

     * src/keyboard.c (cmd_error): Increase buffer size for macroerror
     to accommodate new error message.
     If we are defining a kbd macro and we got an error, then save the
     current progress in last-kbd-macro.
     (init_kboard): Initialize last-aborted-kbd-macro.
     (mark_kboards): Mark last-aborted-kbd-macro.

     * src/keyboard.h (save_aborted_kbd_macro): Declare this function.

     * src/macros.c (save_aborted_kbd_macro): New function.
     (store_kbd_macro_char): Call save_aborted_kbd_macro when user inputs C-g.

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
diff --git a/src/keyboard.c b/src/keyboard.c
index 97069a24ac..5111e2c358 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -941,7 +941,8 @@ static Lisp_Object
  cmd_error (Lisp_Object data)
  {
    Lisp_Object old_level, old_length;
-  char macroerror[sizeof "After..kbd macro iterations: "
+  char macroerror[sizeof "Saved aborted kbd macro in \
+`last-kbd-macro' after error: "
  		  + INT_STRLEN_BOUND (EMACS_INT)];

  #ifdef HAVE_WINDOW_SYSTEM
@@ -949,7 +950,13 @@ cmd_error (Lisp_Object data)
      cancel_hourglass ();
  #endif

-  if (!NILP (executing_kbd_macro))
+  if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
+    {
+      sprintf (macroerror,
+               "Saved aborted kbd macro in `last-kbd-macro' after error: ");
+      save_aborted_kbd_macro (false);
+    }
+  else if (!NILP (executing_kbd_macro))
      {
        if (executing_kbd_macro_iterations == 1)
  	sprintf (macroerror, "After 1 kbd macro iteration: ");
diff --git a/src/keyboard.h b/src/keyboard.h
index 2219c01135..676ccd83cc 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -463,6 +463,8 @@ extern bool lucid_event_type_list_p (Lisp_Object);
  extern void kbd_buffer_store_event (struct input_event *);
  extern void kbd_buffer_store_buffered_event (union buffered_input_event *,
  					     struct input_event *);
+extern Lisp_Object save_aborted_kbd_macro (bool);
+
  INLINE void
  kbd_buffer_store_event_hold (struct input_event *event,
  			     struct input_event *hold_quit)
diff --git a/src/macros.c b/src/macros.c
index f0ffda3f44..1935e4fd2f 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -39,6 +39,32 @@ EMACS_INT executing_kbd_macro_iterations;

  Lisp_Object executing_kbd_macro;

+/* Save the aborted macro.
+   Called if an error happens, or if the user inputs C-g,
+   while defining a kbd macro.  */
+
+Lisp_Object
+save_aborted_kbd_macro (bool msg)
+{
+  struct kboard *kb = current_kboard;
+  /* Must contain something; otherwise don't save it. */
+  if (kb->kbd_macro_end != kb->kbd_macro_buffer)
+    {
+      end_kbd_macro ();
+      if (msg)
+        {
+          message1 ("Saved aborted kbd macro in `last-kbd-macro'");
+          /* Set inhibit_quit to until sleep_for ends */
+          Vinhibit_quit = Qt;
+          Fsleep_for (make_number (1), Qnil);
+          Vinhibit_quit = Qnil;
+        }
+    }
+
+  return Qnil;
+}
+
+
  DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P",
         doc: /* Record subsequent keyboard input, defining a keyboard macro.
  The commands are recorded even as they are executed.
@@ -182,6 +208,10 @@ store_kbd_macro_char (Lisp_Object c)

    if (!NILP (KVAR (kb, defining_kbd_macro)))
      {
+      /* We received a Quit: save the current kboard in Vlast_kbd_macro */
+      if (XFASTINT (c) == quit_char)
+        save_aborted_kbd_macro (true);
+
        if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize)
  	{
  	  ptrdiff_t ptr_offset = kb->kbd_macro_ptr - kb->kbd_macro_buffer;
--8<-----------------------------cut here---------------end--------------->8---




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.

Message received at 28008 <at> debbugs.gnu.org:


Received: (at 28008) by debbugs.gnu.org; 11 Aug 2017 13:01:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 11 09:01:25 2017
Received: from localhost ([127.0.0.1]:55182 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dg9Z7-0007av-Le
	for submit <at> debbugs.gnu.org; Fri, 11 Aug 2017 09:01:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48598)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1dg9Z5-0007ai-HG
 for 28008 <at> debbugs.gnu.org; Fri, 11 Aug 2017 09:01:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1dg9Yw-0002T2-A2
 for 28008 <at> debbugs.gnu.org; Fri, 11 Aug 2017 09:01:18 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=2.0 required=5.0 tests=BAYES_40,GAPPY_SUBJECT,
 RP_MATCHES_RCVD autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43157)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1dg9Yw-0002Sx-78; Fri, 11 Aug 2017 09:01:14 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4652
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1dg9Yu-0004Pz-Sg; Fri, 11 Aug 2017 09:01:14 -0400
Date: Fri, 11 Aug 2017 16:00:56 +0300
Message-Id: <83shgyqmwn.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Tino Calancha <tino.calancha@HIDDEN>
In-reply-to: <87d182p97t.fsf@calancha-pc> (message from Tino Calancha on Fri, 
 11 Aug 2017 21:41:58 +0900)
Subject: Re: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
References: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
 <87d1867hpd.fsf@calancha-pc>
 <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@HIDDEN>
 <87d182p97t.fsf@calancha-pc>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -3.7 (---)
X-Debbugs-Envelope-To: 28008
Cc: vianchielfaura@HIDDEN, 28008 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.7 (---)

> From: Tino Calancha <tino.calancha@HIDDEN>
> Cc: Eli Zaretskii <eliz@HIDDEN>,  28008 <at> debbugs.gnu.org, tino.calancha@HIDDEN
> Date: Fri, 11 Aug 2017 21:41:58 +0900
> 
>  ** Patch 1 always save the macro in `last-kbd-macro' after an error or 'C-g'.
>     Then, A. B. and D.2 behaves similarly.
> 
>  ** Patch 2 adds a new variable `last-aborted-kbd-macro': it saves the partial
>     macro there after an error or 'C-g'.  Called `start-kbd-macro' with
>     APPEND non-nil offers to append on `last-aborted-kbd-macro'; possible answers
>     are 'yes', 'no' or 'del' (i.e., append on `last-aborted-kbd-macro' after delete
>     its last character).
> 
>     This is not backward compatible; for instance, the snippets A, B above won't be
>     saved in `last-kbd-macro' (currently they do).
>     It's more tidy; it separates 'good macros', i.e. those ended after
>     'F4' or 'C-x )', from 'partial macros', i.e., those ended after an error or 'C-g'.

All these low-level changes just to support an obscure use case?  Is
really worth the risk to break macros to cater to that?

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.

Message received at 28008 <at> debbugs.gnu.org:


Received: (at 28008) by debbugs.gnu.org; 11 Aug 2017 12:42:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 11 08:42:13 2017
Received: from localhost ([127.0.0.1]:55172 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dg9GX-00079x-0j
	for submit <at> debbugs.gnu.org; Fri, 11 Aug 2017 08:42:13 -0400
Received: from mail-pg0-f65.google.com ([74.125.83.65]:35933)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tino.calancha@HIDDEN>) id 1dg9GU-00079k-GS
 for 28008 <at> debbugs.gnu.org; Fri, 11 Aug 2017 08:42:11 -0400
Received: by mail-pg0-f65.google.com with SMTP id y129so3062824pgy.3
 for <28008 <at> debbugs.gnu.org>; Fri, 11 Aug 2017 05:42:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:in-reply-to:references:user-agent:date
 :message-id:mime-version;
 bh=SvSMC4h+P9YhfCrkR2eUbLPOEjQzhKQlwT+FxGWoNqY=;
 b=N3GnEPQkqhPYn1q9hIpMJbA+h7wSKn7BZdnXZQu8eIFKS7i9iniNT8Q5xADjW6cLTZ
 Aq1MUjJJjVtoHHfYVIYu2Y2gTmeOiVnFvoUf7e0cX7awDDX1HDDQlGlyb0iN0/FTIjXb
 HfRP99Fgyg0Rwo/TdRpgPzssQZN1vcG3gXZXhotPc1/u1Kw8CjzFMftBCAhfGmJLtYG5
 7tiIAT5l8oHdMo9hpGEGOHRMvDxnVRbIbza0LPhhfbrOOfHDwSIKbti8bYnAokjTCy15
 Qynn61ZsKd8TFqBH6Jtu7u20zhBBdqpbiqDX8fx8SDIfg5p6kp6wqvBreJCWq5YyvFUB
 eD2g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references
 :user-agent:date:message-id:mime-version;
 bh=SvSMC4h+P9YhfCrkR2eUbLPOEjQzhKQlwT+FxGWoNqY=;
 b=oISAOiuD5II4BkfRth2b6jeu4wt5/jvcLOX5W+obe7eLQmpP8BlyS7jjD33Pt6smWJ
 rXc3bsLo8STYDySbZj0MDfBAEcg+NfuckfWL/EdI1NXmGd9Y4ohmnJjiUKcHYWsOxUiz
 qBwy1Rzyla4TJ7gWoO96uR25vcmZg+z391A6JP/AeqWnlYAVax+RsScNJeP+AWeseSvX
 eQGrrVKl8BRt01kl/JvI5xQBvIvZGDbnlBxqkeF9l4FH5TBAwPWDmBSfXfFrDiNMaJIH
 7gDoWiJZLLugsxnFuU24467PH+biAt0XZI2tqi4+yVDoQvNRFcvdNg2G+LIX4i/s5gNa
 EBgg==
X-Gm-Message-State: AHYfb5hUhQOkY7/0sV4GQTtNL4Me6U2pnu5K6qZLBhPUiFp4pf1gh/5e
 u/djd5iqOFazKQ==
X-Received: by 10.84.215.208 with SMTP id g16mr17893498plj.191.1502455324100; 
 Fri, 11 Aug 2017 05:42:04 -0700 (PDT)
Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170])
 by smtp.gmail.com with ESMTPSA id
 s8sm2519031pfd.77.2017.08.11.05.42.01
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 11 Aug 2017 05:42:03 -0700 (PDT)
From: Tino Calancha <tino.calancha@HIDDEN>
To: Allen Li <vianchielfaura@HIDDEN>
Subject: Re: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
In-Reply-To: <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@HIDDEN>
 (Allen Li's message of "Tue, 8 Aug 2017 10:16:13 -0700")
References: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
 <87d1867hpd.fsf@calancha-pc>
 <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
Date: Fri, 11 Aug 2017 21:41:58 +0900
Message-ID: <87d182p97t.fsf@calancha-pc>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Allen Li writes: > 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. [...] 
 Content analysis details:   (1.8 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (tino.calancha[at]gmail.com)
 0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
 [74.125.83.65 listed in dnsbl.sorbs.net]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [74.125.83.65 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
 trust [74.125.83.65 listed in list.dnswl.org]
 1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
 0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 28008
Cc: Eli Zaretskii <eliz@HIDDEN>, 28008 <at> debbugs.gnu.org,
 tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Allen Li writes: > 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. [...] 
 
 Content analysis details:   (1.8 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
                             [74.125.83.65 listed in dnsbl.sorbs.net]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [74.125.83.65 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
                             trust
                             [74.125.83.65 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail provider
                             (tino.calancha[at]gmail.com)
  1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
  0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders

Allen Li <vianchielfaura@HIDDEN> writes:

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

Following are examples for all snippets suggested in this thread and the
stackexchage question:

A. In the stackexchange question, the OP says that after 4. below
   your macro is lost:
   1. f3
   2. hello
   3. C-s
   4. C-g

   ;; but it's not lost: the macro was saved:
   M-: last-kbd-macro RET
   "hello"
   ;; You can edit it:
   5. C-x C-k C-e ; edit as needed
   6. C-c C-c
   7. C-u C-u f3
   8. SPC world f4

   ;; Now you have recorded a macro with inserts
   ;; "hello world" in current buffer.
   F4 ; call the macro.

B. Same applies to the following example:
   1. f3
   2. ab
   3. Alt-x ; Mistake: you don't want this.
   4. C-g
   5. M-: last-kbd-macro RET ; The macro is saved.
      => "ab"

C. AFAICT, if we get an error the macro is saved as well:
   ;; Write a file /tmp/macro.el with content:
   --8<-----------------------------cut here---------------start------------->8---
   (defun test ()
     (interactive)
     (error "Got an error while defininig a kbd macro"))

   (global-set-key (kbd "<f8>") 'test)
   --8<-----------------------------cut here---------------end--------------->8---
   1. emacs -Q /tmp/macro.el
   2. f3 ab f8 ; An error stop kbd macro recording.
   3. M-: last-kbd-macro RET ; Macro was saved.
      => "ab"

D. Endeed, with your recipes the macro is lost:
   D.1. First recipe:
        1. emacs -Q
        2. F3
        3. my namo ; Type some stuff
        4. C-g
        5. C-u C-u F3
        ;; here we haven't saved a macro:
        M-: last-kbd-macro RET
        nil

        ;; An user should use 'DEL' rather than 'C-g' in 4. above:
        ;; (Should we remark this in the manual/docstring?)
        1. emacs -Q
        2. F3
        3. my namo ; Type some stuff: upps a typo! Must read 'my name'
        4. DEL e SPC is SPC John SPC Doe F4
        ;; Now you have recorded a macro with inserts
        ;; "my name is John Doe" in current buffer.
        M-: last-kbd-macro RET
        => [109 121 32 110 97 109 111 backspace 101 32 105 115 ...]

   D.2. Second recipe: This seems quite annoying.
        1. emacs -Q
        2. F3
        3. ab
        4. C-x ; mistake
        5. C-g
        6. M-: last-kbd-macro RET
           => nil

* The main concern is D.2: it looks similar than A, B, but it doesn't save
  the current kbd macro recording.

 ** Patch 1 always save the macro in `last-kbd-macro' after an error or 'C-g'.
    Then, A. B. and D.2 behaves similarly.

 ** Patch 2 adds a new variable `last-aborted-kbd-macro': it saves the partial
    macro there after an error or 'C-g'.  Called `start-kbd-macro' with
    APPEND non-nil offers to append on `last-aborted-kbd-macro'; possible answers
    are 'yes', 'no' or 'del' (i.e., append on `last-aborted-kbd-macro' after delete
    its last character).

    This is not backward compatible; for instance, the snippets A, B above won't be
    saved in `last-kbd-macro' (currently they do).
    It's more tidy; it separates 'good macros', i.e. those ended after
    'F4' or 'C-x )', from 'partial macros', i.e., those ended after an error or 'C-g'.


;;; Patch 1
--8<-----------------------------cut here---------------start------------->8---
commit ce21412d69deeffc55f2c891886351e1384f88cd
Author: Tino Calancha <tino.calancha@HIDDEN>
Date:   Fri Aug 11 21:08:48 2017 +0900

    Save aborted kbd macro definitions
    
    While a defining a kbd macro, if we get an error or if the user inputs C-g,
    then save the aborted kbd macro record (Bug#28008).
    
    * lisp/kmacro.el (kmacro-start-macro): Signal an error if APPEND is non-nil
    and last-kbd-macro is nil.
    
    * src/keyboard.c (cmd_error): Increase buffer size for macroerror
    to accommodate new error message.
    If we are defining a kbd macro and we got an error, then save the
    current progress in last-kbd-macro.
    (init_kboard): Initialize last-aborted-kbd-macro.
    (mark_kboards): Mark last-aborted-kbd-macro.
    
    * src/keyboard.h (save_aborted_kbd_macro): Declare this function.
    
    * src/macros.c (save_aborted_kbd_macro): New function.
    (store_kbd_macro_char): Call save_aborted_kbd_macro when user inputs C-g.

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
diff --git a/src/keyboard.c b/src/keyboard.c
index 97069a24ac..5111e2c358 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -941,7 +941,8 @@ static Lisp_Object
 cmd_error (Lisp_Object data)
 {
   Lisp_Object old_level, old_length;
-  char macroerror[sizeof "After..kbd macro iterations: "
+  char macroerror[sizeof "Saved aborted kbd macro in \
+`last-kbd-macro' after error: "
 		  + INT_STRLEN_BOUND (EMACS_INT)];
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -949,7 +950,13 @@ cmd_error (Lisp_Object data)
     cancel_hourglass ();
 #endif
 
-  if (!NILP (executing_kbd_macro))
+  if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
+    {
+      sprintf (macroerror,
+               "Saved aborted kbd macro in `last-kbd-macro' after error: ");
+      save_aborted_kbd_macro (false);
+    }
+  else if (!NILP (executing_kbd_macro))
     {
       if (executing_kbd_macro_iterations == 1)
 	sprintf (macroerror, "After 1 kbd macro iteration: ");
diff --git a/src/keyboard.h b/src/keyboard.h
index 2219c01135..676ccd83cc 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -463,6 +463,8 @@ extern bool lucid_event_type_list_p (Lisp_Object);
 extern void kbd_buffer_store_event (struct input_event *);
 extern void kbd_buffer_store_buffered_event (union buffered_input_event *,
 					     struct input_event *);
+extern Lisp_Object save_aborted_kbd_macro (bool);
+
 INLINE void
 kbd_buffer_store_event_hold (struct input_event *event,
 			     struct input_event *hold_quit)
diff --git a/src/macros.c b/src/macros.c
index f0ffda3f44..8e45b5fce7 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -39,15 +39,50 @@ EMACS_INT executing_kbd_macro_iterations;
 
 Lisp_Object executing_kbd_macro;
 
+/* Save the aborted macro.
+   Called if an error happens, or if the user inputs C-g,
+   while defining a kbd macro.  */
+
+Lisp_Object
+save_aborted_kbd_macro (bool msg)
+{
+  struct kboard *kb = current_kboard;
+  /* Must contain something; otherwise don't save it. */
+  if (kb->kbd_macro_end != kb->kbd_macro_buffer)
+    {
+      end_kbd_macro ();
+      if (msg)
+        {
+          message1 ("Saved aborted kbd macro in `last-kbd-macro'");
+          /* Set inhibit_quit to until sleep_for ends */
+          Vinhibit_quit = Qt;
+          Fsleep_for (make_number (1), Qnil);
+          Vinhibit_quit = Qnil;
+        }
+    }
+
+  return Qnil;
+}
+
+
 DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P",
        doc: /* Record subsequent keyboard input, defining a keyboard macro.
 The commands are recorded even as they are executed.
 Use \\[end-kbd-macro] to finish recording and make the macro available.
 Use \\[name-last-kbd-macro] to give it a permanent name.
-Non-nil arg (prefix arg) means append to last macro defined;
-this begins by re-executing that macro as if you typed it again.
-If optional second arg, NO-EXEC, is non-nil, do not re-execute last
-macro before appending to it.  */)
+A call to \\[keyboard-quit] aborts the record and sets `last-aborted-kbd-macro'.
+
+If optional arg APPEND is non-nil, then append to last macro defined;
+ this begins by re-executing that macro as if you typed it again.  Called
+ interactively with a prefix set APPEND non-nil.
+If optional second arg NO-EXEC is non-nil, do not re-execute last
+ macro before appending to it.  Called interactively with 2 prefices
+ set NO-EXEC non-nil.
+If `last-aborted-kbd-macro' is non-nil, then ask if we must
+ append on it; there are 3 possible options:
+ yes: append on `last-aborted-kbd-macro'.
+ no: append on `last-kbd-macro', if non-nil.
+ del: append on `last-aborted-kbd-macro' after skip its last character.*/)
   (Lisp_Object append, Lisp_Object no_exec)
 {
   if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
@@ -182,6 +217,10 @@ store_kbd_macro_char (Lisp_Object c)
 
   if (!NILP (KVAR (kb, defining_kbd_macro)))
     {
+      /* We received a Quit: save the current kboard in Vlast_kbd_macro */
+      if (XFASTINT (c) == quit_char)
+        save_aborted_kbd_macro (true);
+
       if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize)
 	{
 	  ptrdiff_t ptr_offset = kb->kbd_macro_ptr - kb->kbd_macro_buffer;

--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-09
Repository revision: e3ed43f4ac667d39fffcc48cfbe97b074f9aa5c7


;;; Patch 2
--8<-----------------------------cut here---------------start------------->8---
commit da8cf2a563eb25609562fe12c1dd98fc45befdf1
Author: Tino Calancha <tino.calancha@HIDDEN>
Date:   Fri Aug 11 21:09:31 2017 +0900

    Save aborted kbd macro definitions
    
    Add a new variable 'last-aborted-kbd-macro'; if we get an error, or if
    the user inputs C-g, then save the aborted kbd macro record on this
    variable.
    When called 'start-kbd-macro' with APPEND non-nil,  offer to append on
    'last-aborted-kbd-macro', if this variable is non-nil (Bug#28008).
    
    * lisp/kmacro.el (kmacro-start-macro): Signal an error if APPEND is non-nil
    and both, last-kbd-macro and last-aborted-kbd-macro are nil.
    
    * src/keyboard.c (cmd_error): Increase buffer size for macroerror
    to accommodate new error message.
    If we are defining a kbd macro, then save the current progress in
    last-aborted-kbd-macro.
    (init_kboard): Initialize last-aborted-kbd-macro.
    (mark_kboards): Mark last-aborted-kbd-macro.
    
    * src/keyboard.h (struct kboard): Add new member Vlast_aborted_kbd_macro_.
    (kset_last_aborted_kbd_macro): Add setter.
    (save_aborted_kbd_macro): Declare this function.
    
    * src/macros.c (last-aborted-kbd-macro): New variable.
    (save_aborted_kbd_macro): New function.
    (start-kbd-macro): Offer to append on last-aborted-kbd-macro, if non-nil.
    (store_kbd_macro_char): Call save_aborted_kbd_macro when user inputs C-g.

diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 2db8061fa4..2e79269fd1 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 (or last-kbd-macro last-aborted-kbd-macro)))
+        (user-error "No kbd macro has been defined"))
       (start-kbd-macro append
 		       (and append
 			    (if kmacro-execute-before-append
diff --git a/src/keyboard.c b/src/keyboard.c
index 97069a24ac..79bad93a5b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -941,7 +941,8 @@ static Lisp_Object
 cmd_error (Lisp_Object data)
 {
   Lisp_Object old_level, old_length;
-  char macroerror[sizeof "After..kbd macro iterations: "
+  char macroerror[sizeof "Saved aborted kbd macro in \
+`last-aborted-kbd-macro' after error: "
 		  + INT_STRLEN_BOUND (EMACS_INT)];
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -949,7 +950,13 @@ cmd_error (Lisp_Object data)
     cancel_hourglass ();
 #endif
 
-  if (!NILP (executing_kbd_macro))
+  if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
+    {
+      sprintf (macroerror,
+               "Saved aborted kbd macro in `last-aborted-kbd-macro' after error: ");
+      save_aborted_kbd_macro (false);
+    }
+  else if (!NILP (executing_kbd_macro))
     {
       if (executing_kbd_macro_iterations == 1)
 	sprintf (macroerror, "After 1 kbd macro iteration: ");
@@ -10864,6 +10871,7 @@ init_kboard (KBOARD *kb, Lisp_Object type)
   kb->kbd_macro_bufsize = 0;
   kset_defining_kbd_macro (kb, Qnil);
   kset_last_kbd_macro (kb, Qnil);
+  kset_last_aborted_kbd_macro (kb, Qnil);
   kb->reference_count = 0;
   kset_system_key_alist (kb, Qnil);
   kset_system_key_syms (kb, Qnil);
@@ -11977,6 +11985,7 @@ mark_kboards (void)
       mark_object (KVAR (kb, kbd_queue));
       mark_object (KVAR (kb, defining_kbd_macro));
       mark_object (KVAR (kb, Vlast_kbd_macro));
+      mark_object (KVAR (kb, Vlast_aborted_kbd_macro));
       mark_object (KVAR (kb, Vsystem_key_alist));
       mark_object (KVAR (kb, system_key_syms));
       mark_object (KVAR (kb, Vwindow_system));
diff --git a/src/keyboard.h b/src/keyboard.h
index 2219c01135..24868f6dc1 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -133,6 +133,9 @@ struct kboard
     /* Last anonymous kbd macro defined.  */
     Lisp_Object Vlast_kbd_macro_;
 
+    /* Last interrupted kbd macro.  */
+    Lisp_Object Vlast_aborted_kbd_macro_;
+
     /* Alist of system-specific X windows key symbols.  */
     Lisp_Object Vsystem_key_alist_;
 
@@ -207,6 +210,11 @@ kset_last_kbd_macro (struct kboard *kb, Lisp_Object val)
   kb->Vlast_kbd_macro_ = val;
 }
 INLINE void
+kset_last_aborted_kbd_macro (struct kboard *kb, Lisp_Object val)
+{
+  kb->Vlast_aborted_kbd_macro_ = val;
+}
+INLINE void
 kset_prefix_arg (struct kboard *kb, Lisp_Object val)
 {
   kb->Vprefix_arg_ = val;
@@ -463,6 +471,8 @@ extern bool lucid_event_type_list_p (Lisp_Object);
 extern void kbd_buffer_store_event (struct input_event *);
 extern void kbd_buffer_store_buffered_event (union buffered_input_event *,
 					     struct input_event *);
+extern Lisp_Object save_aborted_kbd_macro (bool);
+
 INLINE void
 kbd_buffer_store_event_hold (struct input_event *event,
 			     struct input_event *hold_quit)
diff --git a/src/macros.c b/src/macros.c
index f0ffda3f44..6c33d420c7 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -39,15 +39,53 @@ EMACS_INT executing_kbd_macro_iterations;
 
 Lisp_Object executing_kbd_macro;
 
+/* Save the aborted macro.
+   Called if an error happens, or if the user inputs C-g,
+   while defining a kbd macro.  */
+
+Lisp_Object
+save_aborted_kbd_macro (bool msg)
+{
+  struct kboard *kb = current_kboard;
+  Lisp_Object last_macro = KVAR (kb, Vlast_kbd_macro);
+  /* Must contain something; otherwise don't save it. */
+  if (kb->kbd_macro_end != kb->kbd_macro_buffer)
+    {
+      end_kbd_macro ();
+      kset_last_aborted_kbd_macro (kb, KVAR (kb, Vlast_kbd_macro));
+      kset_last_kbd_macro (kb, last_macro);
+      if (msg)
+        {
+          message1 ("Saved aborted kbd macro in `last-aborted-kbd-macro'");
+          /* Set inhibit_quit to until sleep_for ends */
+          Vinhibit_quit = Qt;
+          Fsleep_for (make_number (1), Qnil);
+          Vinhibit_quit = Qnil;
+        }
+    }
+
+  return Qnil;
+}
+
+
 DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P",
        doc: /* Record subsequent keyboard input, defining a keyboard macro.
 The commands are recorded even as they are executed.
 Use \\[end-kbd-macro] to finish recording and make the macro available.
 Use \\[name-last-kbd-macro] to give it a permanent name.
-Non-nil arg (prefix arg) means append to last macro defined;
-this begins by re-executing that macro as if you typed it again.
-If optional second arg, NO-EXEC, is non-nil, do not re-execute last
-macro before appending to it.  */)
+A call to \\[keyboard-quit] aborts the record and sets `last-aborted-kbd-macro'.
+
+If optional arg APPEND is non-nil, then append to last macro defined;
+ this begins by re-executing that macro as if you typed it again.  Called
+ interactively with a prefix set APPEND non-nil.
+If optional second arg NO-EXEC is non-nil, do not re-execute last
+ macro before appending to it.  Called interactively with 2 prefices
+ set NO-EXEC non-nil.
+If `last-aborted-kbd-macro' is non-nil, then ask if we must
+ append on it; there are 3 possible options:
+ yes: append on `last-aborted-kbd-macro'.
+ no: append on `last-kbd-macro', if non-nil.
+ del: append on `last-aborted-kbd-macro' after skip its last character.*/)
   (Lisp_Object append, Lisp_Object no_exec)
 {
   if (!NILP (KVAR (current_kboard, defining_kbd_macro)))
@@ -79,9 +117,59 @@ macro before appending to it.  */)
       int incr = 30;
       ptrdiff_t i, len;
       bool cvt;
+      Lisp_Object last_macro = KVAR (current_kboard, Vlast_kbd_macro);
+      /* If true, then drop last character from the aborted macro. */
+      bool del_last;
+      /* If there is a previous aborted macro, offer to use it. */
+      if (!NILP (KVAR (current_kboard, Vlast_aborted_kbd_macro)))
+        {
+          Lisp_Object ans;
+          bool loop_end = 1;
+          AUTO_STRING (prompt, "Use aborted macro? [yes, no, del] ");
+          while (loop_end)
+            {
+              ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil,
+                                                      Qnil, Qnil, Qnil));
+              if (SCHARS (ans) == 3 && (!strcmp (SSDATA (ans), "yes")
+                                        || !strcmp (SSDATA (ans), "del")))
+                {
+                  last_macro = KVAR (current_kboard, Vlast_aborted_kbd_macro);
+                  /* We cannot execute an aborted macro */
+                  if (NILP (no_exec))
+                    {
+                      message1 ("We cannot execute an aborted macro");
+                      no_exec = Qt;
+                    }
+                  if (!strcmp (SSDATA (ans), "del"))
+                    {
+                      del_last = 1;
+                      /* current_kboard->kbd_macro_end--; */
+                      /* current_kboard->kbd_macro_ptr--; */
+                    }
+                  loop_end = 0;
+                }
+              else if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no"))
+                {
+                  if (!NILP (KVAR (current_kboard, Vlast_kbd_macro)))
+                    last_macro = KVAR (current_kboard, Vlast_kbd_macro);
+                  else
+                    error ("No kbd macro has been defined");
+                  loop_end = 0;
+                }
+              else
+                {
+                  Fding (Qnil);
+                  Fdiscard_input ();
+                  message1 ("Please answer yes or no or del");
+                  Fsleep_for (make_number (2), Qnil);
+                }
+            }
+          kset_last_aborted_kbd_macro (current_kboard, Qnil);
+        }
 
       /* Check the type of last-kbd-macro in case Lisp code changed it.  */
-      len = CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro));
+      len = CHECK_VECTOR_OR_STRING (last_macro);
+      if (del_last) len--;
 
       /* Copy last-kbd-macro into the buffer, in case the Lisp code
 	 has put another macro there.  */
@@ -93,11 +181,11 @@ macro before appending to it.  */)
 		   sizeof *current_kboard->kbd_macro_buffer);
 
       /* Must convert meta modifier when copying string to vector.  */
-      cvt = STRINGP (KVAR (current_kboard, Vlast_kbd_macro));
+      cvt = STRINGP (last_macro);
       for (i = 0; i < len; i++)
 	{
 	  Lisp_Object c;
-	  c = Faref (KVAR (current_kboard, Vlast_kbd_macro), make_number (i));
+	  c = Faref (last_macro, make_number (i));
 	  if (cvt && NATNUMP (c) && (XFASTINT (c) & 0x80))
 	    XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80));
 	  current_kboard->kbd_macro_buffer[i] = c;
@@ -109,8 +197,7 @@ macro before appending to it.  */)
       /* Re-execute the macro we are appending to,
 	 for consistency of behavior.  */
       if (NILP (no_exec))
-	Fexecute_kbd_macro (KVAR (current_kboard, Vlast_kbd_macro),
-			    make_number (1), Qnil);
+	Fexecute_kbd_macro (last_macro, make_number (1), Qnil);
 
       message1 ("Appending to kbd macro...");
     }
@@ -182,6 +269,10 @@ store_kbd_macro_char (Lisp_Object c)
 
   if (!NILP (KVAR (kb, defining_kbd_macro)))
     {
+      /* We received a Quit: save the current kboard in Vlast_aborted_kbd_macro */
+      if (XFASTINT (c) == quit_char)
+        save_aborted_kbd_macro (true);
+
       if (kb->kbd_macro_ptr - kb->kbd_macro_buffer == kb->kbd_macro_bufsize)
 	{
 	  ptrdiff_t ptr_offset = kb->kbd_macro_ptr - kb->kbd_macro_buffer;
@@ -374,4 +465,7 @@ This is nil when not executing a keyboard macro.  */);
 
   DEFVAR_KBOARD ("last-kbd-macro", Vlast_kbd_macro,
 		 doc: /* Last kbd macro defined, as a string or vector; nil if none defined.  */);
+
+  DEFVAR_KBOARD ("last-aborted-kbd-macro", Vlast_aborted_kbd_macro,
+		 doc: /* Last aborted kbd macro, as a string or vector; nil if none exist.  */);
 }

--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-09
Repository revision: e3ed43f4ac667d39fffcc48cfbe97b074f9aa5c7




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.

Message received at 28008 <at> debbugs.gnu.org:


Received: (at 28008) by debbugs.gnu.org; 8 Aug 2017 17:16:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 08 13:16:21 2017
Received: from localhost ([127.0.0.1]:52176 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1df87B-0002ZU-1B
	for submit <at> debbugs.gnu.org; Tue, 08 Aug 2017 13:16:21 -0400
Received: from mail-qt0-f182.google.com ([209.85.216.182]:34238)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vianchielfaura@HIDDEN>) id 1df879-0002ZI-Gn
 for 28008 <at> debbugs.gnu.org; Tue, 08 Aug 2017 13:16:19 -0400
Received: by mail-qt0-f182.google.com with SMTP id s6so23343292qtc.1
 for <28008 <at> debbugs.gnu.org>; Tue, 08 Aug 2017 10:16:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to
 :cc; bh=uj9W194X/5iOaGj1nxrv/cwHxeZCth6xxq+37XP1Slk=;
 b=P3gbUO1dIco/eIQ5kP0auxbuQfFVh5dvbe8ksc+ivgHARxXXIxCJJ5joLVc6bjsZB+
 Pw1KpVTyK/hT0kiM0Jw8j9YD2l6HlDVtwU89v68QyqEh+fXHcGfsHmpbz0ZLS8ZaSPIr
 Vi+BttAQd0J+BvzVzR8bR3OQKPXs7kg21y/tGsggJo4+XVzmLsmJs28vB0PxcMGC8Xl5
 DXZoHv2j4/4WaLooViQ4LTJxl8uSZgCsSNYZKs5RFLI5AEx+UuP0RtkDNwxZ0JDiqPFZ
 Tuowp7EUB6V4OQ5qxI8zPU0E0qkGCjWxx/pfvTCVuWsQAp0/p0nDEztoGlpnDxVFPTWE
 4AFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:in-reply-to:references:from:date
 :message-id:subject:to:cc;
 bh=uj9W194X/5iOaGj1nxrv/cwHxeZCth6xxq+37XP1Slk=;
 b=fIJgY+jMl+s8Lij7nhbNKNyM9OCKiqLHbnBuP1sUuaQsc7yvtRoTsphIGEqOCLxZfE
 9KQc1zpXXacEc86f9yc39AM0iAp1jl6U0zbozA49asF7h3Iu9A9GhmFY9ISis5IrldJH
 XHgaxxlsaGRSMnFOnqu4RuaSzcGPU24RV74Ek2lHjtmKBoCM6dPzmIea8Mr34X9YPnoN
 uVafrs53nS7CoSd5izeR81o1uGxA8GfmafS3KVAEIfg6kGiJquB3SwajZgto5N2p7eFC
 Um6B35zIjFbxxX7bzTHk4LPVdY60nezaKHNyCBhf1oyiJOKULWimRU+iIhWiQ4OSyBk3
 F/Pg==
X-Gm-Message-State: AHYfb5iw4hJjY+cl9hb9EAC33+nq12heEE+wD1cntekpHF0JYtfOI0rg
 krvAq0SUwHoJnSJTvMOZIk/wE7vtUQ==
X-Received: by 10.237.33.68 with SMTP id 62mr6909916qtc.65.1502212573741; Tue,
 08 Aug 2017 10:16:13 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.200.52.237 with HTTP; Tue, 8 Aug 2017 10:16:13 -0700 (PDT)
In-Reply-To: <87d1867hpd.fsf@calancha-pc>
References: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
 <87d1867hpd.fsf@calancha-pc>
From: Allen Li <vianchielfaura@HIDDEN>
Date: Tue, 8 Aug 2017 10:16:13 -0700
Message-ID: <CAJr1M6eAYF93THiZs_JySOPKkYis62dM2QkNXMp8aV+sR3LCkg@HIDDEN>
Subject: Re: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
To: Tino Calancha <tino.calancha@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 2.2 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  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
 [...] Content analysis details:   (2.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (vianchielfaura[at]gmail.com)
 1.1 TRACKER_ID             BODY: Incorporates a tracking ID number
 0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
 [209.85.216.182 listed in dnsbl.sorbs.net]
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
 trust [209.85.216.182 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [209.85.216.182 listed in wl.mailspike.net]
 1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
 0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 28008
Cc: Eli Zaretskii <eliz@HIDDEN>, 28008 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.2 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  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
    [...] 
 
 Content analysis details:   (2.2 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
                             [209.85.216.182 listed in dnsbl.sorbs.net]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [209.85.216.182 listed in wl.mailspike.net]
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
                             trust
                             [209.85.216.182 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail provider
                             (vianchielfaura[at]gmail.com)
  1.1 TRACKER_ID             BODY: Incorporates a tracking ID number
  1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
  0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders

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@HIDDEN> wrote:
> Allen Li <vianchielfaura@HIDDEN> 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@HIDDEN>
> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.

Message received at 28008 <at> debbugs.gnu.org:


Received: (at 28008) by debbugs.gnu.org; 8 Aug 2017 05:27:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 08 01:27:08 2017
Received: from localhost ([127.0.0.1]:50988 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dex2q-0000UA-GN
	for submit <at> debbugs.gnu.org; Tue, 08 Aug 2017 01:27:08 -0400
Received: from mail-oi0-f65.google.com ([209.85.218.65]:37127)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tino.calancha@HIDDEN>) id 1dex2o-0000Tf-VH
 for 28008 <at> debbugs.gnu.org; Tue, 08 Aug 2017 01:27:07 -0400
Received: by mail-oi0-f65.google.com with SMTP id j194so2281309oib.4
 for <28008 <at> debbugs.gnu.org>; Mon, 07 Aug 2017 22:27:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=w8OwH6pbVdo3UGQc2V9eU7kflzNwel71ecyN0+cLToA=;
 b=gvVpz0QXbM31vN0wYH4huZUTmkFZphFr/257TeReEZYJTe2hfUA1EPgJ2EHG+Tt91t
 jbTK5dB79YgN3CFEsRpVH4yY9bFING7UP95jIfwdN+dUww5wA/17rVLwx/RHKrgNBQa1
 vwnU7wei86Bcr2sENBi1IcqbycLsCkgxtd9nz8kXsRsQrGvu55q3oFl2Mn1jt4CDimaO
 KpBX5+5MN/iDIz7r/txeljG2wjxeCZFfPAm27LMZPKUBuSg7wsn8xAFpVqMyszk0s/3q
 ZEprKIxy3/4slgCkGGdnCcwlbIG5EpwYaGg/PPKRwtzItEi3QHqRtwydihfYXfWe/Wpf
 qmhA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=w8OwH6pbVdo3UGQc2V9eU7kflzNwel71ecyN0+cLToA=;
 b=Q1brX2bC2WSNHk9xSmHCDsGBvw66i6mPMnHcN/jWHz6HwPFZiDbONeot5joEsmM0n2
 QvMuC42DKMVNq9TFC5eFklq1FH32tdraWeK1YrnpbBSZ931sGL5uo73AMlLrYnaJZXAY
 HEu0VZAHEwyi7k1CKsCyurcVzqV5dISkbO//6J2xDdAuhD+Mdx+0sbOo3OGBkES8Rtn6
 uUh8eLMxq7ycHauotTbgZ4c3Zpx+735B3UY5Vkb1oA7J0iEwi4fWnlWHP1xzUQTSBRxg
 TC7ZSf/YUz1QqdcEK4awLp8tdeTIJLTGB1CoszZe0MDcL1CgUOUuQZb5MAXS/04c7j5y
 XXfg==
X-Gm-Message-State: AHYfb5ha8EuTlgPxgdc8ADN4pKkjwyz0F+hin40XVV/N41UGEDQsxQdw
 ILc8bTbXjm+TKg==
X-Received: by 10.84.232.205 with SMTP id x13mr3382201plm.432.1502170020887;
 Mon, 07 Aug 2017 22:27:00 -0700 (PDT)
Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170])
 by smtp.gmail.com with ESMTPSA id
 v9sm682157pgo.39.2017.08.07.22.26.58
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Mon, 07 Aug 2017 22:27:00 -0700 (PDT)
From: Tino Calancha <tino.calancha@HIDDEN>
To: Allen Li <vianchielfaura@HIDDEN>
Subject: Re: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
References: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
Date: Tue, 08 Aug 2017 14:26:54 +0900
In-Reply-To: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
 (Allen Li's message of "Mon, 7 Aug 2017 21:10:50 -0700")
Message-ID: <87d1867hpd.fsf@calancha-pc>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Allen Li 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. [...] 
 Content analysis details:   (1.8 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
 trust [209.85.218.65 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
 [209.85.218.65 listed in wl.mailspike.net]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (tino.calancha[at]gmail.com)
 0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
 [209.85.218.65 listed in dnsbl.sorbs.net]
 1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
 0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 28008
Cc: Eli Zaretskii <eliz@HIDDEN>, 28008 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.8 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Allen Li 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. [...] 
 
 Content analysis details:   (1.8 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.5 RCVD_IN_SORBS_SPAM     RBL: SORBS: sender is a spam source
                             [209.85.218.65 listed in dnsbl.sorbs.net]
 -0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [209.85.218.65 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
                             trust
                             [209.85.218.65 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail provider
                             (tino.calancha[at]gmail.com)
  1.3 GAPPY_SUBJECT          Subject: contains G.a.p.p.y-T.e.x.t
  0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 -0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders

Allen Li <vianchielfaura@HIDDEN> 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@HIDDEN>
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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 8 Aug 2017 04:11:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 08 00:11:13 2017
Received: from localhost ([127.0.0.1]:50978 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1devrN-000768-N1
	for submit <at> debbugs.gnu.org; Tue, 08 Aug 2017 00:11:13 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48487)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <vianchielfaura@HIDDEN>) id 1devrL-00075w-UJ
 for submit <at> debbugs.gnu.org; Tue, 08 Aug 2017 00:11:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <vianchielfaura@HIDDEN>) id 1devrB-0003Ik-PM
 for submit <at> debbugs.gnu.org; Tue, 08 Aug 2017 00:11:06 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: **
X-Spam-Status: No, score=2.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 GAPPY_SUBJECT,T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:57925)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <vianchielfaura@HIDDEN>)
 id 1devrB-0003IV-Lo
 for submit <at> debbugs.gnu.org; Tue, 08 Aug 2017 00:11:01 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39427)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <vianchielfaura@HIDDEN>) id 1devr6-0001Fq-Fn
 for bug-gnu-emacs@HIDDEN; Tue, 08 Aug 2017 00:11:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <vianchielfaura@HIDDEN>) id 1devr1-00033e-CA
 for bug-gnu-emacs@HIDDEN; Tue, 08 Aug 2017 00:10:56 -0400
Received: from mail-qt0-x229.google.com ([2607:f8b0:400d:c0d::229]:36308)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <vianchielfaura@HIDDEN>)
 id 1devr1-00032l-6X
 for bug-gnu-emacs@HIDDEN; Tue, 08 Aug 2017 00:10:51 -0400
Received: by mail-qt0-x229.google.com with SMTP id v29so13666494qtv.3
 for <bug-gnu-emacs@HIDDEN>; Mon, 07 Aug 2017 21:10:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=qE6MTWnl9RsBspi91I8KsVsg/Mcuj5bplYz1Lw2rn8o=;
 b=Ptg02EZfcCB6vg7g2g9DhTxXZbTfVK8TxvJnOf0ThIP8vVk6Npc7FJyVojG5WJk36G
 I+jiNY4wfKkUA4oyrjgPeaog2+hCxCGIISuH8xi6OFlhZWaA60CcQRDUbyc0uRwd7GsK
 fm9qGPlC5xDyfMuU4jtgR6wf/T7/SjE02i+URRIlfb7nPhL089tIJU+8WCHdOoPci7b1
 TBknQN9k5reRXYDAjGAa59/IYFMiB4kd5AHfGvbl6N6tHh7HhFicALpOo7meLVbCnY+p
 JOjh6WAS6GWvJ5wOcCffRR/pLYdtJX8UaUM3TxMKi+ZQ8jT0IClhAFIVEClWzeHxBLJI
 Mwwg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=qE6MTWnl9RsBspi91I8KsVsg/Mcuj5bplYz1Lw2rn8o=;
 b=lsSbgUACWjW4kHXh3Nqwm35o5ReK+of6ICJsWnR7l0gbwkbLeTYP/gzo97M23jonxo
 /hLW8X9HDw5vL6SmEuhjNgWeSkeo3tatO6X3YBoU347WEsH29mDEwrYyQfbk8vdV9Mwg
 PHeNNnUDhEZLrJeWIot995M5Kd7snwxsmE43c86vYJPGXqSGHU9PZA3b7flAnlRIJ8eK
 dz+nGsUF+wcEmhM7YrFHm3ryhvqCCFlPXxfNAUMPbD/fBfGtI6Kzs+4qxkNfB0qaet5d
 8Kh0GErNzhDUu9hzkNPGWbKHK4m2UTPhVVEj5gwKEYPWJ8JA2sBqqNIpeO0RwxQR0yTa
 Hx5w==
X-Gm-Message-State: AHYfb5jcjiwcM0ujrHas+dAib9RaJY9HQSS0DtqfVVF6VslDdyhFe3IE
 Ya2x0X2Z3UFPGrlpn9eHi+qVLclOAcF0
X-Received: by 10.237.40.69 with SMTP id r63mr4109890qtd.72.1502165450615;
 Mon, 07 Aug 2017 21:10:50 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.142.67 with HTTP; Mon, 7 Aug 2017 21:10:50 -0700 (PDT)
From: Allen Li <vianchielfaura@HIDDEN>
Date: Mon, 7 Aug 2017 21:10:50 -0700
Message-ID: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@HIDDEN>
Subject: 25.2; Resume kmacro definition errors C-u C-u <F3>
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.7 (--)

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)
  kmacro-start-macro((16))
  kmacro-start-macro-or-insert-counter((16))
  funcall-interactively(kmacro-start-macro-or-insert-counter (16))
  call-interactively(kmacro-start-macro-or-insert-counter nil nil)
  command-execute(kmacro-start-macro-or-insert-counter)


In GNU Emacs 25.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8),
modified by Debian
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description: Ubuntu 14.04 LTS

Configured using:
 'configure --build x86_64-linux-gnu --build x86_64-linux-gnu
 --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --with-crt-dir=/usr/lib/x86_64-linux-gnu --disable-build-details
 --disable-silent-rules --with-modules GOOGLE_VERSION=25.2+gg1+8
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 build_alias=x86_64-linux-gnu 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro
 -Wl,-fuse-ld=gold,--export-dynamic-symbol=__google_auxv'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2 -DGOOGLE_EMACS_DEFINE_AUXV''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES




Acknowledgement sent to Allen Li <vianchielfaura@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#28008; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 18 Sep 2017 20:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.