emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] emacs-26 f172894: Exit macro definition on undefined k


From: Allen Li
Subject: Re: [Emacs-diffs] emacs-26 f172894: Exit macro definition on undefined keys
Date: Sat, 30 Sep 2017 15:25:28 -0700

On Sat, Sep 30, 2017 at 10:12 AM, Stefan Monnier
<address@hidden> wrote:
>> +  (if defining-kbd-macro
>> +      (error "%s is undefined" (key-description (this-single-command-keys)))
>> +    (message "%s is undefined" (key-description 
>> (this-single-command-keys))))
>
> Would user-error do the trick?

Yep.  It sounds like user-error would be the better choice here.

(I'm assuming it's okay to post patches on emacs-devel.  Apologies if it isn't.)

[PATCH] Use `user-error' to exit macro definition on undefined keys

* lisp/subr.el (undefined): Use ‘user-error’ instead of ‘error’.
---
 lisp/subr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 64479a4b5b..0bd7662b3b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -786,7 +786,7 @@ undefined
   (interactive)
   (ding)
   (if defining-kbd-macro
-      (error "%s is undefined" (key-description (this-single-command-keys)))
+      (user-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;
-- 
2.14.1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]