unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] emacs-26 f172894: Exit macro definition on undefined keys
       [not found] ` <20170930134841.1354D20514@vcs0.savannah.gnu.org>
@ 2017-09-30 17:12   ` Stefan Monnier
  2017-09-30 22:25     ` Allen Li
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2017-09-30 17:12 UTC (permalink / raw)
  To: emacs-devel; +Cc: Allen Li

> +  (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?


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Emacs-diffs] emacs-26 f172894: Exit macro definition on undefined keys
  2017-09-30 17:12   ` [Emacs-diffs] emacs-26 f172894: Exit macro definition on undefined keys Stefan Monnier
@ 2017-09-30 22:25     ` Allen Li
  2017-10-01 13:20       ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Allen Li @ 2017-09-30 22:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Sat, Sep 30, 2017 at 10:12 AM, Stefan Monnier
<monnier@iro.umontreal.ca> 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Emacs-diffs] emacs-26 f172894: Exit macro definition on undefined keys
  2017-09-30 22:25     ` Allen Li
@ 2017-10-01 13:20       ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2017-10-01 13:20 UTC (permalink / raw)
  To: emacs-devel

>    (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))))

I was thinking of using user-error regardless of defining-kbd-macro.
This also means to move the `user-error` call to the end of
the function.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-01 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170930134840.28326.3545@vcs0.savannah.gnu.org>
     [not found] ` <20170930134841.1354D20514@vcs0.savannah.gnu.org>
2017-09-30 17:12   ` [Emacs-diffs] emacs-26 f172894: Exit macro definition on undefined keys Stefan Monnier
2017-09-30 22:25     ` Allen Li
2017-10-01 13:20       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

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