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: Christopher Dimech
Subject: Re: org-capture-templates constructed from three distinct functions
Date: Sat, 12 Dec 2020 04:51:38 +0100

> Sent: Saturday, December 12, 2020 at 4:43 AM
> From: "Michael Heerdegen" <michael_heerdegen@web.de>
> To: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> 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.

I thought to first append the three lists, then transfer them to
org-capture-templates

> 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)?

Because I could have various template setups.  This is for writing.
I could have others, e.g. projects, archaeology.

I could use a keybinding to loop to the one I want to use, rather than
sticking everything in one.

> Regards,
>
> Michael.
>
>
>



reply via email to

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