From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id gFFdK34GbmKS2QAAbAwnHQ (envelope-from ) for ; Sun, 01 May 2022 06:03:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id YHN0K34GbmJvAAEAauVa8A (envelope-from ) for ; Sun, 01 May 2022 06:03:10 +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 3CEC3EF47 for ; Sun, 1 May 2022 06:03:10 +0200 (CEST) Received: from localhost ([::1]:47122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nl0nd-0002mK-3R for larch@yhetil.org; Sun, 01 May 2022 00:03:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nl0l5-0002lg-La for emacs-orgmode@gnu.org; Sun, 01 May 2022 00:00:33 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:42741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nl0l3-0004Kx-6l for emacs-orgmode@gnu.org; Sun, 01 May 2022 00:00:30 -0400 Received: by mail-pj1-x102c.google.com with SMTP id l11-20020a17090a49cb00b001d923a9ca99so10377722pjm.1 for ; Sat, 30 Apr 2022 21:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=z0GL2S/YfVEfpa92jfG5lVBtCIJA9ML303hQXrhvMVs=; b=pde1LUVan+GsiZYqakqfontoGPBZNbvbmb4Megi9/6tALOnm+ZuGjYCTIk7nGsdD5u L1I7hfxzenjkH5Bg+Qe9Qpg10/bmj0E0QyTnhB5R3EemhGTZyGAnE01dR/7vctXzCBn9 /m1ZB3ueao1RfASOVXv/O1g/76NpvY8xnfq/8wEP5WxWkfOrHrXVSJJtyMh2LrD0rrhM LP3t8Ge911qo7r5FGwYx2HdXXf5dz5M+WrLqShRj0E3xL6TSq4xqhdvRtshuX1XPvBsm /fV1wkprQWwODRZ6o87BxfX7WRVjdh2xEioZr9714eASECHNU9/SrFtn48hEV2+miiEi sOZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=z0GL2S/YfVEfpa92jfG5lVBtCIJA9ML303hQXrhvMVs=; b=rVluAX3ehY5pqeVs38hnCixV/dHoclrJa1u4yN6znFs69DfxHLWenY1PeNJaL05CIA 602zWniC7GpNF5NNFxEh/hBYv89dJgTmb+0nDbP41BCvj50E18qauUeQxgdfJF6jfRH5 GvIIPApjVfGrY8wigtoJ/XWESQc3HT0FgPw8XPQQYEZTkRlmHuo68MBmM08VswyoBNP2 px7iAxm5MrNoj2r/XUDr80bSyE/vHNW9S1VlCRULh7YgVLTwmp6HiKAc5fSr5c4vwEAA Y/eAqc1m5yL6vvEF1cz32SkWlIkK3gdm3UeJsPXPogSfHTlcbFv5v3+Ogh1NHmc7QWkP RSPQ== X-Gm-Message-State: AOAM532BwlOVqJBe2aIzctMqLE+puTaHWs7wpplclsKeo/UtPIrOU5V+ LdJfpPGcxWkJhMzNsdPhI/I= X-Google-Smtp-Source: ABdhPJyHm5xlUDqlibqur9uP2IeJsOLibKO6ECoAWdOwJiQ3nuSutyjMYPW2StkkF+AzEicOHqYU+Q== X-Received: by 2002:a17:902:7045:b0:157:144:57c5 with SMTP id h5-20020a170902704500b00157014457c5mr6301691plt.86.1651377627290; Sat, 30 Apr 2022 21:00:27 -0700 (PDT) Received: from localhost ([103.125.234.210]) by smtp.gmail.com with ESMTPSA id k18-20020aa78212000000b0050dc76281d8sm2287873pfi.178.2022.04.30.21.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 21:00:26 -0700 (PDT) From: Ihor Radchenko To: Juan Manuel =?utf-8?Q?Mac=C3=ADas?= Subject: Re: [PATCH] speed commands: error message when a key is not associated with a command In-Reply-To: <87k0b6vdkx.fsf@posteo.net> References: <87pmkyvmmk.fsf@posteo.net> <87y1zm7ma5.fsf@localhost> <87k0b6vdkx.fsf@posteo.net> Date: Sun, 01 May 2022 12:01:16 +0800 Message-ID: <877d757vg3.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=yantar92@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" 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=1651377790; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=z0GL2S/YfVEfpa92jfG5lVBtCIJA9ML303hQXrhvMVs=; b=T7rjs0kNiEoX4WEPnehUtD4tyx1i9VbSoyqSeIsLoz0iq40rlVpJImF5aqYxFE1xt4e3b+ Ib8icMCFT+Kf9/md1oQD4FxCU/3Z4LEGaAMad5lPqGT8rGVu3jBLhMuuXECfQcpdNjYx/U dn8qRBaCUny4gscaTFyct4NUQQGGD4Dr2DqjZW1/Okl5JNdI7qfJ4dHeMYeQnlTht31KAs VR/paGkHWb6bFTRpWC7x1p8utXbh7P5pgRLhqgfkM2GBhhFBRVOHU+obp3FZI0V2XtFlxY nelqksTQa58TgynDamToXkjw0yX9JBtwBrQKmGivgocPGt9k1SVmFdHSheZsSw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651377790; a=rsa-sha256; cv=none; b=AuVIPpVjJ48LYoOCZwd71jzmQklPBp7yQMgPK3A58SWT8Gwdj8bNoBdMZ5C2rfGNReF5Zb 4JYaO3uZlaCaV02KII2q7/9XkDRgs4AwV3AD7iAQISV+B088PDCQNPp+ao7Gp3dG1kmVRT sQYkxrmRkaoMcO9bpwgyjs/oZkgiTAvVccfcoj911qRxg9ur2gLOg8ZgAHZDCA4Y2NJDmY +ZE+Q6OsJWJuddDNPiwoqkc3Pw2PgR4S5aT8xaBG+N3cqjc7sZ2bexklASt9sp0YZr9c0g y90wLUt5A38rdibyUy1oHGLw32HbaVYeGr7eMamR5MrDWNbB2Z/JYDiiekrzog== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=pde1LUVa; dmarc=pass (policy=none) header.from=gmail.com; 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: -1.99 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=pde1LUVa; dmarc=pass (policy=none) header.from=gmail.com; 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: 3CEC3EF47 X-Spam-Score: -1.99 X-Migadu-Scanner: scn1.migadu.com X-TUID: GVwwlCMNySvv Juan Manuel Mac=C3=ADas writes: > 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. You are mostly correct, with one potential caveat. Consider a user who wants to define extra speed command that should run at the beginning of level 1 headlines. This context also matches the context of org-babel-speed-command-activate and your proposed patch will make it harder for the user to achieve the described behaviour. On the other hand, the user could simply add to front of the org-speed-command-hook given that blocking behaviour of org-babel-speed-command-activate is well-documented. > 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): This would not solve the problem of shadowing. It may be better idea to provide a custom variable controlling org-babel-speed-command-activate: do nothing or throw an error. This custom variable should also be described in the docstring of org-speed-command-hook to warn about potential shadowing. To summarise, your idea will be reasonable if: 1. The new behaviour can be customized 2. The new behaviour is documented in org-speed-command-hook Best, Ihor