From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Allen Li Newsgroups: gmane.emacs.bugs Subject: bug#28008: 25.2; Resume kmacro definition errors C-u C-u Date: Tue, 8 Aug 2017 10:16:13 -0700 Message-ID: References: <87d1867hpd.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1502212632 27260 195.159.176.226 (8 Aug 2017 17:17:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 8 Aug 2017 17:17:12 +0000 (UTC) Cc: 28008@debbugs.gnu.org To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 08 19:17:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1df87u-0006dR-3n for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Aug 2017 19:17:06 +0200 Original-Received: from localhost ([::1]:43788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df880-0003pW-9E for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Aug 2017 13:17:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1df87u-0003pF-V7 for bug-gnu-emacs@gnu.org; Tue, 08 Aug 2017 13:17:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1df87r-000122-L1 for bug-gnu-emacs@gnu.org; Tue, 08 Aug 2017 13:17:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43496) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1df87r-00011y-HB for bug-gnu-emacs@gnu.org; Tue, 08 Aug 2017 13:17:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1df87p-0002aX-NK for bug-gnu-emacs@gnu.org; Tue, 08 Aug 2017 13:17:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Allen Li Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Aug 2017 17:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28008 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28008-submit@debbugs.gnu.org id=B28008.15022125819893 (code B ref 28008); Tue, 08 Aug 2017 17:17:01 +0000 Original-Received: (at 28008) by debbugs.gnu.org; 8 Aug 2017 17:16:21 +0000 Original-Received: from localhost ([127.0.0.1]:52176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1df87B-0002ZU-1B for submit@debbugs.gnu.org; Tue, 08 Aug 2017 13:16:21 -0400 Original-Received: from mail-qt0-f182.google.com ([209.85.216.182]:34238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1df879-0002ZI-Gn for 28008@debbugs.gnu.org; Tue, 08 Aug 2017 13:16:19 -0400 Original-Received: by mail-qt0-f182.google.com with SMTP id s6so23343292qtc.1 for <28008@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) Original-Received: by 10.200.52.237 with HTTP; Tue, 8 Aug 2017 10:16:13 -0700 (PDT) In-Reply-To: <87d1867hpd.fsf@calancha-pc> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135576 Archived-At: 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 wrote: > 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. > > 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 > 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