unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* org-capture-templates constructed from three distinct functions
@ 2020-12-12  1:14 Christopher Dimech
  2020-12-12  1:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  3:16 ` Michael Heerdegen
  0 siblings, 2 replies; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  1:14 UTC (permalink / raw)
  To: Help Gnu Emacs

I am writing an org capture template for a book.  I would like a different function
for each book, suppose I have three (Book A, Book B, Book C).  Selecting either A,
B, and C, I can then te to the respective entries for each book.

Can using three different functions be done to make org-capture templates?


(defun captr-writing ()

  (setq org-capture-templates
   `(("A" "Book A")  ; backquote construct
     ("A1" "Tdr: Ch01 Oceanic Microseismology" entry
        (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
        ,(concat "* Oceanic Microseismology\n"  ; special marker
           "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
           "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
        :clock-in t :clock-resume t :empty-lines 1)

     ("A2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
        (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
        ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
           "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
           "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
        :clock-in t :clock-resume t :empty-lines 1) )))

Thank you
C*



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  1:14 org-capture-templates constructed from three distinct functions Christopher Dimech
@ 2020-12-12  1:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  2:05   ` Christopher Dimech
  2020-12-12  2:09   ` Christopher Dimech
  2020-12-12  3:16 ` Michael Heerdegen
  1 sibling, 2 replies; 29+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-12  1:48 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech wrote:

> `(("A" "Book A")  ; backquote construct

Interesting comment :)

`(,@(list 'a 'b 'c) d)
                      ^ eval me

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  1:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-12  2:05   ` Christopher Dimech
  2020-12-12  2:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  2:09   ` Christopher Dimech
  1 sibling, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  2:05 UTC (permalink / raw)
  To: moasenwood; +Cc: help-gnu-emacs

This is how I interpreted your list comment

(setq captr-templ-tdr
   `(,@(list
     '("t" "Tdr Document")  ; backquote construct
     '("t1" "Tdr: Ch01 Oceanic Microseismology" entry
       (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
       ,(concat "* Oceanic Microseismology\n"  ; special marker
         "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
         "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
       :clock-in t :clock-resume t :empty-lines 1)

     '("t2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
       (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
       ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
         "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
         "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
     :clock-in t :clock-resume t :empty-lines 1) )))

(defun captr-tdr ()
   (interactive)
   (setq org-capture-templates captr-templ-tdr))

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



> Sent: Saturday, December 12, 2020 at 2:48 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> Christopher Dimech wrote:
>
> > `(("A" "Book A")  ; backquote construct
>
> Interesting comment :)
>
> `(,@(list 'a 'b 'c) d)
>                       ^ eval me

I made the following, with "H-c" not working

(defun captr-tdr ()
   (interactive)
   (setq org-capture-templates `(,@(list captr-templ-tdr)) ))

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



> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  1:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  2:05   ` Christopher Dimech
@ 2020-12-12  2:09   ` Christopher Dimech
  1 sibling, 0 replies; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  2:09 UTC (permalink / raw)
  To: moasenwood; +Cc: help-gnu-emacs

> Sent: Saturday, December 12, 2020 at 2:48 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> Christopher Dimech wrote:
>
> > `(("A" "Book A")  ; backquote construct
>
> Interesting comment :)

One time I found a file called progress.c.  Another one was work.c.

> `(,@(list 'a 'b 'c) d)
>                       ^ eval me
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  2:05   ` Christopher Dimech
@ 2020-12-12  2:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  2:17       ` Christopher Dimech
                         ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-12  2:14 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech wrote:

> This is how I interpreted your list comment

OK, well, that was just playing with syntax and having fun at
your comment ("backquote construct), but be my guest...

> (setq captr-templ-tdr
>    `(,@(list
>      '("t" "Tdr Document")  ; backquote construct
>      '("t1" "Tdr: Ch01 Oceanic Microseismology" entry
>        (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
>        ,(concat "* Oceanic Microseismology\n"  ; special marker
>          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
>          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
>        :clock-in t :clock-resume t :empty-lines 1)
>
>      '("t2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
>        (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
>        ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
>          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
>          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
>      :clock-in t :clock-resume t :empty-lines 1) )))
>
> (defun captr-tdr ()
>    (interactive)
>    (setq org-capture-templates captr-templ-tdr))
>
> (global-set-key (kbd "H-c")   #'captr-tdr)

To be honest that doesn't look good. Ha.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  2:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-12  2:17       ` Christopher Dimech
  2020-12-12  2:21       ` Christopher Dimech
  2020-12-12  2:30       ` Christopher Dimech
  2 siblings, 0 replies; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  2:17 UTC (permalink / raw)
  To: moasenwood; +Cc: help-gnu-emacs

> Sent: Saturday, December 12, 2020 at 3:14 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> Christopher Dimech wrote:
>
> > This is how I interpreted your list comment
>
> OK, well, that was just playing with syntax and having fun at
> your comment ("backquote construct), but be my guest...

I wrote bullocks then.

> > (setq captr-templ-tdr
> >    `(,@(list
> >      '("t" "Tdr Document")  ; backquote construct
> >      '("t1" "Tdr: Ch01 Oceanic Microseismology" entry
> >        (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
> >        ,(concat "* Oceanic Microseismology\n"  ; special marker
> >          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
> >          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
> >        :clock-in t :clock-resume t :empty-lines 1)
> >
> >      '("t2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
> >        (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
> >        ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
> >          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
> >          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
> >      :clock-in t :clock-resume t :empty-lines 1) )))
> >
> > (defun captr-tdr ()
> >    (interactive)
> >    (setq org-capture-templates captr-templ-tdr))
> >
> > (global-set-key (kbd "H-c")   #'captr-tdr)
>
> To be honest that doesn't look good. Ha.
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  2:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  2:17       ` Christopher Dimech
@ 2020-12-12  2:21       ` Christopher Dimech
  2020-12-12  2:30       ` Christopher Dimech
  2 siblings, 0 replies; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  2:21 UTC (permalink / raw)
  To: moasenwood; +Cc: help-gnu-emacs

Well, my first thought has been to put template entries in a list.  But, yes, things are not
working out very well.

> Sent: Saturday, December 12, 2020 at 3:14 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> Christopher Dimech wrote:
>
> > This is how I interpreted your list comment
>
> OK, well, that was just playing with syntax and having fun at
> your comment ("backquote construct), but be my guest...
>
> > (setq captr-templ-tdr
> >    `(,@(list
> >      '("t" "Tdr Document")  ; backquote construct
> >      '("t1" "Tdr: Ch01 Oceanic Microseismology" entry
> >        (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
> >        ,(concat "* Oceanic Microseismology\n"  ; special marker
> >          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
> >          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
> >        :clock-in t :clock-resume t :empty-lines 1)
> >
> >      '("t2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
> >        (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
> >        ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
> >          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
> >          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
> >      :clock-in t :clock-resume t :empty-lines 1) )))
> >
> > (defun captr-tdr ()
> >    (interactive)
> >    (setq org-capture-templates captr-templ-tdr))
> >
> > (global-set-key (kbd "H-c")   #'captr-tdr)
>
> To be honest that doesn't look good. Ha.
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  2:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  2:17       ` Christopher Dimech
  2020-12-12  2:21       ` Christopher Dimech
@ 2020-12-12  2:30       ` Christopher Dimech
  2020-12-12  2:38         ` Emanuel Berg via Users list for the GNU Emacs text editor
  2 siblings, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  2:30 UTC (permalink / raw)
  To: moasenwood; +Cc: help-gnu-emacs

There must bo some problem in how I am trying to use lists.

(setq captr-tmplt-tdr
  `( '("t" "Tdr Document")  ; backquote construct
     '("t1" "Tdr: Ch01 Oceanic Microseismology" entry
       (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
       ,(concat "* Oceanic Microseismology\n"  ; special marker
         "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
         "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
       :clock-in t :clock-resume t :empty-lines 1)

     '("t2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
       (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
       ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
         "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
         "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
     :clock-in t :clock-resume t :empty-lines 1)

     '("t3" "+ Ch03 Computational Aspects of Spectral Estimation" entry
       (file+headline "~/02histr/tdr/03ch.rcl.org" "Tdr Document")
       ,(concat "* Ch03 Computational Aspects of Spectr Estm\n"
         "** %^{Select |Augment:|Include:|Clarify:|Organise:}: \n"
         "  Title: %?\n  Brief:\n  Detail:\n"
         "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
     :clock-in t :clock-resume t :empty-lines 1)

     '("tc" "+ Citable Note" entry
       (file "~/02histr/tdr/citn.rcl.org")
       ,(concat "* %^{Year} %^{Author} %^{Year}p %^{Author}p\n"
         "  %^{Sel |Reference:|  Bibliography:} %T\n"
         "  Year: %\\1\n  Author: %\\2\n  Title: %?\n"
         "  Brief:\n  Detail:\n  Annal:\n"
         "  Entered: %T\n  Link: %a\n")
     :empty-lines 1) ))

;; ----------------------------------------------------------------------
(defun captr-tdr ()
   (interactive)
   (setq org-capture-templates 'captr-templ-tdr))





> Sent: Saturday, December 12, 2020 at 3:14 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> Christopher Dimech wrote:
>
> > This is how I interpreted your list comment
>
> OK, well, that was just playing with syntax and having fun at
> your comment ("backquote construct), but be my guest...
>
> > (setq captr-templ-tdr
> >    `(,@(list
> >      '("t" "Tdr Document")  ; backquote construct
> >      '("t1" "Tdr: Ch01 Oceanic Microseismology" entry
> >        (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
> >        ,(concat "* Oceanic Microseismology\n"  ; special marker
> >          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
> >          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
> >        :clock-in t :clock-resume t :empty-lines 1)
> >
> >      '("t2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
> >        (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
> >        ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
> >          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
> >          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
> >      :clock-in t :clock-resume t :empty-lines 1) )))
> >
> > (defun captr-tdr ()
> >    (interactive)
> >    (setq org-capture-templates captr-templ-tdr))
> >
> > (global-set-key (kbd "H-c")   #'captr-tdr)
>
> To be honest that doesn't look good. Ha.
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  2:30       ` Christopher Dimech
@ 2020-12-12  2:38         ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  2:43           ` Christopher Dimech
  0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-12  2:38 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech wrote:

> There must bo some problem in how I am trying to use lists.

That whole thing is like searching for a microchip in
a megacomputer. backquote quote backquote ... ???

Here is the syntax:

  `(a ,(+ 1 1) ("ghost" "reporting") ,@'(x y z))

which is

  (a 2 ("ghost" "reporting") x y z)

when you understand the syntax, feel free to do whatever...

but it still doesn't look good :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  2:38         ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-12  2:43           ` Christopher Dimech
  2020-12-12  2:56             ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  2:43 UTC (permalink / raw)
  To: moasenwood; +Cc: help-gnu-emacs


> Sent: Saturday, December 12, 2020 at 3:38 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> Christopher Dimech wrote:
>
> > There must bo some problem in how I am trying to use lists.
>
> That whole thing is like searching for a microchip in
> a megacomputer. backquote quote backquote ... ???
>
> Here is the syntax:
>
>   `(a ,(+ 1 1) ("ghost" "reporting") ,@'(x y z))
>
> which is
>
>   (a 2 ("ghost" "reporting") x y z)
>
> when you understand the syntax, feel free to do whatever...
>
> but it still doesn't look good :)

Any way to make my plan good?

> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  2:43           ` Christopher Dimech
@ 2020-12-12  2:56             ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  3:00               ` Christopher Dimech
  0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-12  2:56 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech wrote:

> Any way to make my plan good?

No :)

But I guess just write code every day and try to make it look
good and it'll look better and better God willing...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  2:56             ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-12  3:00               ` Christopher Dimech
  2020-12-12  3:34                 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  3:00 UTC (permalink / raw)
  To: moasenwood; +Cc: help-gnu-emacs

> Sent: Saturday, December 12, 2020 at 3:56 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> Christopher Dimech wrote:
>
> > Any way to make my plan good?
>
> No :)
>
> But I guess just write code every day and try to make it look
> good and it'll look better and better God willing...

There is no god.

> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  1:14 org-capture-templates constructed from three distinct functions Christopher Dimech
  2020-12-12  1:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-12  3:16 ` Michael Heerdegen
  2020-12-12  3:24   ` Christopher Dimech
  1 sibling, 1 reply; 29+ messages in thread
From: Michael Heerdegen @ 2020-12-12  3:16 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> Can using three different functions be done to make org-capture
> templates?

I had to think long about what this question wants to ask.

I guess you want to know how you can add more templates without
overwriting the existing (partly filled) list of templates?

Michael.




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:16 ` Michael Heerdegen
@ 2020-12-12  3:24   ` Christopher Dimech
  2020-12-12  3:43     ` Michael Heerdegen
  0 siblings, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  3:24 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


> Sent: Saturday, December 12, 2020 at 4:16 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:
>
> > Can using three different functions be done to make org-capture
> > templates?
>
> I had to think long about what this question wants to ask.
>
> I guess you want to know how you can add more templates without
> overwriting the existing (partly filled) list of templates?

I want to write ideas for three books say, and could have the template list
for each book in either a function or a variable.  Then append the three at
the end.

Have been trying as follows with just on book for now, but have not been
successful.


(setq captr-tmplt-tdr
  `( ("t" "Tdr Document")  ; backquote construct
     ("t1" "Tdr: Ch01 Oceanic Microseismology" entry
      (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
      ,(concat "* Oceanic Microseismology\n"  ; special marker
        "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
        "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
     :clock-in t :clock-resume t :empty-lines 1)

     ("t2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
      (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
      ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
        "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
        "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
     :clock-in t :clock-resume t :empty-lines 1) ))

;; ----------------------------------------------------------------------
(defun captr-tdr ()
   (interactive)
   (setq org-capture-templates 'captr-templ-tdr))

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



> Michael.
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:00               ` Christopher Dimech
@ 2020-12-12  3:34                 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-12-12  9:02                   ` tomas
  0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-12  3:34 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech wrote:

>> But I guess just write code every day and try to make it
>> look good and it'll look better and better God willing...
>
> There is no god.

There is gravity. And expressions...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:24   ` Christopher Dimech
@ 2020-12-12  3:43     ` Michael Heerdegen
  2020-12-12  3:51       ` Christopher Dimech
  2020-12-12  3:58       ` Christopher Dimech
  0 siblings, 2 replies; 29+ messages in thread
From: Michael Heerdegen @ 2020-12-12  3:43 UTC (permalink / raw)
  To: help-gnu-emacs

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.




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:43     ` Michael Heerdegen
@ 2020-12-12  3:51       ` Christopher Dimech
  2020-12-12  3:57         ` Michael Heerdegen
  2020-12-12  3:58       ` Christopher Dimech
  1 sibling, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  3:51 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

> 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.
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:51       ` Christopher Dimech
@ 2020-12-12  3:57         ` Michael Heerdegen
  2020-12-12  4:02           ` Christopher Dimech
                             ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Michael Heerdegen @ 2020-12-12  3:57 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

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

Sounds ok then, yes.

Michael.




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:43     ` Michael Heerdegen
  2020-12-12  3:51       ` Christopher Dimech
@ 2020-12-12  3:58       ` Christopher Dimech
  2020-12-12 22:51         ` Michael Heerdegen
  1 sibling, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  3:58 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

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

How would an association list look like for this one book template, if I may ask?


> 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.
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:57         ` Michael Heerdegen
@ 2020-12-12  4:02           ` Christopher Dimech
  2020-12-12  4:14             ` Christopher Dimech
  2020-12-12  4:18           ` Christopher Dimech
                             ` (2 subsequent siblings)
  3 siblings, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  4:02 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

Am first trying to do this for one book at least.  But having a problem in constructing the list.

> Sent: Saturday, December 12, 2020 at 4:57 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:
>
> > I thought to first append the three lists, then transfer them to
> > org-capture-templates
>
> Sounds ok then, yes.
>
> Michael.
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  4:02           ` Christopher Dimech
@ 2020-12-12  4:14             ` Christopher Dimech
  0 siblings, 0 replies; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  4:14 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Michael Heerdegen, help-gnu-emacs

I am getting

Debugger entered--Lisp error: (wrong-type-argument sequencep tmplt-tdr)

> Sent: Saturday, December 12, 2020 at 5:02 AM
> From: "Christopher Dimech" <dimech@gmx.com>
> To: "Michael Heerdegen" <michael_heerdegen@web.de>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: org-capture-templates constructed from three distinct functions
>
> Am first trying to do this for one book at least.  But having a problem in constructing the list.
>
> > Sent: Saturday, December 12, 2020 at 4:57 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:
> >
> > > I thought to first append the three lists, then transfer them to
> > > org-capture-templates
> >
> > Sounds ok then, yes.
> >
> > Michael.
> >
> >
> >
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:57         ` Michael Heerdegen
  2020-12-12  4:02           ` Christopher Dimech
@ 2020-12-12  4:18           ` Christopher Dimech
  2020-12-12  4:31           ` Christopher Dimech
  2020-12-12  4:54           ` Christopher Dimech
  3 siblings, 0 replies; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  4:18 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

I got one book to work now

(defun captr-tmplt-tdr ()
   (interactive)
   (message "tmplt-tdr")
   (setq org-capture-templates tmplt-tdr))

(captr-tmplt-tdr)


> Sent: Saturday, December 12, 2020 at 4:57 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:
>
> > I thought to first append the three lists, then transfer them to
> > org-capture-templates
>
> Sounds ok then, yes.
>
> Michael.
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:57         ` Michael Heerdegen
  2020-12-12  4:02           ` Christopher Dimech
  2020-12-12  4:18           ` Christopher Dimech
@ 2020-12-12  4:31           ` Christopher Dimech
  2020-12-12  4:54           ` Christopher Dimech
  3 siblings, 0 replies; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  4:31 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

I am working on two books now.

(setq tmplt-tdr
  `( ("t" "Tdr Document")  ; backquote construct
     ("t1" "Tdr: Ch01 Oceanic Microseismology" entry
      (file+headline "~/02histr/tdr/01ch.rcl.org" "Tdr Document")
      ,(concat "* Oceanic Microseismology\n"  ; special marker
        "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
        "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
     :clock-in t :clock-resume t :empty-lines 1)

     ("t2" "+ Ch02 Multi-Resolution Spectral Analysis" entry
      (file+headline "~/02histr/tdr/02ch.rcl.org" "Tdr Document")
      ,(concat "* Ch02 Multi-Resoln Spectr Anly\n"
        "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
        "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
     :clock-in t :clock-resume t :empty-lines 1) ))

;; ----------------------------------------------------------------------
(setq tmplt-uwdiving
   `( ("d"  "Decompression Theory")  ; backquote construct
      ("da" "Decompression Theory" entry
       (file+headline "~/02histr/uwdiving/decomrth.rcl.org"
                      "Decompression Theory")
       ,(concat "* Decompression Theory\n"  ; special marker
         "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
         "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
       :clock-in t :clock-resume t :empty-lines 1)

       ("r"  "Recreational Diving")
       ("ra" "Rescue Diver" entry
        (file+headline "~/02histr/uwdiving/rescuedv.rcl.org"
                       " Rescue Diver")
        ,(concat "* TODO\n"
          "  %^{Select |Augment:|Include:|Clarify:|Organise:} %?\n"
          "  Scheduled: %^T\n  Entered: %T\n  Link: %a\n")
        :clock-in t :clock-resume t :empty-lines 1)  ))

;; ----------------------------------------------------------------------
(defun captr-tmplt-writing ()
   (interactive)
   (message "tmplt-tdr")
   (setq org-capture-templates (tmplt-tdr tmplt-uwdiving) ))

(captr-tmplt-writing)
(global-set-key (kbd "H-c") #'captr-tmplt-writing)



> Sent: Saturday, December 12, 2020 at 4:57 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:
>
> > I thought to first append the three lists, then transfer them to
> > org-capture-templates
>
> Sounds ok then, yes.
>
> Michael.
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:57         ` Michael Heerdegen
                             ` (2 preceding siblings ...)
  2020-12-12  4:31           ` Christopher Dimech
@ 2020-12-12  4:54           ` Christopher Dimech
  2020-12-12 22:47             ` Michael Heerdegen
  3 siblings, 1 reply; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12  4:54 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

With two lists the problematic part is now to add the lists, as the following is failing.

(defun captr-tmplt-writing ()
   (interactive)
   (message "tmplt-writing")
   (setq captr-tmplt-writing tmplt-tdr)
   (add-to-list 'captr-tmplt-writing tmplt-uwdiving)
   (setq org-capture-templates captr-tmplt-writing) )



> Sent: Saturday, December 12, 2020 at 4:57 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:
>
> > I thought to first append the three lists, then transfer them to
> > org-capture-templates
>
> Sounds ok then, yes.
>
> Michael.
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:34                 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-12  9:02                   ` tomas
  2020-12-12  9:43                     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 29+ messages in thread
From: tomas @ 2020-12-12  9:02 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

On Sat, Dec 12, 2020 at 04:34:33AM +0100, Emanuel Berg via Users list for the GNU Emacs text editor wrote:
> Christopher Dimech wrote:
> 
> >> But I guess just write code every day and try to make it
> >> look good and it'll look better and better God willing...
> >
> > There is no god.
> 
> There is gravity. And expressions...

https://xkcd.com/224/

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  9:02                   ` tomas
@ 2020-12-12  9:43                     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-12  9:43 UTC (permalink / raw)
  To: help-gnu-emacs

tomas wrote:

>>>> But I guess just write code every day and try to make it
>>>> look good and it'll look better and better God willing...
>>>
>>> There is no god.
>> 
>> There is gravity. And expressions...
>
> https://xkcd.com/224/

What? Ha. Crazy :) Thanks.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  4:54           ` Christopher Dimech
@ 2020-12-12 22:47             ` Michael Heerdegen
  2020-12-12 22:55               ` Christopher Dimech
  0 siblings, 1 reply; 29+ messages in thread
From: Michael Heerdegen @ 2020-12-12 22:47 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> With two lists the problematic part is now to add the lists, as the
> following is failing.
>
> (defun captr-tmplt-writing ()
>    (interactive)
>    (message "tmplt-writing")
>    (setq captr-tmplt-writing tmplt-tdr)
>    (add-to-list 'captr-tmplt-writing tmplt-uwdiving)
>    (setq org-capture-templates captr-tmplt-writing) )

Hard to tell cause the example is incomplete.  Could be you use
`add-to-list', which is to add list elements, where you actually want to
append lists...?

Michael.




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12  3:58       ` Christopher Dimech
@ 2020-12-12 22:51         ` Michael Heerdegen
  0 siblings, 0 replies; 29+ messages in thread
From: Michael Heerdegen @ 2020-12-12 22:51 UTC (permalink / raw)
  To: help-gnu-emacs

Christopher Dimech <dimech@gmx.com> writes:

> How would an association list look like for this one book template, if
> I may ask?

Exactly as now, it is already an association list - or, with other
words: its format is compatible with that concept.  Which means you can
use the alist tools to manipulate and modify the value if you want.

Regards,

Michael.




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: org-capture-templates constructed from three distinct functions
  2020-12-12 22:47             ` Michael Heerdegen
@ 2020-12-12 22:55               ` Christopher Dimech
  0 siblings, 0 replies; 29+ messages in thread
From: Christopher Dimech @ 2020-12-12 22:55 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


> Sent: Saturday, December 12, 2020 at 11:47 PM
> 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:
>
> > With two lists the problematic part is now to add the lists, as the
> > following is failing.
> >
> > (defun captr-tmplt-writing ()
> >    (interactive)
> >    (message "tmplt-writing")
> >    (setq captr-tmplt-writing tmplt-tdr)
> >    (add-to-list 'captr-tmplt-writing tmplt-uwdiving)
> >    (setq org-capture-templates captr-tmplt-writing) )
>
> Hard to tell cause the example is incomplete.  Could be you use
> `add-to-list', which is to add list elements, where you actually want to
> append lists...?

Have played more with it and have used append.  Things now works as intended.

> Michael.
>
>
>



^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2020-12-12 22:55 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-12  1:14 org-capture-templates constructed from three distinct functions Christopher Dimech
2020-12-12  1:48 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  2:05   ` Christopher Dimech
2020-12-12  2:14     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  2:17       ` Christopher Dimech
2020-12-12  2:21       ` Christopher Dimech
2020-12-12  2:30       ` Christopher Dimech
2020-12-12  2:38         ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  2:43           ` Christopher Dimech
2020-12-12  2:56             ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  3:00               ` Christopher Dimech
2020-12-12  3:34                 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  9:02                   ` tomas
2020-12-12  9:43                     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  2:09   ` Christopher Dimech
2020-12-12  3:16 ` Michael Heerdegen
2020-12-12  3:24   ` Christopher Dimech
2020-12-12  3:43     ` Michael Heerdegen
2020-12-12  3:51       ` Christopher Dimech
2020-12-12  3:57         ` Michael Heerdegen
2020-12-12  4:02           ` Christopher Dimech
2020-12-12  4:14             ` Christopher Dimech
2020-12-12  4:18           ` Christopher Dimech
2020-12-12  4:31           ` Christopher Dimech
2020-12-12  4:54           ` Christopher Dimech
2020-12-12 22:47             ` Michael Heerdegen
2020-12-12 22:55               ` Christopher Dimech
2020-12-12  3:58       ` Christopher Dimech
2020-12-12 22:51         ` Michael Heerdegen

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