emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Capture Bug?
@ 2016-09-21  8:58 lists
  2016-09-21 11:54 ` Adam Porter
  0 siblings, 1 reply; 8+ messages in thread
From: lists @ 2016-09-21  8:58 UTC (permalink / raw)
  To: emacs-orgmode

I have a capture template which prompts for a file name and uses this to 
create a filename with a datestamp:

(defun capture-pelican-draft-file (path)
   (let ((name (read-string "Name: ")))
     (expand-file-name (format "%s-%s.org"
                               (format-time-string "%Y-%m-%d")
                               name) path)))


("g"
    "New blog post (ianbarton.net)"
    plain
    (file (capture-pelican-draft-file  
"~/Documents/emacs/web_sites/ianbarton.net/org/_posts"))
    "#+AUTHOR: Ian Barton\n#+DATE: %u\n#+PROPERTY: MODIFIED: 
\n#+TITLE\n#+CATEGORY: Blog \n#+PROPERTY: TAGS \n#+PROPERTY: SUMMARY 
\n#+SETUPFILE: ../setup.org\n\n")


On the current git master the function capture-pelican-draft-file 
doesn't seem to be evaluated, resulting in a "File name doesn't exist" 
error. Doing git bisect seems to point at the commit below:

8860c92f62dac87267416708e81bc8aec026fcc7 is the first bad commit
commit 8860c92f62dac87267416708e81bc8aec026fcc7
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date:   Fri Jun 24 00:55:03 2016 +0200

     ob-exp: Small fix

     * lisp/ob-exp.el (org-babel-exp-src-block): Use `symbol-name' 
instead of
       `eval' since the argument is a dynamically scoped variable anyhow.

Ian.

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

* Re: Capture Bug?
  2016-09-21  8:58 Capture Bug? lists
@ 2016-09-21 11:54 ` Adam Porter
  2016-09-21 18:24   ` lists
  2016-09-21 21:38   ` Nick Dokos
  0 siblings, 2 replies; 8+ messages in thread
From: Adam Porter @ 2016-09-21 11:54 UTC (permalink / raw)
  To: emacs-orgmode

lists@wilkesley.net writes:

> I have a capture template which prompts for a file name and uses this
> to create a filename with a datestamp:
>
> (defun capture-pelican-draft-file (path)
>   (let ((name (read-string "Name: ")))
>     (expand-file-name (format "%s-%s.org"
>                               (format-time-string "%Y-%m-%d")
>                               name) path)))
>
>
> ("g"
>    "New blog post (ianbarton.net)"
>    plain
>    (file (capture-pelican-draft-file
> "~/Documents/emacs/web_sites/ianbarton.net/org/_posts"))
>    "#+AUTHOR: Ian Barton\n#+DATE: %u\n#+PROPERTY: MODIFIED:
> \n#+TITLE\n#+CATEGORY: Blog \n#+PROPERTY: TAGS \n#+PROPERTY: SUMMARY
> \n#+SETUPFILE: ../setup.org\n\n")

Are you using custom-set-variables to set org-capture-templates?  If
not, I think you need to unquote capture-pelican-draft-file.

>> On the current git master the function capture-pelican-draft-file
> doesn't seem to be evaluated, resulting in a "File name doesn't exist"
> error. Doing git bisect seems to point at the commit below:
>
> 8860c92f62dac87267416708e81bc8aec026fcc7 is the first bad commit
> commit 8860c92f62dac87267416708e81bc8aec026fcc7
> Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
> Date:   Fri Jun 24 00:55:03 2016 +0200

That commit is about org-babel, which I don't think should have anything
to do with org-capture.  But you said you bisected it, so you mean that
before that commit, your code works as-is?

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

* Re: Capture Bug?
  2016-09-21 11:54 ` Adam Porter
@ 2016-09-21 18:24   ` lists
  2016-09-21 20:01     ` Adam Porter
  2016-09-21 20:51     ` Nicolas Goaziou
  2016-09-21 21:38   ` Nick Dokos
  1 sibling, 2 replies; 8+ messages in thread
From: lists @ 2016-09-21 18:24 UTC (permalink / raw)
  To: emacs-orgmode, Emacs-orgmode

On 2016-09-21 12:54, Adam Porter wrote:
> lists@wilkesley.net writes:
> 
>> I have a capture template which prompts for a file name and uses this
>> to create a filename with a datestamp:
>> 
>> (defun capture-pelican-draft-file (path)
>>   (let ((name (read-string "Name: ")))
>>     (expand-file-name (format "%s-%s.org"
>>                               (format-time-string "%Y-%m-%d")
>>                               name) path)))
>> 
>> 
>> ("g"
>>    "New blog post (ianbarton.net)"
>>    plain
>>    (file (capture-pelican-draft-file
>> "~/Documents/emacs/web_sites/ianbarton.net/org/_posts"))
>>    "#+AUTHOR: Ian Barton\n#+DATE: %u\n#+PROPERTY: MODIFIED:
>> \n#+TITLE\n#+CATEGORY: Blog \n#+PROPERTY: TAGS \n#+PROPERTY: SUMMARY
>> \n#+SETUPFILE: ../setup.org\n\n")
> 
> Are you using custom-set-variables to set org-capture-templates?  If
> not, I think you need to unquote capture-pelican-draft-file.
> 
>>> On the current git master the function capture-pelican-draft-file
>> doesn't seem to be evaluated, resulting in a "File name doesn't exist"
>> error. Doing git bisect seems to point at the commit below:
>> 
>> 8860c92f62dac87267416708e81bc8aec026fcc7 is the first bad commit
>> commit 8860c92f62dac87267416708e81bc8aec026fcc7
>> Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
>> Date:   Fri Jun 24 00:55:03 2016 +0200
> 
> That commit is about org-babel, which I don't think should have 
> anything
> to do with org-capture.  But you said you bisected it, so you mean that
> before that commit, your code works as-is?

Thanks, I'll redo my bisect. I was being harassed by the dog, so might 
have made a mistake! However, the previous commit looks as though it 
might have been the one responsible:

commit 5485170263a46fa17db67b0324c4c4e48bcdfe49
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date:   Fri Jun 24 01:11:49 2016 +0200

     org-capture: Remove forbidden value type from "file" templates

I'll try unquoting capture-pelican-draft-file.

Ian.

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

* Re: Capture Bug?
  2016-09-21 18:24   ` lists
@ 2016-09-21 20:01     ` Adam Porter
  2016-09-21 20:51     ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Adam Porter @ 2016-09-21 20:01 UTC (permalink / raw)
  To: emacs-orgmode

lists@wilkesley.net writes:

> the previous commit looks as though it
> might have been the one responsible:
>
> commit 5485170263a46fa17db67b0324c4c4e48bcdfe49
> Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
> Date:   Fri Jun 24 01:11:49 2016 +0200
>
>     org-capture: Remove forbidden value type from "file" templates

That definitely sounds relevant!

> I'll try unquoting capture-pelican-draft-file.

Let me know if it works.  I still often get confused when dealing with
quoting and unquoting and...

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

* Re: Capture Bug?
  2016-09-21 18:24   ` lists
  2016-09-21 20:01     ` Adam Porter
@ 2016-09-21 20:51     ` Nicolas Goaziou
  2016-09-22  9:14       ` Ian Barton
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2016-09-21 20:51 UTC (permalink / raw)
  To: lists; +Cc: Emacs-orgmode, emacs-orgmode

Hello,

lists@wilkesley.net writes:

> commit 5485170263a46fa17db67b0324c4c4e48bcdfe49
> Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
> Date:   Fri Jun 24 01:11:49 2016 +0200
>
>     org-capture: Remove forbidden value type from "file" templates
>
Try wrapping `capture-pelican-draft-file' call within a function instead
of putting a raw sexp.

Regards,

-- 
Nicolas Goaziou

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

* Re: Capture Bug?
  2016-09-21 11:54 ` Adam Porter
  2016-09-21 18:24   ` lists
@ 2016-09-21 21:38   ` Nick Dokos
  2016-09-22  2:54     ` Adam Porter
  1 sibling, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2016-09-21 21:38 UTC (permalink / raw)
  To: emacs-orgmode

Adam Porter <adam@alphapapa.net> writes:

> lists@wilkesley.net writes:
>
>> I have a capture template which prompts for a file name and uses this
>> to create a filename with a datestamp:
>>
>> (defun capture-pelican-draft-file (path)
>>   (let ((name (read-string "Name: ")))
>>     (expand-file-name (format "%s-%s.org"
>>                               (format-time-string "%Y-%m-%d")
>>                               name) path)))
>>
>>
>> ("g"
>>    "New blog post (ianbarton.net)"
>>    plain
>>    (file (capture-pelican-draft-file
>> "~/Documents/emacs/web_sites/ianbarton.net/org/_posts"))
>>    "#+AUTHOR: Ian Barton\n#+DATE: %u\n#+PROPERTY: MODIFIED:
>> \n#+TITLE\n#+CATEGORY: Blog \n#+PROPERTY: TAGS \n#+PROPERTY: SUMMARY
>> \n#+SETUPFILE: ../setup.org\n\n")
>
> Are you using custom-set-variables to set org-capture-templates?  If
> not, I think you need to unquote capture-pelican-draft-file.

That's not going to work: unquoting[fn:1] evaluates the unquoted
element during the setting of org-capture-templates. That would have
the effect of evaluating the function call when the setq is evaluated,
whereas the intent here is to evaluate the function call *much* later,
when the capture is initiated.


* Footnotes

[fn:1]  ... by which I hope I mean the same thing you do:
using backquote instead of quote in front of the <list> in

        (setq org-capture-templates <list>)

and then using , to unquote some internal elements, allowing their
evaluation and therefore replacing them with the results of the
evaluation in the binding of org-capture-templates.

-- 
Nick

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

* Re: Capture Bug?
  2016-09-21 21:38   ` Nick Dokos
@ 2016-09-22  2:54     ` Adam Porter
  0 siblings, 0 replies; 8+ messages in thread
From: Adam Porter @ 2016-09-22  2:54 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> That's not going to work: unquoting[fn:1] evaluates the unquoted
> element during the setting of org-capture-templates. That would have
> the effect of evaluating the function call when the setq is evaluated,
> whereas the intent here is to evaluate the function call *much* later,
> when the capture is initiated.

Yes, I think you're right. Thanks, Nick.  :)

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

* Re: Capture Bug?
  2016-09-21 20:51     ` Nicolas Goaziou
@ 2016-09-22  9:14       ` Ian Barton
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Barton @ 2016-09-22  9:14 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Emacs-orgmode

On Wed, Sep 21, 2016 at 10:51:46PM +0200, Nicolas Goaziou wrote:
> Hello,
>
> lists@wilkesley.net writes:
>
> > commit 5485170263a46fa17db67b0324c4c4e48bcdfe49
> > Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
> > Date:   Fri Jun 24 01:11:49 2016 +0200
> >
> >     org-capture: Remove forbidden value type from "file" templates
> >
> Try wrapping `capture-pelican-draft-file' call within a function instead
> of putting a raw sexp.
>

I have tried:

("g"
   "New blog post (ianbarton.net)"
      plain
         (file (funcall(capture-pelican-draft-file
   "~/Documents/emacs/web_sites/ianbarton.net/org/_posts")))
      "#+AUTHOR: Ian Barton\n#+DATE: %u\n#+PROPERTY: MODIFIED:
   \n#+TITLE\n#+CATEGORY: Blog \n#+PROPERTY: TAGS \n#+PROPERTY:
   SUMMARY \n#+SETUPFILE: ../setup.org\n\n")

Not sure if that's what you meant. It didn't work.

--
Best wishes,

Ian.

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

end of thread, other threads:[~2016-09-22  9:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21  8:58 Capture Bug? lists
2016-09-21 11:54 ` Adam Porter
2016-09-21 18:24   ` lists
2016-09-21 20:01     ` Adam Porter
2016-09-21 20:51     ` Nicolas Goaziou
2016-09-22  9:14       ` Ian Barton
2016-09-21 21:38   ` Nick Dokos
2016-09-22  2:54     ` Adam Porter

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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