From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: org capture properties from a list of strings? Date: Wed, 26 Apr 2017 15:28:20 +0300 Message-ID: References: <87y3uozzlm.fsf@nicolasgoaziou.fr> <87h91czchj.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c042d52d05b42054e10f973 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3M3U-00062Y-5W for emacs-orgmode@gnu.org; Wed, 26 Apr 2017 08:28:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3M3S-0002XD-O6 for emacs-orgmode@gnu.org; Wed, 26 Apr 2017 08:28:24 -0400 Received: from mail-pg0-x232.google.com ([2607:f8b0:400e:c05::232]:34315) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3M3S-0002Wn-FZ for emacs-orgmode@gnu.org; Wed, 26 Apr 2017 08:28:22 -0400 Received: by mail-pg0-x232.google.com with SMTP id v1so32297776pgv.1 for ; Wed, 26 Apr 2017 05:28:22 -0700 (PDT) In-Reply-To: <87h91czchj.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: org mode --94eb2c042d52d05b42054e10f973 Content-Type: text/plain; charset=UTF-8 Hi again once again really appreciate the answer and apologize in advance for my limited grasp of coding. so i managed i think to follow your example and now have this as my capture template (setq org-capture-templates nil) (setq org-capture-templates-contexts nil) (add-to-list 'org-capture-templates '("f" "Food" entry (file+headline (concat pmm "/org/files/agenda/food.org") "Inbox") "* COOK %^{Recipe Name} :PROPERTIES: :ID: %(org-id-uuid) :Time: %^{minutes|%s} :type: %^{Type?|%s} :END: %^{prompt|*** Ingredients} %? %^{prompt|*** Preparation} " (mapconcat #'identity '("1" "2" "3" "4" "5") "|") (mapconcat #'identity '("Indian" "Thai" "Vietnamese" "Asian" "Chinese") "|") "Capture Template for food recipe" )) yet i only get offered a %s as a option and not the string in my capture process. im sure my syntax is way off, can anyone stir me in the right direction? best Z On Tue, Apr 25, 2017 at 7:19 PM, Nicolas Goaziou wrote: > Hello, > > Xebar Saram writes: > > > thx Nicolas > > > > really appreciate your answer! though im very week in coding so im > > struggling to understand. but perhaps an example will help. the following > > is a part of my capture: > > > > (add-to-list 'org-capture-templates > > '("ff" "Food" > > entry > > (file+headline (concat pmm "/org/files/agenda/food.org") "Inbox") > > "* COOK %^{Recipe Name} > > :PROPERTIES: > > :ID: %(org-id-uuid) > > :Time: %^{minutes|-|10|15|30|60} > > :Rating: %^{rating?|-|1|2|3|4|5} > > :Source: %x > > :Cuisine: > > %^{Cuisine?|-|Indian|Thai|Vietnamese|Asian|Chinese| > Israeli|Italian|American|EastEuro|Mexican|French|Persian|Austrian} > > :Type: %^{Type?|-|main|side|starter|sweets|drinks|sauce|breakfast} > > :Main.ing: > > %^{main.ing?|-|chicken|beef|potatos|fish|seafood|shrimp| > rice|pasta|fruit} > > :Serves: %^{Serves?|-|1|2|4|6|8} > > :END: > > > > %^{prompt|*** Ingredients} > > %? > > %^{prompt|*** Preparation} > > > > " > > "Capture Template for food recipe" > > )) > > > > > > so do i need a separate mapconcat #'number-to-string for each property > > value (time,type etc?) > > Yes, you do. However, #'number-to-string is only useful if you're > inserting numbers. I think you can use the more general > #'prin1-to-string everywhere instead, e.g., > > (mapconcat #'prin1-to-string '(Indian Thai Vietnamese Asian Chinese) "|") > > or even, using strings > > (mapconcat #'identity '("Indian" "Thai" "Vietnamese" "Asian" "Chinese") > "|") > > > and how dows the %s know which mapconcat command to refer to? > > The are processed by order. The first "%s" refers to the first > mapconcat, the second "%s" to the second mapconcat, and so on... > > Regards, > > -- > Nicolas Goaziou 0x80A93738 > --94eb2c042d52d05b42054e10f973 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi again

once again really appreciate t= he answer and apologize in advance for my limited grasp of coding. so i man= aged i think to follow your example and now have this as my capture templat= e

(setq org-capture-templates nil)
= (setq org-capture-templates-contexts nil)


(add-to-list 'org-capture-templates
'("f"= ; "Food"
entry
(file+headline (concat pmm &qu= ot;/org/files/agenda/food.org") "= Inbox")
"* COOK %^{Recipe Name} =C2=A0 =C2=A0 =C2=A0
:PROPERTIES:
:ID: %(org-id-uuid)
:Time: %^{minu= tes|%s}
:type: %^{Type?|%s}
:END:

<= div>
%^{prompt|*** Ingredients}
%?
%^{pro= mpt|*** Preparation}

"

(mapconcat #'identity '("1" "2" "3"= ; "4" "5") "|")
(mapconcat #'id= entity '("Indian" "Thai" "Vietnamese" &qu= ot;Asian" "Chinese") "|")


"Capture Template for food recipe"
))


yet i only get offered a %s as= a option and not the string in my capture process.=C2=A0

im sure my syntax is way off, can anyone stir me in the right direc= tion?

best

Z
<= div class=3D"gmail_extra">
On Tue, Apr 25, 20= 17 at 7:19 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>= wrote:
Hello,

Xebar Saram <zeltakc@gmail.com&= gt; writes:

> thx Nicolas
>
> really appreciate your answer! though im very week in coding so im
> struggling to understand. but perhaps an example will help. the follow= ing
> is a part of my capture:
>
> (add-to-list 'org-capture-templates
> '("ff" "Food"
> entry
> (file+headline (concat pmm "/org/files/agenda/food.org") "Inb= ox")
> "* COOK %^{Recipe Name}
> :PROPERTIES:
> :ID: %(org-id-uuid)
> :Time: %^{minutes|-|10|15|30|60}
> :Rating: %^{rating?|-|1|2|3|4|5}
> :Source:=C2=A0 %x
> :Cuisine:
> %^{Cuisine?|-|Indian|Thai|Vietnamese|Asian|Chinese|Israeli|I= talian|American|EastEuro|Mexican|French|Persian|Austrian}
> :Type: %^{Type?|-|main|side|starter|sweets|drinks|sauce|breakfast= }
> :Main.ing:
>=C2=A0 %^{main.ing?|-|chicken|beef|potatos|fish|seafood|shrimp|rice|pasta|fruit}
> :Serves: %^{Serves?|-|1|2|4|6|8}
> :END:
>
> %^{prompt|*** Ingredients}
> %?
> %^{prompt|*** Preparation}
>
> "
> "Capture Template for food recipe"
> ))
>
>
> so do i need a separate=C2=A0 mapconcat #'number-to-string for eac= h property
> value (time,type etc?)

Yes, you do. However, #'number-to-string is only useful if = you're
inserting numbers. I think you can use the more general
#'prin1-to-string everywhere instead, e.g.,

=C2=A0 (mapconcat #'prin1-to-string '(Indian Thai Vietnamese Asian = Chinese) "|")

or even, using strings

=C2=A0 (mapconcat #'identity '("Indian" "Thai" = "Vietnamese" "Asian" "Chinese") "|"= )

> and how dows the %s know which mapconcat command to refer to?

The are processed by order. The first "%s" refers to the f= irst
mapconcat, the second "%s" to the second mapconcat, and so on...<= br>
Regards,

--
Nicolas Goaziou=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0x80A93738

--94eb2c042d52d05b42054e10f973--