From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Bug: Org Capture with Concatenated filenames [9.0 (9.0-elpa @ .emacs.d/elpa/org-20161102/)] Date: Sat, 05 Nov 2016 00:03:53 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113ad4e25ef6a705408287e8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2oSt-0000vS-Hw for emacs-orgmode@gnu.org; Fri, 04 Nov 2016 20:04:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2oSs-000729-3i for emacs-orgmode@gnu.org; Fri, 04 Nov 2016 20:04:07 -0400 Received: from mail-ua0-x22a.google.com ([2607:f8b0:400c:c08::22a]:35354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c2oSr-00070w-PE for emacs-orgmode@gnu.org; Fri, 04 Nov 2016 20:04:06 -0400 Received: by mail-ua0-x22a.google.com with SMTP id 12so79340902uas.2 for ; Fri, 04 Nov 2016 17:04:05 -0700 (PDT) In-Reply-To: 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: Klarre N , emacs-orgmode@gnu.org --001a113ad4e25ef6a705408287e8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I am on phone, but the link I pasted had an example. Here's another example: https://www.reddit.com/r/emacs/comments/5b3mtr/slug/d9llo30 You just need to wrap the sexp in (lambda () ..... ). On Fri, Nov 4, 2016, 6:45 PM Klarre N wrote: > Thanks for the quick answer! > Oh I see, could you please provide an example how to write such a functio= n > wrapper (I am new to Elisp)? > I defined several variables to directories where I have org-files, and > capture to one or more files in those directories, for example: > (defvar logs "path-to-logs/") then capture to logs.org, events.org and > services.org in that directory. How could I do that with a function > wrapper? > > Thanks you! > > On Fri, Nov 4, 2016 at 11:36 PM, Kaushal Modi > wrote: > > Hi Klarre, > > The org 9.0 release had deprecated use of S-exps in org-capture-templates= . > That, though, went undocumented. So for now, that deprecation is reverted > on the main branch and moved to the master/dev branch. > > > http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=3Df5645675a336d8f56fa= 9e6bd63832bdbac71f315 > > So when org stable next updates on Elpa (probably on Monday?), that will > have this reverted commit in it. But going forward, when org 9.1 is > released, the use of S-exp will once again be deprecated. So it would be > best to replace that S-exp with a function wrapper. > > On Fri, Nov 4, 2016 at 6:19 PM Klarre N wrote: > > Hi, > concatenated filenames for org-capture templates no longer works (since > 9.0). > > ECM: > (setq org-default-notes-file "absolute-path/default.org") > (defvar absolute "absolute-path/" > "Path to Desired directory.") > (setq org-capture-templates '( > ("e" "Example" entry > (file+headline (concat absolute "example.org") "Example") > "* Capture" > :empty-lines 1))) > > Expected result: > Add "* Capture" to absolute-path/example.org. > > Result: "* Capture" is added to "absolute-path/default.org". > > This provides the desired result, but unable to use variable filenames > (very useful): > (setq org-default-notes-file "absolute-path/default.org") > (setq org-capture-templates '( > ("e" "Example" entry > (file+headline "absolute-path/example.org" "Example") > "* Capture" > :empty-lines 1))) > > > Thanks! > > -- > > Kaushal Modi > > > > > -- > Med v=C3=A4nliga h=C3=A4lsningar > Klaus > --=20 Kaushal Modi --001a113ad4e25ef6a705408287e8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I am on phone, but the link I pasted had an example.=C2=A0

Here's another example:=C2=A0https://www.reddit.com/r/emacs/comments/5b= 3mtr/slug/d9llo30

You just need to wrap the se= xp in (lambda () ..... ).

On Fri, Nov 4, 2016, 6:45 PM Klarre N <klarre@gmail.com> wrote:
Thanks for the quick answer!
Oh I see, could you please provide an example how to = write such a function wrapper (I am new to Elisp)?
<= /div>
I defined several variables to directories where I have org-files, and= capture to one or more files in those directories, for example:
(defvar logs &q= uot;path-to-logs/") then capture to logs.org, events.org and services.org in t= hat directory. How could I do that with a function wrapper?

Thanks you!

On Fri, Nov 4, 2016 at 11:36 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
Hi Klarre,

<= /div>
The org 9.0 release had deprecated use of S-e= xps in org-capture-templates. That, though, went undocumented. So for now, = that deprecation is reverted on the main branch and moved to the master/dev= branch.


So = when org stable next updates on Elpa (probably on Monday?), that will have = this reverted commit in it. But going forward, when org 9.1 is released, th= e use of S-exp will once again be deprecated. So it would be best to replac= e that S-exp with a function wrapper.

On Fri, Nov 4, 2016 at 6:19 PM Klarre N <klarre@gmail.com= > wrote:
Hi,
concatenated filenames for org-capture templates no longer = works (since 9.0).

ECM:
(setq org-default-notes-file "absolut= e-path/default.org"= )
(defvar absolute "absolute-path/"
=C2=A0=C2=A0=C2=A0 "Pa= th to Desired directory.")
(setq org-capture-templates '(
=C2=A0= ("e" "Example" entry
=C2=A0=C2=A0 (file+headline (con= cat absolute "example.o= rg") "Example")
=C2=A0=C2=A0 "* Capture"
=C2= =A0=C2=A0 :empty-lines 1)))

Expected result:
Add "* Ca= pture" to absolute-path/example.org.

Result: "* Capture" is added to "absolu= te-path/default.org"= ;.

This provides the desired result, but unable to use var= iable filenames (very useful):
(setq org-default-notes-file = "absolute-path/default.= org")
(setq org-capture-templates '(
=C2=A0 ("e" &= quot;Example" entry
=C2=A0=C2=A0 (file+headline "absolute-path/<= a href=3D"http://example.org" class=3D"m_-2862499183374216856m_404373937680= 9572210gmail_msg gmail_msg" target=3D"_blank">example.org" "E= xample")
=C2=A0=C2=A0 "* Capture"
=C2=A0=C2=A0 :empty-line= s 1)))



Thanks!
--

Kaushal Modi




--
Me= d v=C3=A4nliga h=C3=A4lsningar
Klaus
--

Kaushal Modi

--001a113ad4e25ef6a705408287e8--