all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Allen Li <vianchielfaura@gmail.com>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: 28008@debbugs.gnu.org
Subject: bug#28008: 25.2; Resume kmacro definition errors C-u C-u <F3>
Date: Tue, 19 Sep 2017 00:42:21 -0700	[thread overview]
Message-ID: <CAJr1M6fTpMvFW0==YGstHPakjjbPwEm9cGhtQ0RLdw8XUvq++A@mail.gmail.com> (raw)
In-Reply-To: <CAJr1M6fxVpiZTOym9mOZm20DmNB=nCCcruCb=fTLMHRaPGGHfw@mail.gmail.com>

On Mon, Sep 18, 2017 at 1:02 PM, Allen Li <vianchielfaura@gmail.com> wrote:
> On Fri, Aug 11, 2017 at 6:17 AM, Tino Calancha <tino.calancha@gmail.com> 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.

Actually, to fix case D.2 (where undefined keys exit kmacro definition
without saving), all that is needed is a short Emacs Lisp change.
This keeps the behavior of a bare C-g keyboard-abort of not saving the
kmacro.

[PATCH] Make undefined keys exit and save kmacro definition

* lisp/subr.el (undefined): Error out of kmacro definition.
---
 lisp/subr.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 79ae1f4830..f0c4e2969d 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -785,8 +785,9 @@ undefined
   "Beep to tell the user this binding is undefined."
   (interactive)
   (ding)
-  (message "%s is undefined" (key-description (this-single-command-keys)))
-  (setq defining-kbd-macro nil)
+  (if defining-kbd-macro
+      (error "%s is undefined" (key-description (this-single-command-keys)))
+    (message "%s is undefined" (key-description (this-single-command-keys))))
   (force-mode-line-update)
   ;; If this is a down-mouse event, don't reset prefix-arg;
   ;; pass it to the command run by the up event.
-- 
2.14.1





  parent reply	other threads:[~2017-09-19  7:42 UTC|newest]

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

Reply instructions:

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

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

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

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

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

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

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

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.