help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-capture-templates constructed from three distinct functions


From: Michael Heerdegen
Subject: Re: org-capture-templates constructed from three distinct functions
Date: Sat, 12 Dec 2020 04:43:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech <dimech@gmx.com> writes:

> (defun captr-tdr ()
>    (interactive)
>    (setq org-capture-templates 'captr-templ-tdr))
                                 ^
You want the binding of the variable, that quote is wrong.

Appending template lists has the problem that you get copies added if
you accidentally reevalute your code.

You might want to consider to use `add-to-list' or `cl-pushnew' to avoid
this problem, or, alternatively, interpret and handle
`org-capture-templates' as an association list (with the key binding as
key and the definition as value).  Then you could use `setf' with
`alist-get' to add or even modify or delete entries.  This is a very
clean and convenient but more learning involving way to achieve this.

BTW, it should be possible to use buffer local `org-capture-templates'
binding.

> (global-set-key (kbd "H-c") #'captr-tdr)

Why do you want to use a key for this (instead of just evaluating the
code directly in your init file)?


Regards,

Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]