From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 qDTsDqGpg2J8XwEAbAwnHQ (envelope-from ) for ; Tue, 17 May 2022 15:56:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id WMvcDqGpg2IOpgAA9RJhRA (envelope-from ) for ; Tue, 17 May 2022 15:56:49 +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 CF1E5276E0 for ; Tue, 17 May 2022 15:56:48 +0200 (CEST) Received: from localhost ([::1]:46900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqxgt-00017q-Oz for larch@yhetil.org; Tue, 17 May 2022 09:56:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqwps-0004fV-Ry for emacs-orgmode@gnu.org; Tue, 17 May 2022 09:02:01 -0400 Received: from mail-vs1-xe35.google.com ([2607:f8b0:4864:20::e35]:33564) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqwpr-0000Nc-4g for emacs-orgmode@gnu.org; Tue, 17 May 2022 09:02:00 -0400 Received: by mail-vs1-xe35.google.com with SMTP id v139so18648524vsv.0 for ; Tue, 17 May 2022 06:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wBuMo/b+1KA4r/ti7jITwEf0P3G1iWaBk+jVnGuPbCQ=; b=gt2fKGZIGd9ID3V+PI8kKAY3EInWtHGdHkTITgN/HdLvac7CSfqDs4q8LquMiwPkDx hssxTwWBKIGEqkQy6uIB08D0b2rjlAlTfrSW63R1ybWYc6ydg/qiW0QK2fXtAwocBV4+ 5A976KR99uT1RTZjRgS0hVQhZm8Zs1R6P5PREZftelmNchfRISSYZqgaN91mpWe3ID1n Eq/N6qo2sSjfuyQtlLt5o3/HRZIDBfDODukpx1o+fZ1fBVMlxoF7By+8ISujudYVOVhp 0bLVJvMzttFwDJT+nzCCb0j1PJwN9p2z8JfolrUyPmuptlQT+NlqxZDvLXdOfn0SvwbO vBJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wBuMo/b+1KA4r/ti7jITwEf0P3G1iWaBk+jVnGuPbCQ=; b=L3npVwJ7lKtZ2/sSAkyHG4DVFXJT1ApVsHqzYNGa5rrvXaI1QHh4zhVn+cCkUZ9BD6 JTKo/pgW9mTIjPQ2eGtI89AwHJ2AOnNUMv3FfqUDZkyyZH4+TcAb7Gfi+L+ac4VsGo7/ kwRxC/e5BYSUG4ybn/5KhQZOsAjWuBRW0gkhJ2faJIn7jOqhwrjpFqM5c7KEsxzXaZIL peVglw+TPlLPoDjQnrIexyqIjdTzzOKbN5U+oomh+Ujc6YDDSoYiI1jDSM7T4FzHJUmr E/AiK29bPfID3ZfnO1zy0rRwBjAhlG+qUhxKzZLLm2U76lFh9RG4QDcqVQIqm2gb+qC8 8kIw== X-Gm-Message-State: AOAM530o3vLqgf/oUIyQJO5OUMKZopM6XXyxC6/XUEbZJGBNIJoASrZb kjuGL/qbnaTL00CxCY9QK/Y6LssK5dbrV9GRJQ0= X-Google-Smtp-Source: ABdhPJwnjbuRClar7YtlnC8yDrv3BFl1L6qJzF8cJyKbS5e9rNCBZrMmskg9DhyHQcXUvDWFnfB1PCWTzBD/Wy+De34= X-Received: by 2002:a67:32c2:0:b0:32c:be61:74d9 with SMTP id y185-20020a6732c2000000b0032cbe6174d9mr8620626vsy.72.1652792517288; Tue, 17 May 2022 06:01:57 -0700 (PDT) MIME-Version: 1.0 References: <87bkwe52yj.fsf@localhost> In-Reply-To: <87bkwe52yj.fsf@localhost> From: Shankar Rao Date: Tue, 17 May 2022 15:01:45 +0200 Message-ID: Subject: Re: [PATCH] New function org-speed-command-add for adding/modifying speed commands To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::e35; envelope-from=shankar.rao@gmail.com; helo=mail-vs1-xe35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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: , 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=1652795808; 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=wBuMo/b+1KA4r/ti7jITwEf0P3G1iWaBk+jVnGuPbCQ=; b=TPj6FnTzdoGX/9FevifE4y9b4Ks3rzLoez3bcDCmM3HpMxYAqn4nKHGm0Yw+CA4/M+YXK9 GmpHKNKi9tqG/GqaC/Ia4HrkogATb+DB2XLzLdYC4YY/61mEDOFJOapJbKdCi9myw5fCbj zGYvCAC+3pCSX75rIN+fdGNQl4Na/4xIfmTrsVFwgSfIRFsAd1LLJsLRQFFv8DOhLv6G12 +6GCAIL0OAVRY+30PObnT+tSvr8Uvx0i1aOcRaLUcxIin1ZkQqtZlq7JDNacRTh77z2ymR /d2/wzi/SiKiP/uw4j7svXf3YZvJeAjMjNP+iPYUGY3xuh8zTxxhf7PriTqv9w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652795808; a=rsa-sha256; cv=none; b=tc73MIESVtwlw1S9YoHBNWXNuzbI4MX882p8o409TDgAgM9Z6DrZlot21l2CvRgNgVKngU zWnmIF9Y/hScQpJnG6U3ldAM67xiIs+ncJ9LwZZ44+qS+riG4PaiKw2OuL+sckQ8W6S73I a/dJSn5hAut0wKlwx3PA4TD79wbE/D/O79a/8Nd0bOiGVsjfaXNoi/ySNafDDOcQvNAwqF PaT4XFyU17e5y5oykjl86wLsFO57UMmAf4t2o7lHMEhhbnxMBgdpsjNsDqosdfFY7mVok8 n4DqddZWeX4omH1LQ1e0uLYJYWNzpaavoC1O+02+lUwRoMBNfwnc+g6dFUnujg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gt2fKGZI; 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: -5.34 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gt2fKGZI; 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: CF1E5276E0 X-Spam-Score: -5.34 X-Migadu-Scanner: scn0.migadu.com X-TUID: jBzhpnr3sAAx Thank you for looking into this. As you recommended, I tried modifying ``org-speed-commands'' using the customize interface. While it did enable me to configure and organize ``org-speed-commands'' in just the way I would like, I found using the customize interface to be a bit cumbersome. Using the customize interface, for each command that I wished to add, I had to visually scan over the whole structure of ``org-speed-commands'' to see if the key for this command was already present in the list, and replace it with my command if it is, or prepend my command to the top of the list if not it was already present. Then after I saved the customization, it added the whole new value of ``org-speed-commands'' to the end of my init.el, making it more cluttered. Alternatively using my ``org-speed-command-add'' requires me to add a single command to my init.el containing only my modifications: (org-speed-command-add '(("N" . ded-org-show-next-heading-tidily) ("P" . ded-org-show-previous-heading-tidily) ("h" . sbr-org-speed-insert-subheading) ("f" . org-forward-heading-or-item) ("b" . org-backward-heading-or-item) ("u" . org-up-heading-or-item) ("n" . org-next-heading-or-item) ("p" . org-prev-heading-or-item))) Using ``org-speed-command-add'', I don't have to be concerned with whether or not a given key is already present in ``org-speed-commands''. I agree that ``org-speed-command-add'' has undefined behavior when provided with only a descriptive headline as its first element. Would you be more amenable to this command if it either ignored or explicitly disallowed descriptive headline entries? Shankar On Tue, May 3, 2022 at 12:23 PM Ihor Radchenko wrote: > > Shankar Rao writes: > > > Over the weekend I thought about this issue of configuring > > `org-speed-commands' more easily, and I believe I have come up with a > > simpler solution that I have provided in the attached patch. > > > > This patch creates a new function `org-speed-command-add' that can be > > used to add new speed command shortcuts to `org-speed-commands', as > > well as modify existing shortcuts. This function takes as argument an > > alist in the same format as `org-speed-commands'. For each command for > > which the shortcut key is already present in `org-speed-commands', the > > old command is replaced with the new command at the same position. > > Commands with brand new shortcut keys are added to the user section of > > `org-speed-commands'. > > > > I believe this patch strikes a balance between power users, who can > > still directly customize `org-speed-commands', and non-experts, who > > may want to add/modify some speed commands without having to > > understand the structure and organization of `org-speed-commands'. > > I am not sure about usefulness of the proposed command. For non-power > users, we have cusomize interface. It should work just fine without a > need to introduce another function. > > Also, org-speed-command-add may behave strangely if the argument > contains descriptive headline like ("My command group title") as its > first element. > > Best, > Ihor