[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unintended consequences of removing org-speed-commands-user
From: |
Shankar Rao |
Subject: |
Re: Unintended consequences of removing org-speed-commands-user |
Date: |
Tue, 30 Nov 2021 13:13:43 +0100 |
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 ;)