From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp12.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id KJFLKKNKbWK27gAAbAwnHQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 30 Apr 2022 16:41:39 +0200
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp12.migadu.com with LMTPS
	id yLdcKKNKbWKC4gAAauVa8A
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 30 Apr 2022 16:41:39 +0200
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 130938680
	for <larch@yhetil.org>; Sat, 30 Apr 2022 16:41:38 +0200 (CEST)
Received: from localhost ([::1]:56214 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1nkoHx-0001Ps-HQ
	for larch@yhetil.org; Sat, 30 Apr 2022 10:41:37 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38522)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maciaschain@posteo.net>)
 id 1nkoHH-0001PH-31
 for emacs-orgmode@gnu.org; Sat, 30 Apr 2022 10:40:56 -0400
Received: from mout02.posteo.de ([185.67.36.66]:48475)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maciaschain@posteo.net>)
 id 1nkoHF-0007uy-7z
 for emacs-orgmode@gnu.org; Sat, 30 Apr 2022 10:40:54 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 5288C240108
 for <emacs-orgmode@gnu.org>; Sat, 30 Apr 2022 16:40:50 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1651329650; bh=s1F1R8Vv4Yhy+7fi8O43tmp4oIXmZAmhBeHNNWO0uUc=;
 h=From:To:Cc:Subject:Date:From;
 b=mSUf8OjgULCb0hWry39h+Zgo4R3NWyG3sDIIXDG0bA30cQaBXnZ9J5+uc1D8TyN1e
 jDUNX7v2rPULKRnsRf86UpagsYV+Cqx5wvON1+CnWa8ifUVIYGKceymL92hComf2ng
 WjKzODabV9nH/CkNzjzuDqigw8vfqZrFMlEPlGve+xhxKnLsFoN1Bs9OVa4TRYyhcp
 gYSZ/fODeKvxGpuUeoce3yW+K/dKmqrjKGC/zX1btutzEJGSOXh8R5wNWWHIIzAzxJ
 E2rf0uFMfsdim8LxzM2dwR0nsTAgXW8RM3AFbLRxVEpPn4behXOQwpOYFBJlhcXWvx
 XXygw8+KTf3TQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4KrBqP4fH3z9rxT;
 Sat, 30 Apr 2022 16:40:49 +0200 (CEST)
From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= <maciaschain@posteo.net>
To: Ihor Radchenko <yantar92@gmail.com>
Subject: Re: [PATCH] speed commands: error message when a key is not
 associated with a command
References: <87pmkyvmmk.fsf@posteo.net> <87y1zm7ma5.fsf@localhost>
Date: Sat, 30 Apr 2022 14:41:02 +0000
In-Reply-To: <87y1zm7ma5.fsf@localhost> (Ihor Radchenko's message of "Sat, 30
 Apr 2022 21:06:58 +0800")
Message-ID: <87k0b6vdkx.fsf@posteo.net>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-orgmode@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Cc: orgmode <emacs-orgmode@gnu.org>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: "Emacs-orgmode" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
X-Migadu-To: larch@yhetil.org
X-Migadu-Country: US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1651329699;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=bPBTEbPRs8aR/YhiwGJJbQgW6EZFqqNT/BlWi+kKH+c=;
	b=ANl8dt5MZE9o+uH5Nle/HKGaJPSXBEt8P3txV37WmVRbftxYWjXj/PKHygH5kYhJl7MNgX
	nbekqMsCkb/RQSgQe/tg0ROlIUvsOlJ3r8YgjeJKHzYzDJIoUpCtlFjCbcgxRqZmAY3qbS
	SRX9iOkCc3h95DQ5UdT8CnjSL3h42Qc7ogoj8vtkNmGLHeEk26fSUuN0rSGwioLpLQct/n
	NcQxxqWEYcvnxGleYKZr1/Xkidagpjj4ojGvbPu9lrbhcv8763O7Bsp+rz2+J6m1JeU0Dd
	BEC+9aEi9v++yI/hgP2xRL21t5wisOgSbTvwAMYIbnkogamHSEz8tkByjvUoxg==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651329699; a=rsa-sha256; cv=none;
	b=WHMy2zCeB8DQbZGNdwJc06/kVzUi80E76990AoWq9uqAhkmE5G5VvAbWwZ5nceQeHJ18kP
	f/9rA3kQ/HK6on7XNRU6QOCKMHkBGJGdtZ00T+kxDBbf0GhNwO1w2JTiEMNfqSwXEbB0oB
	XhxrwFp5MnZcbBFTnBDl67NuZixRdB9js3Q7SGRh8Lv2+9Hy6cxXZuU+ZSvbHtLMrHwD+V
	wxucDpGDMGZzSy3lhymcxric3k0zZdToHSOvG71gd++UzSyKPE1arCnNd1ycGhIl7+0nl6
	+fi8fxQgr+oXL8yR7WzbtVZfJW1kU3F3ZUky0Cdk8exUnnAlhiq01iTCIdryfQ==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=mSUf8Ojg;
	dmarc=pass (policy=none) header.from=posteo.net;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Spam-Score: -2.70
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=mSUf8Ojg;
	dmarc=pass (policy=none) header.from=posteo.net;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Queue-Id: 130938680
X-Spam-Score: -2.70
X-Migadu-Scanner: scn1.migadu.com
X-TUID: /oSr29tPi0b4

Ihor Radchenko writes:

> Note that speed commands are not only decided by
> org-speed-command-activate. Any function in org-speed-command-hook can
> trigger speed command. Throwing an error in org-speed-command-activate
> can potentially shadow other functions in the hook.

Ah, I see... I had not taken into account what you mention.

But, if I have understood correctly how this hook works, each associated
function has its "independence", right? I mean, if I have
org-speed-command-activate and org-babel-speed-command-activate
associated to this hook, and I bind the "K" key to an action in
org-babel-key-bindings, but that key does not is associated with any
action in org-speed-commands, then the error message would only be
displayed in the proper context, that is, if I hit K at the beginning of
the headline or any location defined for org-use-speed-commands.

Another possibility I can think of is, instead of returning an error
message: just do nothing when a wrong key is pressed. Something, maybe,
like this (I suppose that the same should be done in each function added
to the hook):

...
(let ((defined (cdr (assoc keys
                               ;; FIXME: don't check `org-speed-commands-user' past 9.6
                               (if (boundp 'org-speed-commands-user)
                                   (append org-speed-commands
                                           org-speed-commands-user)
                                 org-speed-commands)))))
      (if defined defined
        'ignore))))

I don't know if this would avoid unexpected results...

what do you think?

Best regards,

Juan Manuel