From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuri Lensky Subject: Re: [Patch] Fix handling of variable capture location Date: Wed, 17 May 2017 11:52:21 -0700 Message-ID: References: <87r2znr7pn.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1140fe2acc141c054fbcc983" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB43b-0004mr-Pj for emacs-orgmode@gnu.org; Wed, 17 May 2017 14:52:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB43a-0001cY-GJ for emacs-orgmode@gnu.org; Wed, 17 May 2017 14:52:23 -0400 Received: from mail-io0-x234.google.com ([2607:f8b0:4001:c06::234]:36642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dB43a-0001cP-A5 for emacs-orgmode@gnu.org; Wed, 17 May 2017 14:52:22 -0400 Received: by mail-io0-x234.google.com with SMTP id o12so15237522iod.3 for ; Wed, 17 May 2017 11:52:22 -0700 (PDT) In-Reply-To: <87r2znr7pn.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: "emacs-orgmode@gnu.org" , Yuri Lensky --001a1140fe2acc141c054fbcc983 Content-Type: text/plain; charset="UTF-8" The second call is indeed needed. This is the case fixed by the patch: (setq org-default-notes-file (expand-file-name "~/docs/notes.org")) (setq org-capture-templates '(("t" "Todo" entry (file+olp org-default-notes-file "Inbox") "* TODO %?\n%i"))) This breaks without the second symbol-value. The first is required to replicate the intended functionality of bound-and-true-p. YL On Wed, May 17, 2017 at 5:25 AM, Nicolas Goaziou wrote: > Hello, > > Yuri Lensky writes: > > > Capture locations in variable not working before this patch. > > Thank you. > > Could you show an example demonstrating the issue? The only difference > I can see with your patch is that you're referring to the global value > of file, not the local one. > > > From c0de1c390b370b497fbb093ac5efd3d7aeaac0dc Mon Sep 17 00:00:00 2001 > > From: "Yuri D. Lensky" > > Date: Sun, 12 Mar 2017 17:58:15 -0700 > > Subject: [PATCH] org-capture.el: Fix handling of variable capture > location > > > > --- > > lisp/org-capture.el | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/lisp/org-capture.el b/lisp/org-capture.el > > index 9ac9294..04c446d 100644 > > --- a/lisp/org-capture.el > > +++ b/lisp/org-capture.el > > @@ -1060,7 +1060,8 @@ case, raise an error." > > (let ((location (cond ((equal file "") org-default-notes-file) > > ((stringp file) (expand-file-name file > org-directory)) > > ((functionp file) (funcall file)) > > - ((and (symbolp file) (bound-and-true-p file))) > > + ((and (symbolp file) (boundp file) (symbol-value > file)) > > + (symbol-value file)) > > The second call to `symbol-value' is not needed. > > Regards, > > -- > Nicolas Goaziou > --001a1140fe2acc141c054fbcc983 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The second call is indeed needed. This is the case fi= xed by the patch:

(setq org-default-notes-file (ex= pand-file-name "~/docs/notes.org"= ;))
(setq org-capture-templates '(("t" "Todo&q= uot; entry (file+olp org-default-notes-file "Inbox") "* TODO= %?\n%i")))

This breaks without the second sy= mbol-value. The first is required to replicate the intended functionality o= f bound-and-true-p.

YL

On Wed, May 17, 2017 at 5:25 AM, = Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Hello,

Yuri Lensky <ydl@ydl.cm> writes:
> Capture locations in variable not working before this patch.

Thank you.

Could you show an example demonstrating the issue? The only difference
I can see with your patch is that you're referring to the global value<= br> of file, not the local one.

> From c0de1c390b370b497fbb093ac5efd3d7aeaac0dc Mon Sep 17 00:00:00= 2001
> From: "Yuri D. Lensky" <ydlensky@gmail.com>
> Date: Sun, 12 Mar 2017 17:58:15 -0700
> Subject: [PATCH] org-capture.el: Fix handling of variable capture loca= tion
>
> ---
>=C2=A0 lisp/org-capture.el | 3 ++-
>=C2=A0 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/org-capture.el b/lisp/org-capture.el
> index 9ac9294..04c446d 100644
> --- a/lisp/org-capture.el
> +++ b/lisp/org-capture.el
> @@ -1060,7 +1060,8 @@ case, raise an error."
>=C2=A0 =C2=A0 (let ((location (cond ((equal file "") org-defa= ult-notes-file)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0((stringp file) (expand-file-name file org-directory))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0((functionp file) (funcall file))
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0((and (symbolp file) (bound-and-true-p file)))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0((and (symbolp file) (boundp file) (symbol-value file))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 (symbol-value file))

The second call to `symbol-value' is not needed.

Regards,

--
Nicolas Goaziou

--001a1140fe2acc141c054fbcc983--