emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Shankar Rao <shankar.rao@gmail.com>
To: dal-blazej@onenetbeyond.org
Cc: emacs-orgmode@gnu.org
Subject: Re: Unintended consequences of removing org-speed-commands-user
Date: Tue, 30 Nov 2021 13:13:43 +0100	[thread overview]
Message-ID: <CAGEgU=gArfkdVsVr7_uvmpRRobi+xO4gHyveiefxa-s6moSQAQ@mail.gmail.com> (raw)
In-Reply-To: <87zgpolbnd.fsf@onenetbeyond.org>

Thank you for the tip. I didn't realize that `member' could be used in
this way to insert an element at a particular point in a list. But
this doesn't address the main issue in my post, that the user has two
different approaches for adding commands to `org-speed-commands'
depending on whether it is a brand new command or overwriting an old
one.

After thinking about it over the weekend, I believe I've come up with
a simple solution that will achieve easy addition to/ modification of
`org-speed-commands' without bringing reverting back to
`org-speed-commands-user'. I'll submit a patch for this soon

Shankar

On Sun, Nov 28, 2021 at 1:15 PM <dal-blazej@onenetbeyond.org> wrote:
>
>
> Hi,
>
> If you want to insert a new element in the list after a particular
> element, you could do :
>
> #+begin_src emacs-lisp
> (let ((bk (cdr (member '("Agenda Views etc") org-speed-commands))))
>   (setf (cdr (member '("Agenda Views etc") org-speed-commands))
>         (cons '("@" . my-foobarized-speed-command) bk)))
> #+end_src
>
> Use append to insert a list of new elements instead of one.
>
> Also simply add a new list at the end, use append :
>
> #+begin_src emacs-lisp :results code
> (setq org-speed-commands
>       (append org-speed-commands '(("my foo commands!")
>                                    ("@" . my-foobarized-speed-command)
>                                    ("&" . my-barfooized-speed-command))))
> #+end_src
>
> However if you define many new commands, simply redefining the whole
> list is simpler ;)


  reply	other threads:[~2021-11-30 12:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  9:36 Shankar Rao
2021-11-28 12:15 ` dal-blazej
2021-11-30 12:13   ` Shankar Rao [this message]
2021-11-30 14:19 ` [PATCH] New function org-speed-command-add for adding/modifying speed commands Shankar Rao
2022-05-03 10:24   ` Ihor Radchenko
2022-05-17 13:01     ` Shankar Rao
2022-05-18 13:12       ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGEgU=gArfkdVsVr7_uvmpRRobi+xO4gHyveiefxa-s6moSQAQ@mail.gmail.com' \
    --to=shankar.rao@gmail.com \
    --cc=dal-blazej@onenetbeyond.org \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: Unintended consequences of removing org-speed-commands-user' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).