Re: [O] org-capture template to type in bills from shops in ledger format

2019-06-22 Thread Stefan Huchler
If somebody is interested I uploaded a reworked version of this there:

https://github.com/spiderbit/org-capture-ledger-shopping


Stefan Huchler  writes:

> I wrote this template to capture my bills from mostly one shop, but it
> has support for multiple shops and the important feature is that it
> suggests previous item names and remembers last prices, that gives you
> lot's of autocompletion if you repetetivly buy often the same stuff over
> and over again.
>
> #+begin_src emacs-lisp
> %(let* ((default-directory (file-name-directory "%F"))
>   (map-file "shop-items.txt"))
>(load-file "helper.el")
>(require 'dash)
>(let* ((shops (if (file-exists-p map-file)
>(read-from-file map-file) '()))
> (names (mapcar 'car shops))
> (shop-name (ido-completing-read "Shop: " names nil nil nil))
> (new-prices) (new-names) (new-amounts)
> (products (assoc-default shop-name shops)))
>  (while (let* ((names (mapcar 'car products))
>  (name (ido-completing-read "Name: " names))
>  (amount (read-number "Amount: " 1))
>  (item (alist-get name products))
>  (item (if (stringp item) (string-to-number item) item))
>  (price (read-number "Price: " (or item 2.00
> (setq new-names (append new-names (list name)))
> (setq new-prices (append new-prices (list price)))   
> (setq new-amounts (append new-amounts (list amount)))
> (y-or-n-p "More items? ")))
>  (let* ((-compare-fn (lambda (x y) (equal (car x) (car y
>   (new-products (mapcar* 'cons new-names new-prices))
>   (combined-products (-distinct (append new-products products)))
>   (combined-shops (-distinct (append `((,shop-name . 
> ,combined-products)) shops)))
>   (format-string "  expenses:food:%s \t\t%s St @ =€%s")
>   (format-function (lambda (name amount price)
>  (format format-string name amount price)))
>   (product-lines (mapcar* format-function new-names
>new-amounts new-prices))
>   (shopping-items (s-join "\n" product-lines))
>   (total (reduce '+ (mapcar* '* new-amounts new-prices
>(print-to-file map-file combined-shops)
>(concat (format "  %(org-read-date nil nil) * %s\n%s"
>  shop-name shopping-items)
>  (format "\n  assets:bank:chequing\t\t€-%s"
>  (read-string "Total: " (format "%.2f" 
> total)))
> #+end_src
>
>
> Any thoughts? It's supposed to output into a org file with a embeded
> ledger src block so you would have to check the alignment if you would
> want to output to a normal ledger file.
>
> here are the 2 functions from helper.el:
>
> #+begin_src emacs-lisp
> (defun print-to-file (filename data)
>   (with-temp-file filename
> (let* ((print-length 5000))
>   (prin1 data (current-buffer)
>
> (defun read-from-file (filename)
>   (with-temp-buffer
> (insert-file-contents filename)
> (cl-assert (eq (point) (point-min)))
> (read (current-buffer
> #+end_src
>
>
> Maybe that's useful for somebody else or somebody wants to suggest other
> features or something. The only thing I would maybe consider to switch
> is to use a json format for the shop-items.txt for the prices for easier
> manual editing.
>
> that's how I set it up:
>
> #+begin_src emacs-lisp
> ("s" "(S)hopping" plain
>(file+function "path/finances.org"
>   (lambda () ""
> (progn (org-babel-goto-named-src-block "balance")   
>
> (org-babel-goto-src-block-head)(forward-line
>"%[~/capture-templates/template-name]" 
>:jump-to-captured t
>:empty-lines-after 1
>:immediate-finish nil)
> #+end_src 




Re: [O] org-capture template to type in bills from shops in ledger format

2019-06-04 Thread Stefan Huchler
Michael Welle  writes:

> nice. I do something similar with a simple Perl script and an SQL
> database as a backend and sometimes I mull over about what's wrong
> with me ;). On the other hand, I've Org tables telling me when I got
> hair cuts in the last 10 years or so.

Did find a Bug in my code, it only works if you have opened up the
current buffer because %F only gives the path of the current open
buffer.

(default-directory (file-name-directory "%F"))

The easiest solution would be to put the 2 functions from helper.el with
a progn around it in the template file, then you don't need the
load-file statement anymore.





Re: [O] org-capture template to type in bills from shops in ledger format

2019-06-02 Thread Michael Welle
Hello,

Stefan Huchler  writes:

> I wrote this template to capture my bills from mostly one shop, but it
> has support for multiple shops and the important feature is that it
> suggests previous item names and remembers last prices, that gives you
> lot's of autocompletion if you repetetivly buy often the same stuff over
> and over again.
nice. I do something similar with a simple Perl script and an SQL
database as a backend and sometimes I mull over about what's wrong
with me ;). On the other hand, I've Org tables telling me when I got
hair cuts in the last 10 years or so.

Regards
hmw



[O] org-capture template to type in bills from shops in ledger format

2019-06-01 Thread Stefan Huchler
I wrote this template to capture my bills from mostly one shop, but it
has support for multiple shops and the important feature is that it
suggests previous item names and remembers last prices, that gives you
lot's of autocompletion if you repetetivly buy often the same stuff over
and over again.

#+begin_src emacs-lisp
%(let* ((default-directory (file-name-directory "%F"))
(map-file "shop-items.txt"))
   (load-file "helper.el")
   (require 'dash)
   (let* ((shops (if (file-exists-p map-file)
 (read-from-file map-file) '()))
  (names (mapcar 'car shops))
  (shop-name (ido-completing-read "Shop: " names nil nil nil))
  (new-prices) (new-names) (new-amounts)
  (products (assoc-default shop-name shops)))
 (while (let* ((names (mapcar 'car products))
   (name (ido-completing-read "Name: " names))
   (amount (read-number "Amount: " 1))
   (item (alist-get name products))
   (item (if (stringp item) (string-to-number item) item))
   (price (read-number "Price: " (or item 2.00
  (setq new-names (append new-names (list name)))
  (setq new-prices (append new-prices (list price)))   
  (setq new-amounts (append new-amounts (list amount)))
  (y-or-n-p "More items? ")))
 (let* ((-compare-fn (lambda (x y) (equal (car x) (car y
(new-products (mapcar* 'cons new-names new-prices))
(combined-products (-distinct (append new-products products)))
(combined-shops (-distinct (append `((,shop-name . 
,combined-products)) shops)))
(format-string "  expenses:food:%s \t\t%s St @ =€%s")
(format-function (lambda (name amount price)
   (format format-string name amount price)))
(product-lines (mapcar* format-function new-names
 new-amounts new-prices))
(shopping-items (s-join "\n" product-lines))
(total (reduce '+ (mapcar* '* new-amounts new-prices
   (print-to-file map-file combined-shops)
   (concat (format "  %(org-read-date nil nil) * %s\n%s"
   shop-name shopping-items)
   (format "\n  assets:bank:chequing\t\t€-%s"
   (read-string "Total: " (format "%.2f" total)))
#+end_src

Any thoughts? It's supposed to output into a org file with a embeded
ledger src block so you would have to check the alignment if you would
want to output to a normal ledger file.

here are the 2 functions from helper.el:

#+begin_src emacs-lisp
(defun print-to-file (filename data)
  (with-temp-file filename
(let* ((print-length 5000))
  (prin1 data (current-buffer)

(defun read-from-file (filename)
  (with-temp-buffer
(insert-file-contents filename)
(cl-assert (eq (point) (point-min)))
(read (current-buffer
#+end_src

Maybe that's useful for somebody else or somebody wants to suggest other
features or something. The only thing I would maybe consider to switch
is to use a json format for the shop-items.txt for the prices for easier
manual editing.

that's how I set it up:

#+begin_src emacs-lisp
("s" "(S)hopping" plain
 (file+function "path/finances.org"
(lambda () ""
  (progn (org-babel-goto-named-src-block "balance")   
 
(org-babel-goto-src-block-head)(forward-line
 "%[~/capture-templates/template-name]" 
 :jump-to-captured t
 :empty-lines-after 1
 :immediate-finish nil)
#+end_src 




Re: [O] Bug: Capture Template With Link Returns Error [9.2 (9.2-elpaplus @ /home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-19 Thread david wen riccardi-zhu
Thank you! I wasn't really sure what kind of function to pass to 
add-variable-watcher, but using debug-on-variable-change, I got 
the following output:


Debugger entered--setting org-stored-links to nil:
 debug--implement-debug-watch(org-stored-links nil set nil)
 org-insert-link(0 "test")
 #f(compiled-function (s) #)("test")
 org-capture-fill-template()
 org-capture(0)
 org-capture-at-point()
 funcall-interactively(org-capture-at-point)
 call-interactively(org-capture-at-point nil nil)
 command-execute(org-capture-at-point)

I'm not sure what might be causing the last change to nil. Is 
there 
anything I can do to try to shed some light on this?


This is the template I am trying to use:

* %^L :PROPERTIES: :NOTES: %^{NOTES} :END: :LOGBOOK: 
- Added %U. 
:END: 


Many thanks,

David

Allen Li  writes:

On Sat, Jan 12, 2019 at 12:43 AM david wen riccardi-zhu 
 wrote: 


Hello and thank you. This behavior did appear to be fixed, but 
it's surfaced once again today. 


What's the value of org-stored-links when the issue happens? 
This sounds similar to another (fixed) bug where (nil "") gets 
added to org-stored-links.  If this is the case, you could try 
using add-variable-watcher to see what's adding that to 
org-stored-links. 



Nicolas Goaziou  writes: 

> Hello, 
> 
> David Wen Riccardi-Zhu  writes: 
> 
>> I use the following capture template to store bookmarks: 
>> 
>> * %^L :PROPERTIES: :NOTES: %^{NOTES} :END: :LOGBOOK: - Added 
>> %U. :END: 
>> 
>> It was working fine until I updated my packages today. If I 
>> try to use the template now, the following is displayed in 
>> the minibuffer: 
>> 
>> org-capture: Capture abort: Wrong type argument: stringp, 
>> nil 
> 
> Fixed. Thank you. 
> 
> Regards, 
> 
> -- Nicolas Goaziou 

-- dwrz|朱为文 



--
dwrz|朱为文



Re: [O] Bug: Capture Template With Link Returns Error [9.2 (9.2-elpaplus @ /home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-12 Thread Nicolas Goaziou
Hello,

david wen riccardi-zhu  writes:

> Hello and thank you. This behavior did appear to be fixed, but it's
> surfaced once again today.

I couldn't reproduce it.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Capture Template With Link Returns Error [9.2 (9.2-elpaplus @ /home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-11 Thread david wen riccardi-zhu
Hello and thank you. This behavior did appear to be fixed, but 
it's surfaced once again today.


Nicolas Goaziou  writes:

Hello, 

David Wen Riccardi-Zhu  writes: 

I use the following capture template to store bookmarks: 

* %^L :PROPERTIES: :NOTES: %^{NOTES} :END: :LOGBOOK: - Added 
%U. :END: 

It was working fine until I updated my packages today. If I try 
to use the template now, the following is displayed in the 
minibuffer: 

org-capture: Capture abort: Wrong type argument: stringp, nil 


Fixed. Thank you. 

Regards, 

-- Nicolas Goaziou 


--
dwrz|朱为文



Re: [O] Bug: Capture Template With Link Returns Error [9.2 (9.2-elpaplus @ /home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-01 Thread Nicolas Goaziou
Hello,

David Wen Riccardi-Zhu  writes:

> I use the following capture template to store bookmarks:
>
> * %^L :PROPERTIES: :NOTES: %^{NOTES} :END: :LOGBOOK: - Added %U. :END: 
>
> It was working fine until I updated my packages today. If I try to use
> the template now, the following is displayed in the minibuffer:
>
> org-capture: Capture abort: Wrong type argument: stringp, nil

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



[O] Bug: Capture Template With Link Returns Error [9.2 (9.2-elpaplus @ /home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/)]

2019-01-01 Thread David Wen Riccardi-Zhu



I use the following capture template to store bookmarks:

* %^L :PROPERTIES: :NOTES: %^{NOTES} :END: :LOGBOOK: 
- Added %U. 
:END: 

It was working fine until I updated my packages today. If I try to 
use the template now, the following is displayed in the 
minibuffer:


org-capture: Capture abort: Wrong type argument: stringp, nil

This happens after the first prompt.

Remember to cover the basics, that is, what you expected to happen 
and what in fact did happen.  You don't know how to make a good 
report?  See 

https://orgmode.org/manual/Feedback.html#Feedback 

Your bug report will be posted to the Org mailing list. 
 
Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ 
Version 3.22.30) 
of 2018-07-05 
Package: Org mode version 9.2 (9.2-elpaplus @ 
/home/dwrz/.emacs.d/elpa/org-plus-contrib-20181230/) 



--
dwrz|朱为文



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-10 Thread Philip Hudson
On Sat, 10 Nov 2018 at 10:39, Nicolas Goaziou  wrote:
>
> I stand on my ground: capturing an entry should be limited to real
> entries, no exception.

Fine. Thanks for your patience, and sorry I demanded so much of it.

-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-10 Thread Nicolas Goaziou
Hello,

Philip Hudson  writes:

> You have been very clear and categorical about the definition of a
> top-level entry/node/heading as a chunk of text starting with a single
> asterisk (followed by whitespace, arbitrary heading text, optional
> tags and optional further lines of text -- the foundational structure
> all Org users are familiar with).

Not a single asterisk. One or more asterisks.

> You insist that if there is
> Something Else before that asterisk -- "data", in your latest reply --
> then your chunk of text is simply and categorically not an entry. Such
> a chunk of text may or may not /contain/ an entry, but it is
> definitely not itself an entry.

Correct.

> For any preceding Something Else to disqualify a chunk of text as an
> entry, it must first be Something. Lexically speaking, in-buffer
> settings are comments; thus, lexically speaking, they are whitespace;
> thus, lexically speaking, they are Nothing, not Something. That is my
> argument for allowing preceding in-buffer settings within the
> definition of an entry, not just in the context of org-capture but
> throughout Org.

Org has no comment syntax, not in the sense of what you would expect in
a programming language. It has something called a "comment", e.g.,

# This is a comment

but this is meaningful for the exporter only. In an Org document, it is
behaves as a paragraph, e.g.:

1. Item1
# Comment
1. Item2

instead of

1. Item1
# Comment
2. Item2

There is no Nothing in an Org document.

Of course, there syntactical elements in such a document. #+FOO: is one
of them. So are #+BEGIN_CENTER and CLOCK:. But there is no reason to
support capturing them before an entry, and not regular text. This is
just inconsistent.

This is also useless, as I pointed out already, since the location of
keywords in a document doesn't matter. They need not be before the first
heading.

Eventually, it is awkward. Think about capturing an entry with text
before it, in the "Target" node below:


  * Target
  Target contents
  ** Child
  Child contents

It could become:

  * Target
  Target contents
  ** Child
  Child contents
  Captured before
  ** Captured
  Captured contents

i.e., you modify "Child" contents even though you capture into "Target".
It is possible that someone may come up with a use-case for that, but
I would suggest them to implement their own capture mechanism. Org
shouldn't support that.

I stand on my ground: capturing an entry should be limited to real
entries, no exception.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-06 Thread Philip Hudson
On Mon, 5 Nov 2018 at 21:46, Nicolas Goaziou  wrote:
>
> Philip Hudson  writes:
>
> > On Sun, 4 Nov 2018 at 14:03, Nicolas Goaziou  wrote:
>
> >> No, it is not the case. AFAIU, in the minimal failing case, you capture
> >>
> >> #+FOO: bar
> >> * Baz
> >>
> >> This is _not_ a node. A node starts with a headline and everything is
> >> contained within that headline. So it doesn't qualify as a valid `entry'
> >> capture type.
> >
> > That's disappointing, and, obviously, news to me. So I have not
> > encountered a regression but rather a tightening of the existing
> > documented contract. Is that a fair interpretation of what you're
> > saying? If so, and not that I doubt you, do you have a reference for
> > that?
>
> It is not a tightening of anything. The function responsible for the
> raised error is `org-capture-verify-tree'. It is called from the
> function responsible for capturing `entry' types since December 2010:
>
> commit 8aacc708dd038fd0d351abbed04d49f813f8a7bf
> Author: Carsten Dominik 
> Date:   Thu Dec 16 16:51:04 2010 +0100
>
> Capture: Better error message for invalid entry-type templates
>
> It seems to me the intent is clear, and from the documentation,
> I wouldn't have thought about inserting data before the headline.

Ah-ha! I thought not. I want to contest the use of the word "data"
here; see below.

> I'm
> surprised that your template even worked at some point.

This is baffling to me, but ultimately unimportant..

> I did my homework, though. I tried the following set-up
>
> (setq org-capture-templates
>   '(("B" "BUG" entry (file "/tmp/bug-capture.org") "#+BAR: baz\n* Foo"
>  :immediate-finish t)))
>
> Even in Org 8.2.10, which is old in my book, I got an error mentioning
> the template was invalid.
>
> > The idea of 'entry type for templates, and of a node as we are
> > discussing it, is that a well-formed and valid Org file is composed
> > exclusively of these entities and nothing else. Correct?
>
> Not at all. I'm absolutely not talking about what is a valid Org file.
> See  for this.
>
> I'm talking about what can be captured using an `entry' template, i.e.,
> a node/heading/entry and that's it.
>
> > Sorry if this is getting tiresome. At this point I'm content for you
> > to close this issue and move on if you'd rather. I'll change my
> > template type to 'plain, or find some other workaround. But if you'd
> > like to keep going for the sake of clarifying what the right and
> > proper meaning of 'entry and "node" are then I'm glad to participate.
>
> Entry, node, and heading (and to some extent, headline) are synonyms.
> They mean star(s) at the beginning of line, followed by a space, and
> optionally other stuff of that line.
>
> Contents can be anything as long as no line starts with as many or less
> stars followed by a space, i.e., there is no headline of a lesser or
> equal level.
>
> In any case, if documentation needs to be clarified, please let me know.

I'm not ready to let go of the question of the definition of an entry.

You have been very clear and categorical about the definition of a
top-level entry/node/heading as a chunk of text starting with a single
asterisk (followed by whitespace, arbitrary heading text, optional
tags and optional further lines of text -- the foundational structure
all Org users are familiar with). You insist that if there is
Something Else before that asterisk -- "data", in your latest reply --
then your chunk of text is simply and categorically not an entry. Such
a chunk of text may or may not /contain/ an entry, but it is
definitely not itself an entry.

Can we agree that what we are doing here is lexing? That is essential
to my argument that follows. If we are, then I think I have a good
case to make. Here it is:

For any preceding Something Else to disqualify a chunk of text as an
entry, it must first be Something. Lexically speaking, in-buffer
settings are comments; thus, lexically speaking, they are whitespace;
thus, lexically speaking, they are Nothing, not Something. That is my
argument for allowing preceding in-buffer settings within the
definition of an entry, not just in the context of org-capture but
throughout Org.

I hope I'm making myself clear. Am I wrong about any of this, and if
so, why and how? What I really want to know is: what is wrong with my
suggested change, temporarily stripping leading in-buffer settings
during the call to `org-capture-verify-tree'? What breaks? What do we
lose by implementing it? What do we gain by not implementing it? What
depends on such a change /not/ being made? As I said myself, it feels
like an inglorious kludge, but would it actually be wrong in some way
within the semantics and working constraints of Org? Should that
temporary stripping-out of preceding in-buffer settings actually be
implemented not in `org-capture-verify' but in the core-Org function
it calls, `org-kill-is-subtree-p', thus 

Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-05 Thread Nicolas Goaziou
Hello,

Philip Hudson  writes:

> On Sun, 4 Nov 2018 at 14:03, Nicolas Goaziou  wrote:

>> No, it is not the case. AFAIU, in the minimal failing case, you capture
>>
>> #+FOO: bar
>> * Baz
>>
>> This is _not_ a node. A node starts with a headline and everything is
>> contained within that headline. So it doesn't qualify as a valid `entry'
>> capture type.
>
> That's disappointing, and, obviously, news to me. So I have not
> encountered a regression but rather a tightening of the existing
> documented contract. Is that a fair interpretation of what you're
> saying? If so, and not that I doubt you, do you have a reference for
> that?

It is not a tightening of anything. The function responsible for the
raised error is `org-capture-verify-tree'. It is called from the
function responsible for capturing `entry' types since December 2010:

commit 8aacc708dd038fd0d351abbed04d49f813f8a7bf
Author: Carsten Dominik 
Date:   Thu Dec 16 16:51:04 2010 +0100

Capture: Better error message for invalid entry-type templates

It seems to me the intent is clear, and from the documentation,
I wouldn't have thought about inserting data before the headline. I'm
surprised that your template even worked at some point.

I did my homework, though. I tried the following set-up

(setq org-capture-templates
  '(("B" "BUG" entry (file "/tmp/bug-capture.org") "#+BAR: baz\n* Foo"
 :immediate-finish t)))

Even in Org 8.2.10, which is old in my book, I got an error mentioning
the template was invalid.

> The idea of 'entry type for templates, and of a node as we are
> discussing it, is that a well-formed and valid Org file is composed
> exclusively of these entities and nothing else. Correct?

Not at all. I'm absolutely not talking about what is a valid Org file.
See  for this.

I'm talking about what can be captured using an `entry' template, i.e.,
a node/heading/entry and that's it.

> Sorry if this is getting tiresome. At this point I'm content for you
> to close this issue and move on if you'd rather. I'll change my
> template type to 'plain, or find some other workaround. But if you'd
> like to keep going for the sake of clarifying what the right and
> proper meaning of 'entry and "node" are then I'm glad to participate.

Entry, node, and heading (and to some extent, headline) are synonyms.
They mean star(s) at the beginning of line, followed by a space, and
optionally other stuff of that line.

Contents can be anything as long as no line starts with as many or less
stars followed by a space, i.e., there is no headline of a lesser or
equal level.

In any case, if documentation needs to be clarified, please let me know.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-04 Thread Philip Hudson
On Sun, 4 Nov 2018 at 14:03, Nicolas Goaziou  wrote:
>
> Philip Hudson  writes:
>
> > On Sat, 3 Nov 2018 at 08:34, Nicolas Goaziou  wrote:
>
> >> I cannot see your template, since you did not send it yet. I assume it
> >> uses an `entry' type.
> >
> > No assumption involved. I stated so plainly.
>
> Indeed.
>
> >> Barring `plain', all capture types enforce
> >> a certain structure for contents. The `entry' type expects a node, which
> >> is roughly a headline plus contents, as noted in the manual:
> >>
> >>  ‘entry’
> >>   An Org mode node, with a headline.  Will be filed as the child
> >>   of the target entry or as a top-level entry.  The target file
> >>   should be an Org file.
> >
> > Agreed, understood, and 100% the case in both my case (I'm afraid
> > you'll just have to take my word for it) and in the trivial but
> > effectively illustrative minimal failing case I gave you.
>
> No, it is not the case. AFAIU, in the minimal failing case, you capture
>
> #+FOO: bar
> * Baz
>
> This is _not_ a node. A node starts with a headline and everything is
> contained within that headline. So it doesn't qualify as a valid `entry'
> capture type.

That's disappointing, and, obviously, news to me. So I have not
encountered a regression but rather a tightening of the existing
documented contract. Is that a fair interpretation of what you're
saying? If so, and not that I doubt you, do you have a reference for
that?

> > The doco seems fine to me. I relied on it for the definition of my
> > template, which has worked as expected for years.
>
> It might be that you misinterpreted the definition of a node. Hence my
> suggestion to improve the documentation.

If this is the only place that the definition should appear (not
saying that I know or believe it is), then are we not free to say that
it could be otherwise? Effectively, in terms of actual behavior, the
definition of "node" (at least in this context) has been otherwise,
for several years at least. In other words, absent a formal definition
of interface/contract, the implementation /is/ the interface; this is
an implementation change, and thus (arguably) a regression
nevertheless.

In still other words, I'm arguing this:

The idea of 'entry type for templates, and of a node as we are
discussing it, is that a well-formed and valid Org file is composed
exclusively of these entities and nothing else. Correct?

If that is true, then, under your definition, no well-formed and valid
Org file constructed only from Org-capture using templates of the
'entry type can ever start with any number of #+FOO in-buffer
settings. This is clearly at odds with the established definition of a
well-formed and valid Org file.

> In any case, you can simply move the keywords below the headline, and be
> done with it.

Sorry if this is getting tiresome. At this point I'm content for you
to close this issue and move on if you'd rather. I'll change my
template type to 'plain, or find some other workaround. But if you'd
like to keep going for the sake of clarifying what the right and
proper meaning of 'entry and "node" are then I'm glad to participate.

-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-04 Thread Nicolas Goaziou
Hello,

Philip Hudson  writes:

> On Sat, 3 Nov 2018 at 08:34, Nicolas Goaziou  wrote:

>> I cannot see your template, since you did not send it yet. I assume it
>> uses an `entry' type.
>
> No assumption involved. I stated so plainly.

Indeed.

>> Barring `plain', all capture types enforce
>> a certain structure for contents. The `entry' type expects a node, which
>> is roughly a headline plus contents, as noted in the manual:
>>
>>  ‘entry’
>>   An Org mode node, with a headline.  Will be filed as the child
>>   of the target entry or as a top-level entry.  The target file
>>   should be an Org file.
>
> Agreed, understood, and 100% the case in both my case (I'm afraid
> you'll just have to take my word for it) and in the trivial but
> effectively illustrative minimal failing case I gave you.

No, it is not the case. AFAIU, in the minimal failing case, you capture

#+FOO: bar
* Baz

This is _not_ a node. A node starts with a headline and everything is
contained within that headline. So it doesn't qualify as a valid `entry'
capture type.

> The doco seems fine to me. I relied on it for the definition of my
> template, which has worked as expected for years.

It might be that you misinterpreted the definition of a node. Hence my
suggestion to improve the documentation.

In any case, you can simply move the keywords below the headline, and be
done with it.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-03 Thread Philip Hudson
On Sat, 3 Nov 2018 at 08:34, Nicolas Goaziou  wrote:
>
> Philip Hudson  writes:
>
> > Why? This is a regression.
>
> You have something in your configuration that no longer works.

Agreed.

> Generally
> speaking, that could be a plain regression, indeed. But you may also
> have been relying on unspecified behavior: this might be a documentation
> bug.

Also agreed.

> I cannot see your template, since you did not send it yet. I assume it
> uses an `entry' type.

No assumption involved. I stated so plainly.

> Barring `plain', all capture types enforce
> a certain structure for contents. The `entry' type expects a node, which
> is roughly a headline plus contents, as noted in the manual:
>
>  ‘entry’
>   An Org mode node, with a headline.  Will be filed as the child
>   of the target entry or as a top-level entry.  The target file
>   should be an Org file.

Agreed, understood, and 100% the case in both my case (I'm afraid
you'll just have to take my word for it) and in the trivial but
effectively illustrative minimal failing case I gave you. Have you
tested that case and confirmed that my report is correct?

> You seem to capture something that doesn't correspond to this
> definition, hence the error.

That is a completely erroneous leap of logic. Try the minimal failing case.

> Note that keywords are global, so you could
> equivalently write:
>
> * Baz
> #+FOO: bar

Agreed, understood.

> Maybe the documentation could be clearer, too. Suggestions welcome.

The doco seems fine to me. I relied on it for the definition of my
template, which has worked as expected for years.


-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-03 Thread Nicolas Goaziou
Hello,

Philip Hudson  writes:

> Why? This is a regression.

You have something in your configuration that no longer works. Generally
speaking, that could be a plain regression, indeed. But you may also
have been relying on unspecified behavior: this might be a documentation
bug.

I cannot see your template, since you did not send it yet. I assume it
uses an `entry' type. Barring `plain', all capture types enforce
a certain structure for contents. The `entry' type expects a node, which
is roughly a headline plus contents, as noted in the manual:

 ‘entry’
  An Org mode node, with a headline.  Will be filed as the child
  of the target entry or as a top-level entry.  The target file
  should be an Org file.

You seem to capture something that doesn't correspond to this
definition, hence the error. Note that keywords are global, so you could
equivalently write:

* Baz
#+FOO: bar

Now, with your template, I could reproduce the problem and try to know
when and how the change happened, and guess the intent of `entry' type
before this change.

Maybe the documentation could be clearer, too. Suggestions welcome.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-02 Thread Philip Hudson
On Fri, 2 Nov 2018 at 01:35, Nicolas Goaziou  wrote:
>
> Philip Hudson  writes:
>
> > Here's a minimal failing capture-completed template:
> >
> > --- Cut here --
> >
> > #+FOO: bar
> >
> > * Baz
> > -- Cut here --
>
> I would like to see you capture template in its elisp form, i.e., as set
> in `org-capture-templates'.
>
> Thank you.

Why? This is a regression.

-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-01 Thread Nicolas Goaziou
Philip Hudson  writes:

> Here's a minimal failing capture-completed template:
>
> --- Cut here --
>
> #+FOO: bar
>
> * Baz
> -- Cut here --

I would like to see you capture template in its elisp form, i.e., as set
in `org-capture-templates'.

Thank you.



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-01 Thread Philip Hudson
On Thu, 1 Nov 2018 at 22:12, Nicolas Goaziou  wrote:
>
> Philip Hudson  writes:
>
> Could you show your template? Could you explain how you initiate the
> capture process (e.g., with arguments)? Also, could you show the desired
> output?

Here's a minimal failing capture-completed template:

--- Cut here --
#+FOO: bar

* Baz
-- Cut here --

Pass this into `org-capture-verify-tree'. This will reproduce the error.

My fix strips out the leading in-buffer settings for the duration of
that call only. Effectively what gets passed into
`org-capture-verify-tree' is then this:

--- Cut here --
* Baz
--- Cut here --

-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-01 Thread Nicolas Goaziou
Hello,

Philip Hudson  writes:

> I expected my (previously working) org-capture template to be
> inserted into a newly-created empty Org file. The file name and
> location are the output of a function specified in the template
> (sequentially numbered filename).

Could you show your template? Could you explain how you initiate the
capture process (e.g., with arguments)? Also, could you show the desired
output?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-11-01 Thread Philip Hudson
Two further thoughts:

1. That regexp works but it should really start with "^":

  (org-capture-verify-tree (replace-regexp-in-string "^#\+[^\n]*\n" ""
template))

2. The fix I propose is a kludge. The real problem is the semantics of
function `org-capture-insert-template-here'. My assertion: there is no
reason to believe that a completed template of type 'entry must be a
subtree in the sense of the contract of function
`org-kill-is-subtree-p'. In other words, function
`org-kill-is-subtree-p' is meant for something else. We either need a
similar-but-different special-purpose entry-template verification
function, defined in 'org-capture.el' itself, or, if we can do so
without introducing other regressions, we need to modify function
`org-kill-is-subtree-p' to accept "#+KEYWORD" in-buffer settings.
On Mon, 29 Oct 2018 at 22:47, Philip Hudson  wrote:
>
> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?  See
>
> https://orgmode.org/manual/Feedback.html#Feedback
>
> Your bug report will be posted to the Org mailing list.
> 
>
> Regression in org-capture template handling.
>
> I expected my (previously working) org-capture template to be
> inserted into a newly-created empty Org file. The file name and
> location are the output of a function specified in the template
> (sequentially numbered filename).
>
> Function `org-capture-insert-template-here' in file org-capture.el
> now errors if the template specifies that its type is 'entry and it
> begins with one or more lines of the general form "#+KEY value".
> The error traces to a call to `org-kill-is-subtree-p', defined in file
> org.el.
>
> Fix (sorry it's not a proper patch):
>
> Change line 1399 of org-capture.el from:
>
>(org-capture-verify-tree (org-capture-get :template))
>
> to:
>
>(org-capture-verify-tree (replace-regexp-in-string "#\+[^\n]*\n" ""
> template))
>
> (This includes a refactoring-out of that redundant call to `org-capture-get').
>
> NOTE: I have signed the FSF papers. In fact I've made small
> contributions to Org-mode previously.
>
> Emacs  : GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
> of 2017-09-12 on hullmann, modified by Debian
> Package: Org mode version 9.1.14 (9.1.14-1-g4931fc-elpa @
> /home/phil/.emacs.d/elpa/org-9.1.14/)
>
> --
> Phil Hudson  http://hudson-it.ddns.net
> Pretty Good Privacy (PGP) ID: 0x4E482F85



-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85



[O] Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]

2018-10-29 Thread Philip Hudson
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Regression in org-capture template handling.

I expected my (previously working) org-capture template to be
inserted into a newly-created empty Org file. The file name and
location are the output of a function specified in the template
(sequentially numbered filename).

Function `org-capture-insert-template-here' in file org-capture.el
now errors if the template specifies that its type is 'entry and it
begins with one or more lines of the general form "#+KEY value".
The error traces to a call to `org-kill-is-subtree-p', defined in file
org.el.

Fix (sorry it's not a proper patch):

Change line 1399 of org-capture.el from:

   (org-capture-verify-tree (org-capture-get :template))

to:

   (org-capture-verify-tree (replace-regexp-in-string "#\+[^\n]*\n" ""
template))

(This includes a refactoring-out of that redundant call to `org-capture-get').

NOTE: I have signed the FSF papers. In fact I've made small
contributions to Org-mode previously.

Emacs  : GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
of 2017-09-12 on hullmann, modified by Debian
Package: Org mode version 9.1.14 (9.1.14-1-g4931fc-elpa @
/home/phil/.emacs.d/elpa/org-9.1.14/)

-- 
Phil Hudson  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85



[O] org-capture template; insert a Property named Category with autocompletion; How?

2017-09-24 Thread Physiculus
Sorry, forget to tell the usual things...
Org 9.1.1
Emacs 25.1
Win 8.1 64 bit.

Hello,
i created the following template to insert a TODO item with
inserting a Property named Category. Unfortunately i do not manage
it to use autocompletion.

here is the template:
("t" "ToDo" entry
  (file "~/org/Heldennotizen.org")
  "* TODO %? [/] %^G
:PROPERTIES:
:CATEGORY: %^{CATEGORY}p
:TAGS:
:ORDERED: t
:END:"

i read about using a using the variable org-global-properties for
this, but helm does not provide any autocompletion.
 
'(org-global-properties
(quote
(("CATEGORY" . "Garten")
("CATEGORY" . "Haus")
("CATEGORY" . "Ich")
("CATEGORY" . "Leben"

How could i configure it?

Best Regards
Physiculus




Re: [O] %( in capture template

2017-03-16 Thread Samuel Wales
On 3/14/17, Nicolas Goaziou  wrote:
> Thank you. I think it is fixed, now. Could you test maint branch and
> report your result?

it seems to work so far.  thank you.

btw, the org-capture firefox extension is behaving more reliably also,
with recent firefox-esr.  it has been many years since i tried to get
protocol to work.

this matters because i very often only use the mouse.

-- 
The Kafka Pandemic: 

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

The NIH, FDA, and CDC are not there for you.  Not without activism.

"You’ve really gotta quit this and get moving, because this is murder
by neglect." ---
.



Re: [O] %( in capture template

2017-03-14 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> ===
> * ecm
> capture literally inserts.  i was told this is not normal,
> but a bug.
>
> recent maint
>
> to reproduce, evaluate the following code, select the lines
> in the scratch buffer, and run m-x org-capture RET p.
>
> set the notes file to whatever works for you.
>
> *** code
>   (require 'org-capture)
>   (setq org-default-notes-file (substitute-in-file-name
> "$dorg/alpha-org-testcase.org"))
>   ;; (find-file org-default-notes-file)
>   (defun alpha-org-testcase--create-capture-bug ()
> (add-to-list 'org-capture-templates
>  `("p" "Protocol p" entry
>(file+headline ,org-default-notes-file "xyzzy-remember")
>"%(alpha-org-protocol-string \"%:link\"
> \"%:description\" \"%i\")"
>:prepend t :immediate-finish t :jump-to-captured t))
> (defun alpha-org-protocol-string (link description region)
>   (format "* debug org-capture
>- link %s
>- description %s
>- region %s \
>"
>   link description region)))
> *** the bug is below
> * debug org-capture
>  - link
>  - description
>  - region ;; This buffer is for notes you don't want to
> save, and for Lisp evaluation.
>   %(alpha-org-protocol-string "" "" ";; If you want to create a file,
> visit that file with C-x C-f,
>   %(alpha-org-protocol-string "" "" ";; then enter the text in that
> file's own buffer.
>   %(alpha-org-protocol-string "" "" "
>   %(alpha-org-protocol-string "" "" "
> ===

Thank you. I think it is fixed, now. Could you test maint branch and
report your result?

Regards,

-- 
Nicolas Goaziou



Re: [O] %( in capture template

2017-03-12 Thread Samuel Wales
===
* ecm
capture literally inserts.  i was told this is not normal,
but a bug.

recent maint

to reproduce, evaluate the following code, select the lines
in the scratch buffer, and run m-x org-capture RET p.

set the notes file to whatever works for you.

*** code
  (require 'org-capture)
  (setq org-default-notes-file (substitute-in-file-name
"$dorg/alpha-org-testcase.org"))
  ;; (find-file org-default-notes-file)
  (defun alpha-org-testcase--create-capture-bug ()
(add-to-list 'org-capture-templates
 `("p" "Protocol p" entry
   (file+headline ,org-default-notes-file "xyzzy-remember")
   "%(alpha-org-protocol-string \"%:link\"
\"%:description\" \"%i\")"
   :prepend t :immediate-finish t :jump-to-captured t))
(defun alpha-org-protocol-string (link description region)
  (format "* debug org-capture
   - link %s
   - description %s
   - region %s \
   "
  link description region)))
*** the bug is below
* debug org-capture
 - link
 - description
 - region ;; This buffer is for notes you don't want to
save, and for Lisp evaluation.
  %(alpha-org-protocol-string "" "" ";; If you want to create a file,
visit that file with C-x C-f,
  %(alpha-org-protocol-string "" "" ";; then enter the text in that
file's own buffer.
  %(alpha-org-protocol-string "" "" "
  %(alpha-org-protocol-string "" "" "
===

On 1/10/17, Nicolas Goaziou  wrote:
> Hello,
>
> Samuel Wales  writes:
>
>> i have "%(my-function \"%:link\" \"%:description\" \"%i\")" in a
>> capture template, which now does not run the function but treats it as
>> text.
>
> It should. Do you have an ECM?
>
> Regards,
>
> --
> Nicolas Goaziou
>


-- 
The Kafka Pandemic: 

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

The NIH, FDA, and CDC are not there for you.  Not without activism.

"You’ve really gotta quit this and get moving, because this is murder
by neglect." ---
.



Re: [O] %( in capture template

2017-03-06 Thread Samuel Wales
On 2/19/17, Samuel Wales  wrote:
> * x
>link
> https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c
>description Gmail - %( in capture template
>region
> %(alpha-org-protocol-string
> "https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
> "Gmail - %( in capture template" "> with the new org maint code, i
> still occasionally get the literal string.
> %(alpha-org-protocol-string
> "https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
> "Gmail - %( in capture template" ">
> %(alpha-org-protocol-string
> "https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
> "Gmail - %( in capture template" "> it occurs when the region spans a
> blank line.

intuitively, does this sound like user error, or a bug?



Re: [O] %( in capture template

2017-02-19 Thread Samuel Wales
the above bug description pertains to recent org maint.



Re: [O] %( in capture template

2017-02-19 Thread Samuel Wales
On 2/19/17, Nicolas Goaziou  wrote:
> I have trouble understanding the double quote above. Do you mean the
> text below is inserted within the %(concat ...) or are these your
> templates? In this case, which one produces the error?

thanks for asking about this.

for clarity, let's do it from the beginning.

[first please note that i am experiencing random results.  sometimes
it works fine but:

  1] sometimes nothing shows up
  2] sometimes as i will describe below
  3] sometimes nothing shows up, but "Warning (emacs): Please update
your org protocol handler to deal with new-style links." buffer pops
up

what i will describe is 2, which is the topic of this thread.]

just now i selected the first two paragraphs of the quote of your
email, and clicked the org-capture extension unicorn.

i use this function:

(defun alpha-org-protocol-string (link description region)
  (format "* x
   link %s
   description %s
   region %s
   " link description region))

the result of clicking on the unicorn:

===
* x
   link
https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c
   description Gmail - %( in capture template
   region
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
"Gmail - %( in capture template" "> with the new org maint code, i
still occasionally get the literal string.
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
"Gmail - %( in capture template" ">
%(alpha-org-protocol-string
"https://mail.google.com/mail/u/0/h/rfjkj7op114w/?=15a580ccf5cb9d34=c;
"Gmail - %( in capture template" "> it occurs when the region spans a
blank line.
===

region should be what i selected.  instead it is a garbled version of
what i selected with the literal function call text.  is this user
error?

the double quotes are as you see them.  i did not add any.

below are my templates.

  (add-to-list 'org-capture-templates
   `("L" "Protocol L for link" entry
 (file+headline ,org-default-notes-file "xyzzy-remember")
 ;; fixme perhaps i do not need the %i, if it is for no text
 "%(alpha-org-protocol-string \"%:link\"
\"%:description\" \"%i\") L"
 :prepend t :immediate-finish t :jump-to-captured t))
  ;; this seems to get called by org capture whether selection or not
  (add-to-list 'org-capture-templates
   `("p" "Protocol p" entry
 (file+headline ,org-default-notes-file "xyzzy-remember")
 "%(alpha-org-protocol-string \"%:link\"
\"%:description\" \"%i\")"
 :prepend t :immediate-finish t :jump-to-captured t))

the org capture extension is set to p, so the second one should be the
operative one.  but what do i know?

so perhaps %i is being set to some crazy value.

i definitely do not understand any of this stuff.



Re: [O] %( in capture template

2017-02-19 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> with the new org maint code, i still occasionally get the literal string.
>
> it occurs when the region spans a blank line.

I cannot reproduce your issue.

> like
>
>   %(concat
> "http://whatever.whatever/building-a-mold-free-house/whatever;
> "Building a mold free house" "

I have trouble understanding the double quote above. Do you mean the
text below is inserted within the %(concat ...) or are these your
templates? In this case, which one produces the error?

> these remplates [don't know if first does anything]
>
>   (add-to-list 'org-capture-templates
>`("L" "Protocol L for link" entry
>  (file+headline ,org-default-notes-file "xyzzy-remember")
>  ;; fixme perhaps i do not need the %i, if it is for no text
>  "%(concat \"%:link\"
> \"%:description\" \"%i\") L"
>  :prepend t :immediate-finish t :jump-to-captured t))
>   ;; this seems to get called by org capture whether selection or not
>   (add-to-list 'org-capture-templates
>`("p" "Protocol p" entry
>  (file+headline ,org-default-notes-file "xyzzy-remember")
>  "%(concat \"%:link\"
> \"%:description\" \"%i\")"
>  :prepend t :immediate-finish t :jump-to-captured t))

Regards,

-- 
Nicolas Goaziou



[O] %( in capture template

2017-02-08 Thread Samuel Wales
with the new org maint code, i still occasionally get the literal string.

it occurs when the region spans a blank line.

like

  %(concat
"http://whatever.whatever/building-a-mold-free-house/whatever;
"Building a mold free house" "

these remplates [don't know if first does anything]

  (add-to-list 'org-capture-templates
   `("L" "Protocol L for link" entry
 (file+headline ,org-default-notes-file "xyzzy-remember")
 ;; fixme perhaps i do not need the %i, if it is for no text
 "%(concat \"%:link\"
\"%:description\" \"%i\") L"
 :prepend t :immediate-finish t :jump-to-captured t))
  ;; this seems to get called by org capture whether selection or not
  (add-to-list 'org-capture-templates
   `("p" "Protocol p" entry
 (file+headline ,org-default-notes-file "xyzzy-remember")
 "%(concat \"%:link\"
\"%:description\" \"%i\")"
 :prepend t :immediate-finish t :jump-to-captured t))

-- 
The Kafka Pandemic: 

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it -- at any time.

"You’ve really gotta quit this and get moving, because this is murder
by neglect." --- very true words by Johanna Kaiser spoken to US NIH in
conference call with Walter Koroshetz, NINDS director


Denmark: free Karina Hansen NOW.
  UPDATE 2016-10: home, but not fully free



Re: [O] %( in capture template

2017-01-11 Thread Samuel Wales
hi nicolas,


thank you for the fix.  quick testing seems to show that it works much
better.  will keep evaluating it.

i had thought it was my own lack of understanding.

there is one problem.  when i select a few paragraphs in firefox using
org-capture extension, they get captured as one long line.  but i'm
guessing that's protocol, not capture.


samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.
  UPDATE 2016-10: home, but not fully free



Re: [O] %( in capture template

2017-01-11 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> here are the entries:
>
> ("p" "Protocol p" entry
>   (file+headline "/home/org/executive--a.org" "xyzzy-remember")
>   "%(alpha-org-protocol-string \"%:link\" \"%:description\"
> \"%i\")" :prepend t :immediate-finish t :jump-to-captured t)
>  ("L" "Protocol L" entry
>   (file+headline "/home/org/executive--a.org" "xyzzy-remember")
>   "%(alpha-org-protocol-string \"%:link\" \"%:description\"
> \"%i\")" :prepend t :immediate-finish t :jump-to-captured t)

I fixed an issue with :jump-to-captured in conjunction with a nil
`org-capture-bookmark'.

Now, I can use the following template without issue

 ("B" "BUG!" entry
  (file+headline "/tmp/bug-capture.org" "test")
  "%(concat \"* headline\" \"%:link\" \"%:description\" \"%i\")"
  :prepend t :immediate-finish t :jump-to-captured t)

Note that `alpha-org-protocol-string' is expected to create a valid Org
tree (or headline).

Could you confirm it is now working as expected? Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] %( in capture template

2017-01-10 Thread Samuel Wales
On 1/10/17, Nick Dokos  wrote:
> IIUC, if the function call is part of the template that is inserted as a
> result of the capture, the function should still be executed: I see
> calls to `org-capture-expand-embedded-elisp' still in
> `org-capture'. Can you post the full entry?

here are the entries:

("p" "Protocol p" entry
  (file+headline "/home/org/executive--a.org" "xyzzy-remember")
  "%(alpha-org-protocol-string \"%:link\" \"%:description\"
\"%i\")" :prepend t :immediate-finish t :jump-to-captured t)
 ("L" "Protocol L" entry
  (file+headline "/home/org/executive--a.org" "xyzzy-remember")
  "%(alpha-org-protocol-string \"%:link\" \"%:description\"
\"%i\")" :prepend t :immediate-finish t :jump-to-captured t)

background: this is part of my years-long effort to try to
get protocol to work from firefox.  i never got org-protocol to work
reliably in org 8, despite trying probably at least 4 separate sets of
instructions.

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.
  UPDATE 2016-10: home, but not fully free



Re: [O] %( in capture template

2017-01-10 Thread Nicolas Goaziou
Hello,

Samuel Wales  writes:

> i have "%(my-function \"%:link\" \"%:description\" \"%i\")" in a
> capture template, which now does not run the function but treats it as
> text.

It should. Do you have an ECM?

Regards,

-- 
Nicolas Goaziou



Re: [O] %( in capture template

2017-01-10 Thread Nick Dokos
Samuel Wales  writes:

> i have "%(my-function \"%:link\" \"%:description\" \"%i\")" in a
> capture template, which now does not run the function but treats it as
> text.  i get that this is for security.  what do i do?

IIUC, if the function call is part of the template that is inserted as a
result of the capture, the function should still be executed: I see
calls to `org-capture-expand-embedded-elisp' still in
`org-capture'. Can you post the full entry?

-- 
Nick




[O] %( in capture template

2017-01-10 Thread Samuel Wales
i have "%(my-function \"%:link\" \"%:description\" \"%i\")" in a
capture template, which now does not run the function but treats it as
text.  i get that this is for security.  what do i do?

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  And
ANYBODY can get it.

Denmark: free Karina Hansen NOW.
  UPDATE 2016-10: home, but not fully free



Re: [O] org-capture-template :clock-in property not working

2016-12-13 Thread Mark Wood
I believe I found my issue.

It appears I had a hook upon clockout that was causing issues.  So sorry to
bother everyone.

On the plus side, I learned some lisp debugging skills.

Thanks again.

On Tue, Dec 13, 2016 at 10:13 AM Mark Wood  wrote:

> I did a little more digging.  I too can get it to work correctly, so long
> as there is no Default Clock task identified.
>
> However, if I create a default clock task, it appears that the :clock-in
> property is ignored.
>
> I'll try to dig into it a little more, but I can reproduce it every time
> when there is a default clock.
>
> Thanks again for looking at it.
>
> On Tue, Dec 13, 2016 at 8:09 AM Nicolas Goaziou 
> wrote:
>
> Hello,
>
> Mark Wood  writes:
>
> > After recently upgrading to 20161118, I notice that the clock-in property
> > in my org-capture-templates is no longer functioning.  It appears to
> > successfully clock me out of my current task, but that's it.
> >
> > My capture template is:
> >
> > (setq org-capture-templates
> >   '(("t" "Todo" entry (file "/org/refile.org")
> > "* TODO %?\n%U\n" :clock-in t :clock-resume t)))
>
> FWIW I cannot reproduce it, i.e., clock is properly started.
>
> Regards,
>
> --
> Nicolas Goaziou
>
>


Re: [O] org-capture-template :clock-in property not working

2016-12-13 Thread Mark Wood
I did a little more digging.  I too can get it to work correctly, so long
as there is no Default Clock task identified.

However, if I create a default clock task, it appears that the :clock-in
property is ignored.

I'll try to dig into it a little more, but I can reproduce it every time
when there is a default clock.

Thanks again for looking at it.

On Tue, Dec 13, 2016 at 8:09 AM Nicolas Goaziou 
wrote:

> Hello,
>
> Mark Wood  writes:
>
> > After recently upgrading to 20161118, I notice that the clock-in property
> > in my org-capture-templates is no longer functioning.  It appears to
> > successfully clock me out of my current task, but that's it.
> >
> > My capture template is:
> >
> > (setq org-capture-templates
> >   '(("t" "Todo" entry (file "/org/refile.org")
> > "* TODO %?\n%U\n" :clock-in t :clock-resume t)))
>
> FWIW I cannot reproduce it, i.e., clock is properly started.
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] org-capture-template :clock-in property not working

2016-12-13 Thread Nicolas Goaziou
Hello,

Mark Wood  writes:

> After recently upgrading to 20161118, I notice that the clock-in property
> in my org-capture-templates is no longer functioning.  It appears to
> successfully clock me out of my current task, but that's it.
>
> My capture template is:
>
> (setq org-capture-templates
>   '(("t" "Todo" entry (file "/org/refile.org")
> "* TODO %?\n%U\n" :clock-in t :clock-resume t)))

FWIW I cannot reproduce it, i.e., clock is properly started.

Regards,

-- 
Nicolas Goaziou



[O] org-capture-template :clock-in property not working

2016-12-12 Thread Mark Wood
After recently upgrading to 20161118, I notice that the clock-in property
in my org-capture-templates is no longer functioning.  It appears to
successfully clock me out of my current task, but that's it.

My capture template is:

(setq org-capture-templates
  '(("t" "Todo" entry (file "/org/refile.org")
"* TODO %?\n%U\n" :clock-in t :clock-resume t)))

I'm running Emacs 25.1.1 on Windows.


Re: [O] Bug: Capture template file source variant support in Customize [8.3.4 (8.3.4-47-gaf853d-elpa @ /home/phil/.emacs.d/elpa/org-20160502/)]

2016-05-10 Thread Phil Hudson
On Tue, 10 May 2016 at 10:21:12 pm BST, Nicolas Goaziou 
 wrote:

> Hello,
>
> Phil Hudson  writes:
>
>> Expected: When using the Customize interface to create/edit an Org
>> capture template, we expect to be able to specify a file to write the
>> captured item into using (according to the documentation) any one of:
>>   * a literal filename
>>   * a function
>>   * a variable
>>   * a form
>> But the Customize UI supports only the first of these. The attached
>> patch adds Customize support for the other three variants, in the proper
>> order (increasing generality/decreasing specificity).
>>
>> Note that using Lisp to specify a capture template's target file using a
>> function, variable or sexp *does* work fine and as documented, except
>> that thereafter Customize fails to present the resulting variable
>> correctly; it reverts to showing the alist as one Lisp form. This patch
>> simply "catches up" the Customize UI with what Org can do and is
>> documented as doing.
>
> Sounds good. 
>
> However, wouldn't it make sense to also add these types to other file
> related target locations, e.g., "File & Headline", "File & Outline
> path"... ?

Thanks for the perceptive feedback. I hadn't even thought about it. Your
suggestion definitely sounds like the right thing to do. I'll be back
with a fuller patch, properly gitted and committed.

-- 
Phil Hudson   http://hudson-it.ddns.net
@UWascalWabbit PGP/GnuPG ID: 0x887DCA63



Re: [O] Bug: Capture template file source variant support in Customize [8.3.4 (8.3.4-47-gaf853d-elpa @ /home/phil/.emacs.d/elpa/org-20160502/)]

2016-05-10 Thread Nicolas Goaziou
Hello,

Phil Hudson  writes:

> Expected: When using the Customize interface to create/edit an Org
> capture template, we expect to be able to specify a file to write the
> captured item into using (according to the documentation) any one of:
>   * a literal filename
>   * a function
>   * a variable
>   * a form
> But the Customize UI supports only the first of these. The attached
> patch adds Customize support for the other three variants, in the proper
> order (increasing generality/decreasing specificity).
>
> Note that using Lisp to specify a capture template's target file using a
> function, variable or sexp *does* work fine and as documented, except
> that thereafter Customize fails to present the resulting variable
> correctly; it reverts to showing the alist as one Lisp form. This patch
> simply "catches up" the Customize UI with what Org can do and is
> documented as doing.

Sounds good. 

However, wouldn't it make sense to also add these types to other file
related target locations, e.g., "File & Headline", "File & Outline
path"... ?

Also, could you provide a patch using `git format-patch'?

Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Advanced capture template using Elisp functions: void-function/void-variable

2016-05-09 Thread Karl Voit
Hi!

Phil obviously did not want to embarrass me in public so he wrote me
an email which pointed me to my simple error: a typo "promt" instead
of "prompt" in the function name.

* Karl Voit  wrote:
>
> However, when I am using this capture definition, I end up with
> lots of "void-function" and "void-variable". Probably I have an escaping 
> issue.
>
> ,
>| (defun my-capture-prompt (prompt variable)
>|   "PROMPT for string, save it to VARIABLE and insert it."
>|   (make-local-variable variable)
>|   (set variable (read-string (concat prompt ": ") nil 
>my-capture-promt-history)))

At this point, I know how to type "prompt" in a proper way.

>| (defun my-capture-insert (variable)
>|   "Insert content of VARIABLE."
>|   (symbol-value variable))

Phil remarks that this is equivalent to eval() which I can't confirm
with my limited Elisp knowledge.

> Then I created a variable holding the complex template string:
>
> ,
>|   (setq my-capture-template-r6story "** TODO [[IPD:%(my-capture-promt \"IPD 
>number\" 'my-ipd)]] %(my-capture-promt \"Story title\" 'my-title) [1/11]   
>  :US_%(my-capture-promt \"Short title\" 'my-short-title):
[...]

prompt, prompt, prompt, prompt, prompt, prompt.

Sorry for the fuzz. However, you might be pointed to a clever way
for capture templates.

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
   > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github




[O] Advanced capture template using Elisp functions: void-function/void-variable

2016-05-09 Thread Karl Voit
Hi!

I came across this great blog post[1] that introduced me to the idea
of including Elisp functions to capture templates. With this trick,
it is possible to re-use some user-entry.
 
So far so good. However, when I am using this capture definition, I end up with
lots of "void-function" and "void-variable". Probably I have an escaping issue.

Do you have an idea how to fix my error(s)?


The whole story:  (sorry for some long lines)

I took David's code and renamed according my name schema:

,
| (defvar my-capture-promt-history nil
|   "History of prompt answers for org capture.")
| (defun my-capture-prompt (prompt variable)
|   "PROMPT for string, save it to VARIABLE and insert it."
|   (make-local-variable variable)
|   (set variable (read-string (concat prompt ": ") nil 
my-capture-promt-history)))
| (defun my-capture-insert (variable)
|   "Insert content of VARIABLE."
|   (symbol-value variable))
| (defun my-capture-optional (what text)
|   "Ask user to include WHAT.  If user agrees return TEXT."
|   (when (y-or-n-p (concat "Include " what "?"))
| text))
`

Then I created a variable holding the complex template string:

,
|   (setq my-capture-template-r6story "** TODO [[IPD:%(my-capture-promt \"IPD 
number\" 'my-ipd)]] %(my-capture-promt \"Story title\" 'my-title) [1/11]
 :US_%(my-capture-promt \"Short title\" 'my-short-title):
| :PROPERTIES:
| :CREATED:  [%(format-time-string \"%Y-%m-%d %a %H:%M\")]
| :ID: %(format-time-string \"%Y-%m-%d\")-Story-%(my-capture-insert 
'my-short-title)
| :END:
|
| | *IPD* | *Confluence* | *Champ* |
| | [[IPD:%(my-capture-insert 'my-ipd)][%(my-capture-insert 'my-ipd)]]  | 
%(my-capture-insert 'my-title) | |
|
| [...]
| ")
|
`

,[ my capture template definition ]
| (setq org-capture-templates
|   `(
|  ("u" "Userstory" entry (file+headline "~/stories.org" "New Stories")
|  ,my-capture-template-r6story :empty-lines 1)
| ))
`

So far so good. However, when I am using this capture definition, I end up with
lots of "void-function" and "void-variable":

,
| * TODO [[IPD:%![Error: (void-function my-capture-promt)]]] %![Error: 
(void-function my-capture-promt)] [1/11] :US_%![Error: 
(void-function my-capture-promt)]:
| :PROPERTIES:
| :CREATED:  [2016-05-09 [[file:c:/Users/karl/org/project.org::*2del][2del]] 
15:27]
| :ID: 2016-05-09-Story-%![Error: (void-variable my-short-title)]
| :END:
|
| | *IPD* | *Confluence* | *Champ* |
| | [[IPD:%![Error: (void-variable my-ipd)]][%![Error: (void-variable 
my-ipd)]]]  | %![Error: (void-variable my-title)] | |
|
| [...]
`

Note that "2del" is the current super-heading, 15:27 is current time, and
c:/Users/karl/org/project.org is the current Org-mode file. None of them are
supposed to be in my Org-mode file. They are interpreted by org-capture instead
of the Elisp function. I tend to think that this is a hint that I've got an
issue with wrong escaping.


Bonus for everybody who read so far and is still interested to read more:

So far, I was using yasnippet but unfortunately, I've got severe issues with
yasnippet and Emacs endless-loops/crashes. Since I was not able to fix
yasnippet even with posting in Newsgroups, I want to replace my complex
yasnippet templates with capture+Elisp. Isn't it awesome funny, how 
yasnippet is printed four times in a row according to my alignment on pure 
coincidence? ;-)

[1] http://storax.github.io/blog/2016/05/02/org-capture-tricks/

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
   > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github




[O] Bug: Capture template file source variant support in Customize [8.3.4 (8.3.4-47-gaf853d-elpa @ /home/phil/.emacs.d/elpa/org-20160502/)]

2016-05-07 Thread Phil Hudson


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.


Expected: When using the Customize interface to create/edit an Org
capture template, we expect to be able to specify a file to write the
captured item into using (according to the documentation) any one of:
  * a literal filename
  * a function
  * a variable
  * a form
But the Customize UI supports only the first of these. The attached
patch adds Customize support for the other three variants, in the proper
order (increasing generality/decreasing specificity).

Note that using Lisp to specify a capture template's target file using a
function, variable or sexp *does* work fine and as documented, except
that thereafter Customize fails to present the resulting variable
correctly; it reverts to showing the alist as one Lisp form. This patch
simply "catches up" the Customize UI with what Org can do and is
documented as doing.

As a workaround, I fell back on using the alternative 'function' target
specification method. That is, it's an alternative to 'file'; not to be
confused with the 'function' sub-method of 'file'. It took some rooting
around in source code for me to understand exactly what this function
has to do. It has to visit a file and optionally move point. Overkill
for my initial requirement, which was simply to produce a date-including
filename, but I made it work*, rather than lose the Customize UI. Anyway,
the documentation was too vague, and this patch also fixes that.

I have signed the FSF papers.  

* pending your acceptance of this patch, at which point I can revert to
  the simpler filename-producing function I wanted to use initially.
  
-- 
Phil Hudson   http://hudson-it.ddns.net
@UWascalWabbit PGP/GnuPG ID: 0x887DCA63


--- org-20160502/org-capture.el 2016-05-07 10:18:26.0 +0100
+++ org.patched/org-capture.el  2016-05-04 11:54:23.0 +0100
@@ -157,8 +157,8 @@
 File to the entry that is currently being clocked
 
  (function function-finding-location)
-Most general way, write your own function to find both
-file and location
+Most general way: write your own function which both visits the
+file and moves point to the right location.
 
 template The template for creating the capture item.  If you leave this
  empty, an appropriate default template will be used.  See below
@@ -299,7 +299,11 @@
  (choice :tag "Target location"
  (list :tag "File"
(const :format "" file)
-   (file :tag "  File"))
+  (choice :tag "  Filename"
+(file :tag "  Literal")
+(function :tag "  Function")
+(variable :tag "  Variable")
+(sexp :tag "  Form")))
  (list :tag "ID"
(const :format "" id)
(string :tag "  ID"))



Re: [O] [BUG] Capture template table line specification

2016-04-14 Thread Christian Moe

Nicolas Goaziou writes:

> Fixed. Thank you.

Confirmed! Thank you.

Yours,
Christian




Re: [O] [BUG] Capture template table line specification

2016-04-13 Thread Nicolas Goaziou
Hello,

Christian Moe  writes:

> Yes, apologies. Here's a fairly minimal example. In making it, I
> discovered that capture works until I add the table-formula line. With
> the formula, it fails as described below.
>
> Yours,
> Christian
>
> #+title: Capture test
>
> #+begin_src emacs-lisp
> (setq org-capture-templates
>'(("x" "exercise" table-line 
> (file+headline "~/org/capture-test.org" "Exercise")
> "| %u | %^{Laps} | %^{Time} | 0 |" 
> :table-line-pos "II-1")))
> #+end_src
>
>
> * Exercise
>
> | Date | Laps | Time | Laptime |
> |--+--+--+-|
> | [2016-04-09 Sat] |2 |   67 |33.5 |
> | [2016-04-11 Mon] |1 |   32 |  32 |
> | [2016-04-13 Wed] |2 |   65 |32.5 |
> |--+--+--+-|
> |  |  |  | 0/0 |
> #+TBLFM: $4=$3/$2

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] [BUG] Capture template table line specification

2016-04-13 Thread Christian Moe

Hello,

Yes, apologies. Here's a fairly minimal example. In making it, I
discovered that capture works until I add the table-formula line. With
the formula, it fails as described below.

Yours,
Christian

#+title: Capture test


#+begin_src emacs-lisp
(setq org-capture-templates
   '(("x" "exercise" table-line 
	  (file+headline "~/org/capture-test.org" "Exercise")
	  "| %u | %^{Laps} | %^{Time} | 0 |" 
	  :table-line-pos "II-1")))
#+end_src


* Exercise

| Date | Laps | Time | Laptime |
|--+--+--+-|
| [2016-04-09 Sat] |2 |   67 |33.5 |
| [2016-04-11 Mon] |1 |   32 |  32 |
| [2016-04-13 Wed] |2 |   65 |32.5 |
|--+--+--+-|
|  |  |  | 0/0 |
#+TBLFM: $4=$3/$2


Nicolas Goaziou writes:

> Hello,
>
> Christian Moe  writes:
>
>> Another odd problems after updating to Emacs 24.5 and Org
>> 8.3.4:
>>
>> I have a capture template that puts the captured info into a table line
>> before the second horizontal line of the table.
>>
>> Capture fails with this message:
>>
>> Capture template `x': Invalid table line specification "II-1"
>>
>> Far as I can tell from the manual, the specification is exactly right,
>> and it has always worked before.
>
> Could you share the template with an Org document to test it on?
>
> Thank you.
>
> Regards,



Re: [O] [BUG] Capture template table line specification

2016-04-13 Thread Nicolas Goaziou
Hello,

Christian Moe  writes:

> Another odd problems after updating to Emacs 24.5 and Org
> 8.3.4:
>
> I have a capture template that puts the captured info into a table line
> before the second horizontal line of the table.
>
> Capture fails with this message:
>
> Capture template `x': Invalid table line specification "II-1"
>
> Far as I can tell from the manual, the specification is exactly right,
> and it has always worked before.

Could you share the template with an Org document to test it on?

Thank you.

Regards,

-- 
Nicolas Goaziou



[O] [BUG] Capture template table line specification

2016-04-10 Thread Christian Moe

Hi again,

Another odd problems after updating to Emacs 24.5 and Org
8.3.4:

I have a capture template that puts the captured info into a table line
before the second horizontal line of the table.

Capture fails with this message:

Capture template `x': Invalid table line specification "II-1"

Far as I can tell from the manual, the specification is exactly right,
and it has always worked before.

Yours,
Christian



[O] org-capture-template: file+datetree+prompt not using prompted date in template

2015-11-04 Thread Shankar Rao
For the following org capture template:

(setq org-capture-templates
  '(("d" "Date Tree Test" plain
(file+datetree+prompt "~/org/testdt.org")
"This date should be the date i picked: %<%y%m%d>")))

Though this is filed under the correct date in the datetree, no matter what
date I select in the prompt, the date displayed in the template is the
current date. Is this a bug or a feature?

How do I use the prompt-selected date in the template?

Shankar


Re: [O] org-capture-template: file+datetree+prompt not using prompted date in template

2015-11-04 Thread Shankar Rao
Earlier in org-capture-fill-template, there is the following:

(let* (...
   (ct (org-capture-get :default-time))
   ...

The property :default-time defaults to the current time and is overwritten
by file+datetree+prompt,

If ct was passed as a 2nd argument to format-time-string in your code
snippet:

  ;; The current time
  (goto-char (point-min))
  (while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
(replace-match (format-time-string (match-string 1) ct) t t))

this should provide the behavior I'm looking for with file+datetree+prompt,
but still use the current time for other capture types. Will this solution
break anything?

Shankar

On Wed, Nov 4, 2015 at 2:15 PM, Nick Dokos  wrote:

> Shankar Rao  writes:
>
> > For the following org capture template:
> >
> > (setq org-capture-templates
> >   '(("d" "Date Tree Test" plain
> > (file+datetree+prompt "~/org/testdt.org")
> > "This date should be the date i picked: %<%y%m%d>")))
> >
> > Though this is filed under the correct date in the datetree, no matter
> what date I select in the prompt,
> > the date displayed in the template is the current date. Is this a bug or
> a feature?
> >
>
> It's a feature I guess - org-capture.el says:
>
>   ;; The current time
>   (goto-char (point-min))
>   (while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
> (replace-match (format-time-string (match-string 1)) t t))
>
> and there is no provision for another time to be given here. I don't
> think there is any provision in the template for a time other than the
> current time: at least I can't see a %-escape that takes a different
> time.
>
> --
> Nick
>
>
>


Re: [O] org-capture-template: file+datetree+prompt not using prompted date in template

2015-11-04 Thread Nick Dokos
Shankar Rao  writes:

> For the following org capture template:
>
> (setq org-capture-templates
>       '(("d" "Date Tree Test" plain
> (file+datetree+prompt "~/org/testdt.org")
> "This date should be the date i picked: %<%y%m%d>")))
>
> Though this is filed under the correct date in the datetree, no matter what 
> date I select in the prompt,
> the date displayed in the template is the current date. Is this a bug or a 
> feature?
>

It's a feature I guess - org-capture.el says:

  ;; The current time
  (goto-char (point-min))
  (while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
(replace-match (format-time-string (match-string 1)) t t))

and there is no provision for another time to be given here. I don't
think there is any provision in the template for a time other than the
current time: at least I can't see a %-escape that takes a different
time.

--
Nick




Re: [O] org-capture-template: file+datetree+prompt not using prompted date in template

2015-11-04 Thread Shankar Rao
Looks like a similar issue was addressed earlier here:

http://sachachua.com/blog/2015/02/org-mode-reusing-date-file-datetree-prompt/

Shankar

On Wed, Nov 4, 2015 at 2:54 PM, Shankar Rao  wrote:

> Earlier in org-capture-fill-template, there is the following:
>
> (let* (...
>(ct (org-capture-get :default-time))
>...
>
> The property :default-time defaults to the current time and is overwritten
> by file+datetree+prompt,
>
> If ct was passed as a 2nd argument to format-time-string in your code
> snippet:
>
>   ;; The current time
>   (goto-char (point-min))
>   (while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
> (replace-match (format-time-string (match-string 1) ct) t t))
>
> this should provide the behavior I'm looking for with
> file+datetree+prompt, but still use the current time for other capture
> types. Will this solution break anything?
>
> Shankar
>
> On Wed, Nov 4, 2015 at 2:15 PM, Nick Dokos  wrote:
>
>> Shankar Rao  writes:
>>
>> > For the following org capture template:
>> >
>> > (setq org-capture-templates
>> >   '(("d" "Date Tree Test" plain
>> > (file+datetree+prompt "~/org/testdt.org")
>> > "This date should be the date i picked: %<%y%m%d>")))
>> >
>> > Though this is filed under the correct date in the datetree, no matter
>> what date I select in the prompt,
>> > the date displayed in the template is the current date. Is this a bug
>> or a feature?
>> >
>>
>> It's a feature I guess - org-capture.el says:
>>
>>   ;; The current time
>>   (goto-char (point-min))
>>   (while (re-search-forward "%<\\([^>\n]+\\)>" nil t)
>> (replace-match (format-time-string (match-string 1)) t t))
>>
>> and there is no provision for another time to be given here. I don't
>> think there is any provision in the template for a time other than the
>> current time: at least I can't see a %-escape that takes a different
>> time.
>>
>> --
>> Nick
>>
>>
>>
>


[O] orgmode capture template how to add entry under org header

2014-08-09 Thread jenia.ivlev

Hello:

I added a custom template for the capture-mode:


The problem is that the default Tasks template is not there anymore.
So I tried to add this:

(t Tasks entry
(file ~/Documents/org/notes.org))

Now, when I press `M-x org-capture`, the Tasks option appears in the
template options list.

The default behaviour for the default Tasks template is to add the new
entries under the * Tasks headline.

How do I achieve that same feature?

How to add all new entries under a specific header in the .org file?

Thanks in advance for your kind help and time.

Jenia

P.S.

This is how I add the custom template to the org-capture templates list:

(setq org-capture-templates '(
(c Class entry
   (file ~/Documents/org/class.txt)
   #'org-capture-class)
(n Exercise session entry
(file ~/Documents/org/notes.org))
(t Tasks entry
(file ~/Documents/org/notes.org))
))




Re: [O] Org-Capture template overwriting headlines!?

2013-11-06 Thread Bastien
Hi Juan,

Juan Alberto Sanchez goze...@gmail.com writes:

 I recently wrote a few org-capture template for myself and I just
 notice a strange issue with the captures. when I record a capturer if
 there was already something of the same level where the file+headline
 is inserting it overwrites the previews entry of the same level. For
 example, I take a capture by hitting C-c r t that captures is
 inserted as a ** TODO under a * Tasks if I take another capture the
 next ** TODO will overwrite already existing **TODO with the text on
 the new capturer   rather then inserting it below the exiting ** TODO
 headline. any idea what is going on? Below is a pestbin of my org
 config

This looks bad, and I can't reproduce this.

What version of Emacs/Org are you using?  Can you provide a minimal
example, together with your setup?

Thanks,

-- 
 Bastien



[O] Org-Capture template overwriting headlines!?

2013-10-01 Thread Juan Alberto Sanchez
Hello everyone,

I recently wrote a few org-capture template for myself and I just notice a
strange issue with the captures. when I record a capturer if there was
already something of the same level where the file+headline is inserting it
overwrites the previews entry of the same level. For example, I take a
capture by hitting C-c r t that captures is inserted as a ** TODO under a *
Tasks if I take another capture the next ** TODO will overwrite already
existing **TODO with the text on the new capturer   rather then inserting
it below the exiting ** TODO headline. any idea what is going on? Below is
a pestbin of my org config

http://pastebin.com/vufwmU2m

Thank you for the help before hand

-- 
**


Re: [O] Conditional capture template headline based on tag?

2012-10-02 Thread Bastien
Hi John,

John Hendy jw.he...@gmail.com writes:

 As in the expansion elements or defining a custom function for the
 =target= element?

I'm thinking of this part of org-capture-templates's docstring:

  (function function-finding-location)
 Most general way, write your own function to find both
 file and location

HTH,

-- 
 Bastien



Re: [O] Conditional capture template headline based on tag?

2012-10-01 Thread John Hendy
On Fri, Sep 14, 2012 at 1:01 AM, Bastien b...@altern.org wrote:
 Hi John,

 John Hendy jw.he...@gmail.com writes:

 Just wondering if a capture template could be setup to file into the
 Tasks headline (sub-headline) of the matching top level headline
 with that tag or something similar?

 You could use a function in the capture template for this.

As in the expansion elements or defining a custom function for the
=target= element?

Thanks for the suggestion,
John


 See the info node Template elements.

 --
  Bastien



Re: [O] org-capture-template suspicious behaviour of expansion elements

2012-09-22 Thread Bastien
Hi Myles,

Myles English mylesengl...@gmail.com writes:

 Using the git repo, I am fairly sure that one of my capture templates
 stopped working sometime in the last few weeks, no so much as to warrant
 a bug report but thought I would point it out as it may be unintended or
 part of a bigger picture:

 #+begin_src elisp
 (setq org-capture-templates (quote (
   (t   - test entry
   (file test.org) * %? \n%^t%U
 #+end_src elisp
   \n%^t %U
^
 that space is important now, otherwise the %^t is not
expanded.

This is now fixed, thanks.

-- 
 Bastien



Re: [O] Conditional capture template headline based on tag?

2012-09-14 Thread Bastien
Hi John,

John Hendy jw.he...@gmail.com writes:

 Just wondering if a capture template could be setup to file into the
 Tasks headline (sub-headline) of the matching top level headline
 with that tag or something similar?

You could use a function in the capture template for this.

See the info node Template elements.

-- 
 Bastien



[O] org-capture-template suspicious behaviour of expansion elements

2012-09-11 Thread Myles English

Hi,

Using the git repo, I am fairly sure that one of my capture templates
stopped working sometime in the last few weeks, no so much as to warrant
a bug report but thought I would point it out as it may be unintended or
part of a bigger picture:

#+begin_src elisp
(setq org-capture-templates (quote (
  (t   - test entry
  (file test.org) * %? \n%^t%U
#+end_src elisp
  \n%^t %U
   ^
that space is important now, otherwise the %^t is not
   expanded.

Myles



[O] Conditional capture template headline based on tag?

2012-08-29 Thread John Hendy
My main org file for work is something like so:

#+begin_src org
* Tasks
General tasks here

* Proj 1 :proj1:
** Tasks
** Notes

* Proj 2 :proj2:
** Tasks
** Notes

etc.
#+end_src

Just wondering if a capture template could be setup to file into the
Tasks headline (sub-headline) of the matching top level headline
with that tag or something similar?

I suppose I can refile and enter the headline location manually, but
that requires extra work. I thought if I was already entering a tag
for a capture item, perhaps there's some fu that could be used to send
it accordingly. If this isn't possible, what if I re-split my projects
into separate files with a #+filetag. Could it be used to send it to
the right file?

If there are those who do something like this in a different way, I'm
open to suggestions!


Thanks,
John



Re: [O] my capture template generates a literal %?

2012-08-10 Thread Bastien
Hi,

Nick Dokos nicholas.do...@hp.com writes:

 D'oh^2: everything else is interpreted, so why not %? ?

 The problem seems to be in org-capture-place-plain-text: the insertion
 of the text happens like this

 ,
 | ...
 | (setq beg (point))
 | (insert txt)
 | (org-capture-empty-lines-after 1)
 | (org-capture-position-for-last-stored beg)
 | (setq end (point))
 | (org-capture-mark-kill-region beg (1- end))
 | (org-capture-narrow beg (1- end))
 | (if (re-search-forward %\\? end t) (replace-match 
 `

 but it seesm that just before the re-search-forward, point is at
 end, not at beg, so the search is fruitless. We could search backwards
 to beg instead (but what is the semantics of multiple %? markers in the
 template?), or we could just (goto-char beg) before the search.

There was indeed a problem here, I just fixed it.

Thanks for the directions,

-- 
 Bastien



[O] my capture template generates a literal %?

2012-08-09 Thread G

Hi,

I am using Emacs 24.1 in Win7 (64bit) and Org 7.8.11.
I would like to have a capture template that just puts me at the end of 
my journal in plain text (although date tree) after a custom time stamp 
(e.g. 09:13). I tried the following
(p Plain Journal plain (file+datetree 
C:/Users/Geralb/Documents/privat/org/MyAgenda.org)

 %%H:%M\n\n%?
 :unnarrowed t :empty-lines 1)

But in this template a literal %? is written and point is thereafter.

I tried another template
(e Entry Journal entry (file+datetree 
C:/Users/Geralb/Documents/privat/org/MyAgenda.org)

 * Um %U von %a\n\n%?\n
 :empty-lines 1 :unnarrowed t)

And this seems to work, but it's not what I would like to have.

Did I write the template wrong?

Geralb



Re: [O] my capture template generates a literal %?

2012-08-09 Thread Nick Dokos
G gsq...@googlemail.com wrote:

 Hi,
 
 I am using Emacs 24.1 in Win7 (64bit) and Org 7.8.11.
 I would like to have a capture template that just puts me at the end
 of my journal in plain text (although date tree) after a custom time
 stamp (e.g. 09:13). I tried the following
 (p Plain Journal plain (file+datetree
 C:/Users/Geralb/Documents/privat/org/MyAgenda.org)
  %%H:%M\n\n%?
  :unnarrowed t :empty-lines 1)
 
 But in this template a literal %? is written and point is thereafter.
 
 I tried another template
 (e Entry Journal entry (file+datetree
 C:/Users/Geralb/Documents/privat/org/MyAgenda.org)
  * Um %U von %a\n\n%?\n
  :empty-lines 1 :unnarrowed t)
 
 And this seems to work, but it's not what I would like to have.
 
 Did I write the template wrong?
 

I don't think so. I can reproduce it and I think it is a bug: %? does
not seem to be interpreted in the first case, it is interpreted in the
second case, but I don't know what causes the difference.

Nick



Re: [O] my capture template generates a literal %?

2012-08-09 Thread Nick Dokos
Nick Dokos nicholas.do...@hp.com wrote:

 G gsq...@googlemail.com wrote:
 
  Hi,
  
  I am using Emacs 24.1 in Win7 (64bit) and Org 7.8.11.
  I would like to have a capture template that just puts me at the end
  of my journal in plain text (although date tree) after a custom time
  stamp (e.g. 09:13). I tried the following
  (p Plain Journal plain (file+datetree
  C:/Users/Geralb/Documents/privat/org/MyAgenda.org)
   %%H:%M\n\n%?
   :unnarrowed t :empty-lines 1)
  
  But in this template a literal %? is written and point is thereafter.
  
  I tried another template
  (e Entry Journal entry (file+datetree
  C:/Users/Geralb/Documents/privat/org/MyAgenda.org)
   * Um %U von %a\n\n%?\n
   :empty-lines 1 :unnarrowed t)
  
  And this seems to work, but it's not what I would like to have.
  
  Did I write the template wrong?
  
 
 I don't think so. I can reproduce it and I think it is a bug: %? does
 not seem to be interpreted in the first case, it is interpreted in the
 second case, but I don't know what causes the difference.
 

D'oh: plain type just inserts things literally. Need more coffee.

Nick




Re: [O] my capture template generates a literal %?

2012-08-09 Thread Nick Dokos
Nick Dokos nicholas.do...@hp.com wrote:

 Nick Dokos nicholas.do...@hp.com wrote:
 
  G gsq...@googlemail.com wrote:
  
   Hi,
   
   I am using Emacs 24.1 in Win7 (64bit) and Org 7.8.11.
   I would like to have a capture template that just puts me at the end
   of my journal in plain text (although date tree) after a custom time
   stamp (e.g. 09:13). I tried the following
   (p Plain Journal plain (file+datetree
   C:/Users/Geralb/Documents/privat/org/MyAgenda.org)
%%H:%M\n\n%?
:unnarrowed t :empty-lines 1)
   
   But in this template a literal %? is written and point is thereafter.
   
   I tried another template
   (e Entry Journal entry (file+datetree
   C:/Users/Geralb/Documents/privat/org/MyAgenda.org)
* Um %U von %a\n\n%?\n
:empty-lines 1 :unnarrowed t)
   
   And this seems to work, but it's not what I would like to have.
   
   Did I write the template wrong?
   
  
  I don't think so. I can reproduce it and I think it is a bug: %? does
  not seem to be interpreted in the first case, it is interpreted in the
  second case, but I don't know what causes the difference.
  
 
 D'oh: plain type just inserts things literally. Need more coffee.
 

D'oh^2: everything else is interpreted, so why not %? ?

The problem seems to be in org-capture-place-plain-text: the insertion
of the text happens like this

,
| ...
| (setq beg (point))
| (insert txt)
| (org-capture-empty-lines-after 1)
| (org-capture-position-for-last-stored beg)
| (setq end (point))
| (org-capture-mark-kill-region beg (1- end))
| (org-capture-narrow beg (1- end))
| (if (re-search-forward %\\? end t) (replace-match 
`

but it seesm that just before the re-search-forward, point is at
end, not at beg, so the search is fruitless. We could search backwards
to beg instead (but what is the semantics of multiple %? markers in the
template?), or we could just (goto-char beg) before the search.

Nick





[O] Invalid capture template with pull of Org 7.8.03?

2012-01-12 Thread Damon Haley

Hi I was wondering if someone could point me in the right direction
because one of my Org capture templates, that I use to feed questions to
myself (for later use with org-drill) just broke with the most recent
bzr pull of emacs.

Now, when I try to use the capture template, I only get this header in
my target org file.

** Invalid capture template

I'm on the 24.0.92.1 version of emacs which ships with Org 7.8.03.

Here's the template, which I stole from:
http://orgmode.org/worg/org-contrib/org-drill.html

(add-to-list 'org-capture-templates
 '
 (W
  Capture web snippet
  entry
  (file+headline ~/git/org/learn-emacs.org Emacs mastery)
  ,(concat * Fact: '%:description':
   (format %s org-drill-question-tag)
   :\n:PROPERTIES:\n:DATE_ADDED: %u\n:SOURCE_URL: 
%c\n:END:\n\n%i\n%?\n)

  :empty-lines 1
  :immediate-finish t))

Is there any obvious reason this template would break?

I know I could read the capture documentation further but I don't have a
few hours to spend on this right now (plus I'm extremely beginner with
lisp). But I'm pretty sure it just broke with a recent pull of emacs
without me changing any other settings.

Thanks for any help,

Damon

p.s. Here's the complete config that I used to try to debug the problem.

(require 'org-install)
(add-to-list 'auto-mode-alist '(\\.\\(org\\|org_archive\\|txt\\)$ . 
org-mode))

(global-set-key \C-ca 'org-agenda)
(global-set-key \C-cb 'org-iswitchb)
(global-set-key (kbd C-c r) 'org-capture)

;; Capture templates for: TODO tasks, Notes, appointments, phone calls, 
and org-protocol

  (setq org-capture-templates
  (quote ((t todo entry (file ~/git/org/refile.org)
   * TODO %?\n%U\n%a\n  %i :clock-in t :clock-resume t)
  (n note entry (file ~/git/org/refile.org)
   * %? :NOTE:\n%U\n%a\n  %i :clock-in t :clock-resume t)
  (j Journal entry (file+datetree ~/git/org/diary.org)
   * %?\n%U\n  %i :clock-in t :clock-resume t)
  (w org-protocol entry (file ~/git/org/refile.org)
   * TODO Review %c\n%U\n  %i :immediate-finish t)
  (p Phone call entry (file ~/git/org/refile.org)
   * PHONE %? :PHONE:\n%U :clock-in t :clock-resume t)
  (h Habit entry (file ~/git/org/refile.org)
   * NEXT %?\n%U\n%a\nSCHEDULED: %t 
.+1d/3d\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n  
%i


(add-to-list 'org-capture-templates
   '
   (W
Capture web snippet
entry
(file+headline ~/git/org/learn-emacs.org Emacs mastery)
,(concat * Fact: '%:description':
 (format %s org-drill-question-tag)
 :\n:PROPERTIES:\n:DATE_ADDED: %u\n:SOURCE_URL: 
%c\n:END:\n\n%i\n%?\n)

:empty-lines 1
:immediate-finish t))







Re: [O] Invalid capture template with pull of Org 7.8.03?

2012-01-12 Thread Nick Dokos
Damon Haley n...@vinylisland.org wrote:

 Hi I was wondering if someone could point me in the right direction
 because one of my Org capture templates, that I use to feed questions to
 myself (for later use with org-drill) just broke with the most recent
 bzr pull of emacs.
 

Probably not - see below.

 Now, when I try to use the capture template, I only get this header in
 my target org file.
 
 ** Invalid capture template
 
 I'm on the 24.0.92.1 version of emacs which ships with Org 7.8.03.
 
 Here's the template, which I stole from:
 http://orgmode.org/worg/org-contrib/org-drill.html
 
 (add-to-list 'org-capture-templates
  vvv
  ' THIS SHOULD BE A BACKQUOTE
  ^^^   
  (W
   Capture web snippet
   entry
   (file+headline ~/git/org/learn-emacs.org Emacs mastery)
   ,(concat * Fact: '%:description':
(format %s org-drill-question-tag)
:\n:PROPERTIES:\n:DATE_ADDED: %u\n:SOURCE_URL:
 %c\n:END:\n\n%i\n%?\n)
   :empty-lines 1
   :immediate-finish t))
 
 Is there any obvious reason this template would break?

You are quoting the entry but including a , before the concat. That
indicates that instead of the quote ', you need to use a backquote ` to
allow the comma to evaluate the (concat ...)  expression at definition
time.

I checked the webpage you refer to and there is a backquote there, so I
can only surmise that you changed it by mistake recently.

Nick



Re: [O] Invalid capture template with pull of Org 7.8.03?

2012-01-12 Thread Damon Haley
Nick Dokos nicholas.do...@hp.com writes:

 You are quoting the entry but including a , before the concat. That
 indicates that instead of the quote ', you need to use a backquote ` to
 allow the comma to evaluate the (concat ...)  expression at definition
 time.

 I checked the webpage you refer to and there is a backquote there, so I
 can only surmise that you changed it by mistake recently.


Thanks Nick.

You're probably right that I changed it some time ago and thought it was
working, but it wasn't.

Glad to have it working again.

Damon

-- 
   ___ 
  /    -[]--. \ \/ I /\/ Y |_ I S |_ A |\| |}  @  ssl-mail.com   
 / ,-' `-.   \ \ Send me long text - http://www.asciiribbon.org  
/ (   o   )  _) \ http://email.is-not-s.ms 
   /   `-._,-'_ /_/-.\ \/ I /\/ Y |_ I S |_  @  jabber.sdf.org  Jabber 
me
  /  __ _  \ \/ I /\/ Y |_ I S |_  .  netlsd dot com  Check 
out my PGP key 
 /_\
 -=-=-



Re: [O] org-capture-template: How to correctly capture email addresses?

2011-11-09 Thread Christian Moe

Hi,

If org-contacts-template-email doesn't find an address, it doesn't 
insert a simple text prompt, it inserts a property prompt, which sets 
the property. A property prompt does not need to be positioned in an 
explicit property drawer in the template -- in fact, it looks like 
that will not work.


Removing the EMAIL property and moving the 
%(org-contacts-template-email) field out of the property drawer works:


(setq org-capture-templates
 '((t TODO in ~/org/agenda.org - Tasks entry (file+headline 
~/org/agenda.org Tasks)

* TODO %?\nSCHEDULED: %^t\n%U %a)
   (c Contact in ~/org/contacts.org - Contact entry 
(file+headline ~/org/contacts.org Contact)
* %?%(org-contacts-template-name) %^g 
%(org-contacts-template-email)

:PROPERTIES:
:URL:
:WORK:
:HOME:
:MOBILE:
:LOCATION:
:BIRTHDAY:
:NOTE:
:END:)))

You still get EMAIL at the end of the property drawer, but the order 
is arbitrary anyway. You could replace the whole properties drawer 
with property prompts:



(setq org-capture-templates
 '((t TODO in ~/org/agenda.org - Tasks entry (file+headline 
~/org/agenda.org Tasks)

* TODO %?\nSCHEDULED: %^t\n%U %a)
   (c Contact in ~/org/contacts.org - Contact entry 
(file+headline ~/org/contacts.org Contact)

* %?%(org-contacts-template-name) %^g
%(org-contacts-template-email)
%^{URL}p %^{WORK}p %^{HOME}p %^{MOBILE}p
%^{LOCATION}p %^{BIRTHDAY}p %^{NOTE}p)))

...but then you'd be prompted for everything, each time; you may not 
want that.



Yours,
Christian



Re: [O] org-capture-template: How to correctly capture email addresses?

2011-11-08 Thread Marius Hofert
see here: 
http://stackoverflow.com/questions/8037953/org-mode-how-to-correctly-capture-email-addresses


On 2011-11-06, at 11:49 , Marius Hofert wrote:

 Hi,
 
 I would like to capture contacts (name, email,..) with org-mode and thus 
 setup the following in .emacs:
 
 (setq org-capture-templates
  '((t TODO in ~/org/agenda.org - Tasks entry (file+headline 
 ~/org/agenda.org Tasks)
 * TODO %?\nSCHEDULED: %^t\n%U %a)
(c Contact in ~/org/contacts.org - Contact entry (file+headline 
 ~/org/contacts.org Contact)
 * %?%(org-contacts-template-name) %^g
 :PROPERTIES:
 :EMAIL: %(org-contacts-template-email)
 :URL:
 :WORK:
 :HOME:
 :MOBILE:
 :LOCATION:
 :BIRTHDAY: 
 :NOTE:
 :END:)))
 
 I can easily capture contacts with C-c c c, it prompts for the name, a tag, 
 and the email address. However, instead of an output like 
 
 * My contact :my.tag:
  :PROPERTIES:
  :EMAIL: my.cont...@my.mail.com
  :URL:
  :WORK:
  :HOME:
  :MOBILE:
  :LOCATION:
  :BIRTHDAY: 
  :NOTE:
  :END:
 
 I obtain:
 
 * My contact :my.tag:
  :PROPERTIES:
  :EMAIL:
  :URL:
  :WORK:
  :HOME:
  :MOBILE:
  :LOCATION:
  :BIRTHDAY: 
  :NOTE:
  :EMAIL: my.cont...@my.mail.com
  :END:
 
 So the problem is that the first :EMAIL: is ignored and instead a second 
 :EMAIL: is inserted before :END:. How can I obtain the correct output (as 
 described above)?
 
 Cheers,
 
 Marius





Re: [O] org-capture-template: SCHEDULED: obsolete?

2011-11-06 Thread Jan Böcker
On 11/05/2011 11:35 PM, Marius Hofert wrote:

 Apparently, the string SCHEDULED: is not required for an entry to appear in 
 agenda view. 

Hi Marius,

the difference between date and SCHEDULED: date is that date will
cause the entry to appear in the agenda only on the given day, whereas
SCHEDULED: date will also cause the entry to be displayed on the
current day if it is scheduled in the past and has not been marked DONE yet.

To see what I mean, put the following entries into an agenda file:

* Test 1
  SCHEDULED: 2011-11-05 Sat

* DONE Test 2
  SCHEDULED: 2011-11-05 Sat

* Test 3
  2011-11-05 Sat

Because Test 1 it is not marked done, if you refresh your agenda view
today, you will see something like this:

 Sched. 2x:  Test 1

Test 2 does not show up because it is marked DONE and Test 3 does not
show up because it does not contain the SCHEDULED keyword.

(Note that Test 1 will only show up on the agenda view for today and the
day it was scheduled for when you look at the agenda view for a day in
the past or future, for example by using the weekly or monthly view or
going forward/backward with the f and b keys.

For more information, please refer to Section 8.3, Deadlines and
scheduling, in the Org manual.

Hope this helps,
  Jan



Re: [O] org-capture-template: SCHEDULED: obsolete?

2011-11-06 Thread Marius Hofert
Thanks a lot, Jan, that explained it very well.

Cheers,

Marius

On 2011-11-06, at 11:30 , Jan Böcker wrote:

 On 11/05/2011 11:35 PM, Marius Hofert wrote:
 
 Apparently, the string SCHEDULED: is not required for an entry to appear 
 in agenda view. 
 
 Hi Marius,
 
 the difference between date and SCHEDULED: date is that date will
 cause the entry to appear in the agenda only on the given day, whereas
 SCHEDULED: date will also cause the entry to be displayed on the
 current day if it is scheduled in the past and has not been marked DONE yet.
 
 To see what I mean, put the following entries into an agenda file:
 
 * Test 1
  SCHEDULED: 2011-11-05 Sat
 
 * DONE Test 2
  SCHEDULED: 2011-11-05 Sat
 
 * Test 3
  2011-11-05 Sat
 
 Because Test 1 it is not marked done, if you refresh your agenda view
 today, you will see something like this:
 
 Sched. 2x:  Test 1
 
 Test 2 does not show up because it is marked DONE and Test 3 does not
 show up because it does not contain the SCHEDULED keyword.
 
 (Note that Test 1 will only show up on the agenda view for today and the
 day it was scheduled for when you look at the agenda view for a day in
 the past or future, for example by using the weekly or monthly view or
 going forward/backward with the f and b keys.
 
 For more information, please refer to Section 8.3, Deadlines and
 scheduling, in the Org manual.
 
 Hope this helps,
  Jan




[O] org-capture-template: How to correctly capture email addresses?

2011-11-06 Thread Marius Hofert
Hi,

I would like to capture contacts (name, email,..) with org-mode and thus setup 
the following in .emacs:

(setq org-capture-templates
  '((t TODO in ~/org/agenda.org - Tasks entry (file+headline 
~/org/agenda.org Tasks)
 * TODO %?\nSCHEDULED: %^t\n%U %a)
(c Contact in ~/org/contacts.org - Contact entry (file+headline 
~/org/contacts.org Contact)
 * %?%(org-contacts-template-name) %^g
:PROPERTIES:
:EMAIL: %(org-contacts-template-email)
:URL:
:WORK:
:HOME:
:MOBILE:
:LOCATION:
:BIRTHDAY: 
:NOTE:
:END:)))

I can easily capture contacts with C-c c c, it prompts for the name, a tag, and 
the email address. However, instead of an output like 

* My contact :my.tag:
  :PROPERTIES:
  :EMAIL: my.cont...@my.mail.com
  :URL:
  :WORK:
  :HOME:
  :MOBILE:
  :LOCATION:
  :BIRTHDAY: 
  :NOTE:
  :END:

I obtain:

* My contact :my.tag:
  :PROPERTIES:
  :EMAIL:
  :URL:
  :WORK:
  :HOME:
  :MOBILE:
  :LOCATION:
  :BIRTHDAY: 
  :NOTE:
  :EMAIL: my.cont...@my.mail.com
  :END:

So the problem is that the first :EMAIL: is ignored and instead a second 
:EMAIL: is inserted before :END:. How can I obtain the correct output (as 
described above)?

Cheers,

Marius


[O] org-capture-template: SCHEDULED: obsolete?

2011-11-05 Thread Marius Hofert
Hi

I set up org-capture-templates like this:

(setq org-capture-templates
  '((t TODO in ~/org/agenda.org - Tasks entry (file+headline  
Tasks)
 * TODO %?\n%^t\n%a)))

If I fire up C-c a a in ~/org/agenda.org, I'll see the entries created via C-c 
c. They are displayed in the foreground color. I am wondering if I should 
adjust the above template to insert the date as SCHEDULED: date instead of 
just date? Apparently, the string SCHEDULED: is not required for an entry 
to appear in agenda view. However, a difference I saw was that SCHEDULED: 
date entries appeard in a different color ( a light green on my black 
background). 
An advantage of using the shorter version is, that the string Scheduled: does 
not appear in agenda view which creates more space for the Todo's heading.

Cheers,

Marius


Re: [O] org-capture template property completion

2011-10-31 Thread dlc
While prompting the user for property MyProtperty, Is there a way to  
get completion on the MyProperty value while in the org-capture  
bufffer?(...either ala the %^{prompt} format or by reading the  
property definitions in the destination file or buffer?)


Thank You!

On Oct 29, 2011, at 7:02 AM, Bastien wrote:


Hi,

dlc d...@coateconnection.com writes:

I am an emacs novice attempting to use an org-capture template.   
The manual
indicates completion is available while expanding %^{prompt}.  Can  
one get
completion on %^{prop}p for a property?  I tried the same syntax  
for prompt

and that did not work.


If you want to prompt the user for property MyProperty you need to  
use

%^{MyProperty}p in the capture template.

HTH,

--
Bastien






Re: [O] org-capture template property completion

2011-10-31 Thread Giovanni Ridolfi
dlc d...@coateconnection.com writes:

 While prompting the user for property MyProtperty, Is there a way to
 get completion on the MyProperty value while in the org-capture
 bufffer?

e.g. :

:PROPERTIES:
:Effort: %^{prompt|0:10|0:20|0:30|1:00|2:00|3:00}
:END:

so you can choose the value of 'effort'?


hth
Giovanni



Re: [O] org-capture template property completion

2011-10-31 Thread dlc
almost... using %^{Effort|0:10|0:20|0:30|1:00}p in the org-template  
expansion, this would match the same format as the %^{prompt} expansion.


If only the stock property is provided in the template, e.g.  
%^{Effort}p  ... then property completion would look in the capture  
target for  #+PROPERTY  Effort_ALL 0:10 0:20 0:30 1:00 to provide the  
value list for the choosing of 'effort'





On Oct 31, 2011, at 10:00 AM, Giovanni Ridolfi wrote:


dlc d...@coateconnection.com writes:

While prompting the user for property MyProtperty, Is there a way  
to

get completion on the MyProperty value while in the org-capture
bufffer?


e.g. :

:PROPERTIES:
:Effort: %^{prompt|0:10|0:20|0:30|1:00|2:00|3:00}
:END:

so you can choose the value of 'effort'?


hth
Giovanni






Re: [O] org-capture template property completion

2011-10-29 Thread Bastien
Hi,

dlc d...@coateconnection.com writes:

 I am an emacs novice attempting to use an org-capture template.  The manual
 indicates completion is available while expanding %^{prompt}.  Can one get
 completion on %^{prop}p for a property?  I tried the same syntax for prompt
 and that did not work.

If you want to prompt the user for property MyProperty you need to use
%^{MyProperty}p in the capture template.

HTH,

-- 
 Bastien



[O] org-capture template property completion

2011-10-25 Thread dlc
I am an emacs novice attempting to use an org-capture template.  The  
manual indicates completion is available while expanding %^{prompt}.   
Can one get completion on %^{prop}p for a property?  I tried the same  
syntax for prompt and that did not work.


David




Re: [O] [error] Capture template `m': number-or-marker-p

2011-08-19 Thread Sebastien Vauban
Hello,

 With the update of 20 mins ago or so, that is [2011-08-18 Thu 23:00] (CET),
 I've got the following error when trying to use a capture template I use many
 times every day.

 Debugger entered--Lisp error: (error Capture template `m': 
 number-or-marker-p)
   signal(error (Capture template `m': number-or-marker-p))
   error(Capture template `%s': %s m number-or-marker-p)
   (condition-case error (org-capture-place-template) ((error quit) (if ... 
 ...) (set-window-configuration ...) (error Capture template `%s': %s ... 
 ...)))
   (if (equal goto 0) (org-capture-insert-template-here) (condition-case error 
 (org-capture-place-template) (... ... ... ...)) (if (and ... ...) 
 (condition-case nil ... ...)) (if (org-capture-get :immediate-finish) 
 (org-capture-finalize nil)))
   (cond ((equal entry C) (customize-variable ...)) ((equal entry q) 
 (error Abort)) (t (org-capture-set-plist entry) (org-capture-get-template) 
 (org-capture-put :original-buffer orig-buf :original-file ... 
 :original-file-nondirectory ... :annotation annotation :initial initial) 
 (org-capture-put :default-time ...) (org-capture-set-target-location) 
 (condition-case error ... ...) (setq org-capture-clock-keep ...) (if ... ... 
 ... ... ...)))
   (let* ((orig-buf ...) (annotation ...) (initial ...) (entry ...)) (when 
 (stringp initial) (remove-text-properties 0 ... ... initial)) (when (stringp 
 annotation) (remove-text-properties 0 ... ... annotation)) (cond (... ...) 
 (... ...) (t ... ... ... ... ... ... ... ...)))
   (cond ((equal goto ...) (org-capture-goto-target)) ((equal goto ...) 
 (org-capture-goto-last-stored)) (t (let* ... ... ... ...)))
   org-capture(nil)
   call-interactively(org-capture nil nil)

 FYI, the capture template in question:

 #+begin_src emacs-lisp
   (setq org-capture-templates
 `((m Mail entry
(file+headline ,org-default-notes-file Tasks)
* TODO %:subject%? (from %:fromname) :mail:
SCHEDULED: %t
%:date-timestamp-inactive

 #+begin_verse
 %i
 #+end_verse

 From %a
:empty-lines 1 :immediate-finish)))
 #+end_src

 Best regards,
   Seb

 PS- BTW, I still don't understand how to get real data instead of those
 useless ellipses in the above stack trace.

 I've the following in my .emacs file, but it clearly seems without any
 effect!??

 #+begin_src emacs-lisp
   ;; maximum depth of lists to print in the result of the evaluation 
 commands
   ;; before abbreviating them: no limit
   (setq eval-expression-print-level nil)

   ;; maximum length of lists to print in the result of the evaluation 
 commands
   ;; before abbreviating them: no limit
   (setq eval-expression-print-length nil)
 #+end_src

This seems closed with the last git of this morning (past-09:42).

Thanks!

Best regards,
  Seb

-- 
Sebastien Vauban




[O] [error] Capture template `m': number-or-marker-p

2011-08-18 Thread Sebastien Vauban
Hello,

With the update of 20 mins ago or so, that is [2011-08-18 Thu 23:00] (CET),
I've got the following error when trying to use a capture template I use many
times every day.

--8---cut here---start-8---
Debugger entered--Lisp error: (error Capture template `m': number-or-marker-p)
  signal(error (Capture template `m': number-or-marker-p))
  error(Capture template `%s': %s m number-or-marker-p)
  (condition-case error (org-capture-place-template) ((error quit) (if ... ...) 
(set-window-configuration ...) (error Capture template `%s': %s ... ...)))
  (if (equal goto 0) (org-capture-insert-template-here) (condition-case error 
(org-capture-place-template) (... ... ... ...)) (if (and ... ...) 
(condition-case nil ... ...)) (if (org-capture-get :immediate-finish) 
(org-capture-finalize nil)))
  (cond ((equal entry C) (customize-variable ...)) ((equal entry q) (error 
Abort)) (t (org-capture-set-plist entry) (org-capture-get-template) 
(org-capture-put :original-buffer orig-buf :original-file ... 
:original-file-nondirectory ... :annotation annotation :initial initial) 
(org-capture-put :default-time ...) (org-capture-set-target-location) 
(condition-case error ... ...) (setq org-capture-clock-keep ...) (if ... ... 
... ... ...)))
  (let* ((orig-buf ...) (annotation ...) (initial ...) (entry ...)) (when 
(stringp initial) (remove-text-properties 0 ... ... initial)) (when (stringp 
annotation) (remove-text-properties 0 ... ... annotation)) (cond (... ...) (... 
...) (t ... ... ... ... ... ... ... ...)))
  (cond ((equal goto ...) (org-capture-goto-target)) ((equal goto ...) 
(org-capture-goto-last-stored)) (t (let* ... ... ... ...)))
  org-capture(nil)
  call-interactively(org-capture nil nil)
--8---cut here---end---8---

FYI, the capture template in question:

#+begin_src emacs-lisp
  (setq org-capture-templates
`((m Mail entry
   (file+headline ,org-default-notes-file Tasks)
   * TODO %:subject%? (from %:fromname) :mail:
   SCHEDULED: %t
   %:date-timestamp-inactive

#+begin_verse
%i
#+end_verse

From %a
   :empty-lines 1 :immediate-finish)))
#+end_src

Best regards,
  Seb

PS- BTW, I still don't understand how to get real data instead of those
useless ellipses in the above stack trace.

I've the following in my .emacs file, but it clearly seems without any
effect!??

#+begin_src emacs-lisp
  ;; maximum depth of lists to print in the result of the evaluation 
commands
  ;; before abbreviating them: no limit
  (setq eval-expression-print-level nil)

  ;; maximum length of lists to print in the result of the evaluation 
commands
  ;; before abbreviating them: no limit
  (setq eval-expression-print-length nil)
#+end_src

-- 
Sebastien Vauban




Re: [O] Define capture template with dynamic id target

2011-06-11 Thread Aankhen
Hi Darlan,

On Fri, Jun 10, 2011 at 21:20, Darlan Cavalcante Moreira
darc...@gmail.com wrote:
 Thanks David,

 I tried to follow your suggestion, but I found two problems (maybe because
 I know little about lisp).

 For instance, suppose I have a test.org file with the follow content
 --8---cut here---start-8---
 * 2011
  Every headline has an ID, but I have omitted here for brevity
 *** May
 * Sub-headline
      bla bla bla
 *** June
 * Sub-headline
      bla bla bla
 --8---cut here---end---8---

 I want the capture process to add an entry to the Sub-headline of June. If
 I just use the file+headline and specify Sub-headline then it will add to
 the Sub-headline in May. That's why I tried using IDs in the first
 place. Also, every month I create a new month headline with the
 Sub-headline and the capture process should add an entry to that
 instead. That is the reason I wanted to get the ID from a function, instead
 of just writing it in the capture template.


 As far as I understand if I use the file+function target then the function
 must return the headline name, but how can I say that I want the
 Sub-headline of June and not of May? [first problem]

 I found an org-id-find function that returns something like
 (filename . characterPosition). Therefore, If there is a way to specify a
 position where org should start looking for the headline then I could use
 that to go to the correct Sub-headline.


 Also, the file+headline target will add the entry as a child of the
 specified headline, but file+function seems to add the entry as a sibling
 of the headline returned by the function. [second problem] Is this intended
 behaviour or is it a bug?
 [snip]

Looking at the code, the function doesn’t need to return anything; it
just needs to place point where you want the new headline to appear.
Therefore, you can use ‘org-find-olp’ to locate the entry:

,[ C-h f org-find-olp RET ]
| org-find-olp is a compiled Lisp function in `org.el'.
|
| (org-find-olp PATH optional THIS-BUFFER)
|
| Return a marker pointing to the entry at outline path OLP.
| If anything goes wrong, throw an error.
| You can wrap this call to catch the error like this:
|
|   (condition-case msg
|   (org-mobile-locate-entry (match-string 4))
| (error (nth 1 msg)))
|
| The return value will then be either a string with the error message,
| or a marker if everything is OK.
|
| If THIS-BUFFER is set, the outline path does not contain a file,
| only headings.
`

So the code would look something like this:

,
| (org-find-olp '(2011 May Sub-headline) t)
`

Aankhen



Re: [O] Define capture template with dynamic id target

2011-06-10 Thread Darlan Cavalcante Moreira

Thanks David,

I tried to follow your suggestion, but I found two problems (maybe because
I know little about lisp).

For instance, suppose I have a test.org file with the follow content
--8---cut here---start-8---
* 2011
  Every headline has an ID, but I have omitted here for brevity
*** May
* Sub-headline
  bla bla bla
*** June
* Sub-headline
  bla bla bla
--8---cut here---end---8---

I want the capture process to add an entry to the Sub-headline of June. If
I just use the file+headline and specify Sub-headline then it will add to
the Sub-headline in May. That's why I tried using IDs in the first
place. Also, every month I create a new month headline with the
Sub-headline and the capture process should add an entry to that
instead. That is the reason I wanted to get the ID from a function, instead
of just writing it in the capture template.


As far as I understand if I use the file+function target then the function
must return the headline name, but how can I say that I want the
Sub-headline of June and not of May? [first problem]

I found an org-id-find function that returns something like
(filename . characterPosition). Therefore, If there is a way to specify a
position where org should start looking for the headline then I could use
that to go to the correct Sub-headline.


Also, the file+headline target will add the entry as a child of the
specified headline, but file+function seems to add the entry as a sibling
of the headline returned by the function. [second problem] Is this intended
behaviour or is it a bug?

--
Thanks again,
Darlan


At Fri, 10 Jun 2011 07:31:43 +0200,
David Maus dm...@ictsoc.de wrote:
 
 [1  text/plain; US-ASCII (7bit)]
 At Thu, 09 Jun 2011 15:18:00 -0300,
 Darlan Cavalcante Moreira wrote:
 
 
  Hello List,
 
  I'm trying to create a few templates for org capture and I have found a
  weird behavior with the ID target type. It works OK if I use the ID
  directly like below
  #+begin_src emacs-lisp
(id Junho2011Contas)
  #+end_src
  but it does not find the ID if I try to get it from a function, such as
  #+begin_src emacs-lisp
(id (get-me-an-org-id-for-the-month Contas))
  #+end_src
 
 Org capture does not support executing a function in the ID target spec.
 
 C-h v org-capture-templates RET
 
 target   Specification of where the captured item should be placed.
  In Org-mode files, targets usually define a node.  Entries will
  become children of this node, other types will be added to the
  table or list in the body of this node.
 
  Most target specifications contain a file name.  If that file
  name is the empty string, it defaults to 
 `org-default-notes-file'.
  A file can also be given as a variable, function, or Emacs Lisp
  form.
 
  Valid values are:
 
  (file path/to/file)
  Text will be placed at the beginning or end of that file
 
  (id id of existing org entry)
  File as child of this entry, or in the body of the entry
 
  ...
 
 You might use the `function' target spec
 
  (function function-finding-location)
 Most general way, write your own function to find both
 file and location
 
 HTH,
   -- David
 --
 OpenPGP... 0x99ADB83B5A4478E6
 Jabber dmj...@jabber.org
 Email. dm...@ictsoc.de
 [2  application/pgp-signature (7bit)]
 



[O] Define capture template with dynamic id target

2011-06-09 Thread Darlan Cavalcante Moreira

Hello List,

I'm trying to create a few templates for org capture and I have found a
weird behavior with the ID target type. It works OK if I use the ID
directly like below
#+begin_src emacs-lisp
  (id Junho2011Contas)
#+end_src
but it does not find the ID if I try to get it from a function, such as
#+begin_src emacs-lisp
  (id (get-me-an-org-id-for-the-month Contas))
#+end_src

All the get-me-an-org-id-for-the-month function does is returning
MonthnameYearArgument, in this case it returns Junho2011Contas. The
definition is given below
#+begin_src emacs-lisp
  (defun get-me-an-org-id-for-the-month (categoryName)
Used only in my template for the expenses of the month. It
  return a suitable ID for the month sub-headline.
(interactive)
(concat (get-current-month) (get-current-year) categoryName)
)
#+end_src


--
Darlan



Re: [O] Define capture template with dynamic id target

2011-06-09 Thread David Maus
At Thu, 09 Jun 2011 15:18:00 -0300,
Darlan Cavalcante Moreira wrote:


 Hello List,

 I'm trying to create a few templates for org capture and I have found a
 weird behavior with the ID target type. It works OK if I use the ID
 directly like below
 #+begin_src emacs-lisp
   (id Junho2011Contas)
 #+end_src
 but it does not find the ID if I try to get it from a function, such as
 #+begin_src emacs-lisp
   (id (get-me-an-org-id-for-the-month Contas))
 #+end_src

Org capture does not support executing a function in the ID target spec.

C-h v org-capture-templates RET

target   Specification of where the captured item should be placed.
 In Org-mode files, targets usually define a node.  Entries will
 become children of this node, other types will be added to the
 table or list in the body of this node.

 Most target specifications contain a file name.  If that file
 name is the empty string, it defaults to `org-default-notes-file'.
 A file can also be given as a variable, function, or Emacs Lisp
 form.

 Valid values are:

 (file path/to/file)
 Text will be placed at the beginning or end of that file

 (id id of existing org entry)
 File as child of this entry, or in the body of the entry

 ...

You might use the `function' target spec

 (function function-finding-location)
Most general way, write your own function to find both
file and location

HTH,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. dm...@ictsoc.de


pgpYcbpVXoTDw.pgp
Description: PGP signature


[O] Org-capture template Problem

2011-05-23 Thread Chao LU
Dear all,

I'm trying to define a template for org-capture like below:

(setq org-capture-templates
  '(
 *(e EMACS entry (file+olp (concat org-source-dir /Emacs.org)
EMACS INBOX) * %? :prepend t)*
 (i INBOX entry (file+olp (concat org-private-dir /iPrv.org)
INBOX -INBOX-) * %? :prepend t)
   )
)

And the file Emacs.org has such structure:

#+-*- coding:utf-8; mode:org -*-
#+STARTUP:Overview
#+INFOJS_OPT: view:overview mouse:underline buttons:nil ltoc:nil
#+INFOJS_OPT: up:Sitemap.html
#+INFOJS_OPT: home:index.html
#+INFOJS_OPT: path:./theme/org-info.js
#+OPTIONS: num:nil h:3 TeX:nil LaTeX:nil toc:nil f:t \n:t
#+FILETAGS: Emacs
#+TITLE: Emacs
#+LINK: pdf file:./Emacs/%s.pdf
#+LINK: txt file:./Emacs/%s.txt

* Emacs
** INBOX
*** blabla


It doesn't work, the error message is *progn: Heading not found on level 3:
INBOX*.

To me, it seems Emacs was trying to find the headline *(3rd level)* with
name of INBOX. But according to my configuration, it should go and find the
head of *2nd level*. Could anybody give me some hint why it behave like so?

Thanks,

Chao


Re: [O] Org-capture template Problem

2011-05-23 Thread Nick Dokos
Chao LU looc...@gmail.com wrote:

 Dear all,
 
 I'm trying to define a template for org-capture like below:
 
 (setq org-capture-templates
   '(
  (e EMACS entry (file+olp (concat org-source-dir /Emacs.org) 
 EMACS INBOX) * %?
 :prepend t)
  (i INBOX entry (file+olp (concat org-private-dir /iPrv.org) 
 INBOX -INBOX-) * %?
 :prepend t)
        )
 )
 
 And the file Emacs.org has such structure:
 
 #+-*- coding:utf-8; mode:org -*-
 #+STARTUP:    Overview
 #+INFOJS_OPT: view:overview mouse:underline buttons:nil ltoc:nil
 #+INFOJS_OPT: up:Sitemap.html
 #+INFOJS_OPT: home:index.html
 #+INFOJS_OPT: path:./theme/org-info.js
 #+OPTIONS: num:nil h:3 TeX:nil LaTeX:nil toc:nil f:t \n:t
 #+FILETAGS: Emacs
 #+TITLE: Emacs
 #+LINK: pdf file:./Emacs/%s.pdf
 #+LINK: txt file:./Emacs/%s.txt
 
 * Emacs
 ** INBOX
 *** blabla
 
 
 It doesn't work, the error message is progn: Heading not found on level 3: 
 INBOX.
 
 To me, it seems Emacs was trying to find the headline (3rd level) with name 
 of INBOX. But according
 to my configuration, it should go and find the head of 2nd level. Could 
 anybody give me some hint
 why it behave like so?
 

Search the list for backquote.

Nick



[O] Re: Capture Template problem

2011-03-23 Thread Bernt Hansen
Chao LU looc...@gmail.com writes:

 Dear All,

 I found a little problem when configuring Org-Capture.

 The target file is iPrv.org, whose structure is like this:
 ===
 * INBOX
 *** A
 *** B
 *** C
 ===
 So I defined a template like :
  (i INBOX entry (file+olp (concat org-private-dir /iPrv.org) INBOX)
 *** %? :prepend t)

 But the Results turned out to be:
 ===
 * INBOX
 ** D     What I want is *** D (Level 3, not 2)
 *** A
 *** B
 *** C
 ===

 So I changed my configuration a little like:
  (i INBOX entry (file+olp (concat org-private-dir /iPrv.org) INBOX *
 INBOX*) *** %? :prepend t)

 And accordingly the iPrv.org file.
 ===
 * INBOX
 *** INBOX*
 *** A
 *** B
 *** C
 ===

 But still error: Heading not found on level 2: INBOX.

 I'm using org 7.5 on Emacs OSX 23.3

 Thanks,

 Chao

Do you have org-odd-levels-only set?  If not then skipping level 2 is
invalid.

Regards,
-- 
Bernt



Re: [O] Bug: capture template target file+datetree+prompt not valid. [7.4]

2011-03-10 Thread Bastien
Hi Zhang,

Zhang Zhizhong i...@zzzcn.info writes:

 Did I miss something? Or did I just found a bug?

Please send a backtrace, it will help understand the error you have:

  http://orgmode.org/manual/Feedback.html

Thanks!

-- 
 Bastien



[O] Bug: capture template target file+datetree+prompt not valid. [7.4]

2011-03-09 Thread Zhang Zhizhong
I set up my capture template as follows:
(setq org-capture-templates
  '((t Todo entry (file+headline ~/repo/org/refile.org Task)
 * TODO %?\n %i%T\n %i%U\n %a\n :clock-in t :clock-resume t)
(n Note entry (file ~/repo/org/refile.org)
 * %?\n %U\n %a\n :CLOCK:\n :END: :clock-in t :clock-resume t)
(r Routine entry (file+datetree+prompt ~/repo/org/x.org)
 * Content ommited)
))
and I expect it prompt out an inbox for me to select date after I recall
org-capture and choose r. But it turns out file+datetree+prompt is
not a valid value for target. Emacs simple returns an error message:
Invalid time specification.

Did I miss something? Or did I just found a bug?

Thank you guys in advance :)

Emacs  : GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.22.1)
 of 2011-03-06 on zzz-laptop
Package: Org-mode version 7.4

-- 
Best Regards,
Zhang Zhizhong
Department of Computer Science
Sun Yat-sen University


Re: [O] Bug: capture template target file+datetree+prompt not valid. [7.4]

2011-03-09 Thread Nick Dokos
Zhang Zhizhong i...@zzzcn.info wrote:

 I set up my capture template as follows:
 (setq org-capture-templates
  '((t Todo entry (file+headline ~/repo/org/refile.org Task)
 * TODO %?\n %i%T\n %i%U\n %a\n :clock-in t :clock-resume t)
 (n Note entry (file ~/repo/org/refile.org)
 * %?\n %U\n %a\n :CLOCK:\n :END: :clock-in t :clock-resume t)
 (r Routine entry (file+datetree+prompt ~/repo/org/x.org)
 * Content ommited)
 ))
 and I expect it prompt out an inbox for me to select date after I recall
 org-capture and choose r. But it turns out file+datetree+prompt is
 not a valid value for target. Emacs simple returns an error message:
 Invalid time specification.
 
 Did I miss something? Or did I just found a bug?
 
 Thank you guys in advance :)
 
 Emacs  : GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.22.1)
  of 2011-03-06 on zzz-laptop
 Package: Org-mode version 7.4
 

Works fine for me.

Org-mode version 7.5 (release_7.5.7.g4090.dirty)
GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0) of 
2010-11-17 on alphaville

Nick