* org-capture, datetree, and tags
@ 2013-02-19 12:25 Jeffrey Brent McBeth
2013-02-20 11:40 ` Tim Burt
2013-02-20 11:43 ` Jeffrey Brent McBeth
0 siblings, 2 replies; 7+ messages in thread
From: Jeffrey Brent McBeth @ 2013-02-19 12:25 UTC (permalink / raw)
To: emacs-orgmode
I'm trying to capture into a datetree using org-capture, but if my tree has a tag on it (in particular noexport), then it creates a new datetree instead of using the one I have.
Example .emacs:
(global-set-key "\C-cc" 'org-capture)
(setq org-capture-templates
'(("t" "Test" plain (file+datetree "~/Test.org")
"%^{Greeting} World
I'm going to work this time")))
Example Test.org:
* 2013 :noexport:
** 2013-02 February
*** 2013-02-19 Tuesday
Hello World
I'm going to work this time
So, based on the above, if I type C-cct Silly C-cc, I'll get this:
* 2013 :noexport:
** 2013-02 February
*** 2013-02-19 Tuesday
Hello World
I'm going to work this time
* 2013
** 2013-02 February
*** 2013-02-19 Tuesday
Silly World
I'm going to work this time
Thanks for your attention,
Jeffrey McBeth
--
"The man who does not read good books has no advantage over
the man who cannot read them."
-- Mark Twain
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-capture, datetree, and tags
2013-02-19 12:25 org-capture, datetree, and tags Jeffrey Brent McBeth
@ 2013-02-20 11:40 ` Tim Burt
2013-02-21 11:42 ` Tim Burt
2013-02-20 11:43 ` Jeffrey Brent McBeth
1 sibling, 1 reply; 7+ messages in thread
From: Tim Burt @ 2013-02-20 11:40 UTC (permalink / raw)
To: Jeffrey Brent McBeth; +Cc: emacs-orgmode
Jeffrey Brent McBeth <mcbeth@broggs.org> writes:
> I'm trying to capture into a datetree using org-capture, but if my tree has a tag on it (in particular noexport), then it creates a new datetree instead of using the one I have.
> Example .emacs:
> (global-set-key "\C-cc" 'org-capture)
> (setq org-capture-templates
> '(("t" "Test" plain (file+datetree "~/Test.org")
> "%^{Greeting} World
> I'm going to work this time")))
>
> Example Test.org:
>
> * 2013 :noexport:
> ** 2013-02 February
> *** 2013-02-19 Tuesday
> Hello World
> I'm going to work this time
>
> So, based on the above, if I type C-cct Silly C-cc, I'll get this:
>
> * 2013 :noexport:
> ** 2013-02 February
> *** 2013-02-19 Tuesday
> Hello World
> I'm going to work this time
> * 2013
> ** 2013-02 February
> *** 2013-02-19 Tuesday
> Silly World
> I'm going to work this time
>
> Thanks for your attention,
> Jeffrey McBeth
I can confirm both the behavior and a usecase for a tagged datetree.
In org-datetree.el the function org-datetree-find-year-create searches for
the year on a headline and will not match content with anything beyond the
fourth digit.
: (defun org-datetree-find-year-create (year)
: (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)$")
: match)
In this particular case the tag in question is :noexport: with white space
fore (and maybe aft), and the following change to the regular expression
was tested with success.
: (defun org-datetree-find-year-create (year)
: (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]+:noexport:[ \t]*$")
: match)
Of course this only matches the specific tag in this example *and* only
matches a datetree with this tag. The regular expression needs to be
improved to include a valid tag set as optional.
--
Tim Burt
www.rketburt.org
"It is healthful to every sane man to utter the art within him;" -- GK Chesterton
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-capture, datetree, and tags
2013-02-19 12:25 org-capture, datetree, and tags Jeffrey Brent McBeth
2013-02-20 11:40 ` Tim Burt
@ 2013-02-20 11:43 ` Jeffrey Brent McBeth
1 sibling, 0 replies; 7+ messages in thread
From: Jeffrey Brent McBeth @ 2013-02-20 11:43 UTC (permalink / raw)
To: emacs-orgmode
On Tue, Feb 19, 2013 at 07:25:29AM -0500, Jeffrey Brent McBeth wrote:
> I'm trying to capture into a datetree using org-capture, but if my tree has a tag on it (in particular noexport), then it creates a new datetree instead of using the one I have.
I have verified that this still occurs under latest (7.9.3e-920-gce79e pulled 5:50am EST) with emacs 24.1.1 (Ubuntu packaged). Are my expectations wrong that it should be inserting into the original tree, and there is perhaps another way to tag a heirarchy to not be exported that I should be using? If this is a bug, is there additional information I need to supply to assist in the debugging? Am I asking in the right place?
Thanks for your attention,
Jeffrey McBeth
>Example .emacs:
>(global-set-key "\C-cc" 'org-capture)
>(setq org-capture-templates
> '(("t" "Test" plain (file+datetree "~/Test.org")
> "%^{Greeting} World
> I'm going to work this time")))
>
>Example Test.org:
>* 2013 :noexport:
>** 2013-02 February
>*** 2013-02-19 Tuesday
>Hello World
>I'm going to work this time
>
>So, based on the above, if I type C-cct Silly C-cc, I'll get this:
>
>* 2013 :noexport:
>** 2013-02 February
>*** 2013-02-19 Tuesday
>Hello World
>I'm going to work this time
>* 2013
>** 2013-02 February
>*** 2013-02-19 Tuesday
>Silly World
>I'm going to work this time
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-capture, datetree, and tags
2013-02-20 11:40 ` Tim Burt
@ 2013-02-21 11:42 ` Tim Burt
2013-02-22 13:56 ` Bastien
0 siblings, 1 reply; 7+ messages in thread
From: Tim Burt @ 2013-02-21 11:42 UTC (permalink / raw)
To: Jeffrey Brent McBeth; +Cc: emacs-orgmode
Tim Burt <tcburt@rochester.rr.com> writes:
> Jeffrey Brent McBeth <mcbeth@broggs.org> writes:
>
>> I'm trying to capture into a datetree using org-capture, but if my tree has a tag on it (in particular noexport), then it creates a new datetree instead of using the one I have.
>> Example .emacs:
>> (global-set-key "\C-cc" 'org-capture)
>> (setq org-capture-templates
>> '(("t" "Test" plain (file+datetree "~/Test.org")
>> "%^{Greeting} World
>> I'm going to work this time")))
>>
>> Example Test.org:
>>
>> * 2013 :noexport:
>> ** 2013-02 February
>> *** 2013-02-19 Tuesday
>> Hello World
>> I'm going to work this time
>>
>> So, based on the above, if I type C-cct Silly C-cc, I'll get this:
>>
>> * 2013 :noexport:
>> ** 2013-02 February
>> *** 2013-02-19 Tuesday
>> Hello World
>> I'm going to work this time
>> * 2013
>> ** 2013-02 February
>> *** 2013-02-19 Tuesday
>> Silly World
>> I'm going to work this time
>>
>> Thanks for your attention,
>> Jeffrey McBeth
>
> I can confirm both the behavior and a usecase for a tagged datetree.
>
> In org-datetree.el the function org-datetree-find-year-create searches for
> the year on a headline and will not match content with anything beyond the
> fourth digit.
> : (defun org-datetree-find-year-create (year)
> : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)$")
> : match)
>
> In this particular case the tag in question is :noexport: with white space
> fore (and maybe aft), and the following change to the regular expression
> was tested with success.
> : (defun org-datetree-find-year-create (year)
> : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]+:noexport:[ \t]*$")
> : match)
> Of course this only matches the specific tag in this example *and* only
> matches a datetree with this tag. The regular expression needs to be
> improved to include a valid tag set as optional.
Improved the regular expression to permit multiple tags of letters,
numbers, underscores, and at signs.
: (defun org-datetree-find-year-create (year)
: (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*\\(:[[:alnum:]_@]*\\)*:*[ \t]*$")
: match)
I've tested with the following headlines:
- 2013
- both with and without trailing spaces
- 2013 :abc:
- 2013 :abc123:
- 2013 :abc123:_underscore:@attaboy::
- 2013 :noexport:
Any comments on the regular expression are welcome before I make patch.
--
Tim Burt
www.rketburt.org
"It is healthful to every sane man to utter the art within him;" -- GK Chesterton
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-capture, datetree, and tags
2013-02-21 11:42 ` Tim Burt
@ 2013-02-22 13:56 ` Bastien
2013-02-23 12:18 ` Tim Burt
0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2013-02-22 13:56 UTC (permalink / raw)
To: Tim Burt; +Cc: Jeffrey Brent McBeth, emacs-orgmode
Hi Tim,
Tim Burt <tcburt@rochester.rr.com> writes:
> : (defun org-datetree-find-year-create (year)
> : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*\\(:[[:alnum:]_@]*\\)*:*[ \t]*$")
> : match)
> I've tested with the following headlines:
> - 2013
> - both with and without trailing spaces
> - 2013 :abc:
> - 2013 :abc123:
> - 2013 :abc123:_underscore:@attaboy::
> - 2013 :noexport:
>
> Any comments on the regular expression are welcome before I make
> patch.
Thanks for working on fixing this.
The more or less standard regexp for tags-till-end-of-line is this:
:[[:alnum:]_@#%:]*[ \t]*$
^
With * if you want to match headlines with no tag.
Please have a look at this page before submitting a patch:
http://orgmode.org/worg/org-contribute.html#sec-5
Thanks!
--
Bastien
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-capture, datetree, and tags
2013-02-22 13:56 ` Bastien
@ 2013-02-23 12:18 ` Tim Burt
2013-02-24 21:05 ` Tim Burt
0 siblings, 1 reply; 7+ messages in thread
From: Tim Burt @ 2013-02-23 12:18 UTC (permalink / raw)
To: Bastien; +Cc: Jeffrey Brent McBeth, emacs-orgmode
Bastien <bzg@altern.org> writes:
> Hi Tim,
>
> Tim Burt <tcburt@rochester.rr.com> writes:
>
>> : (defun org-datetree-find-year-create (year)
>> : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*\\(:[[:alnum:]_@]*\\)*:*[ \t]*$")
>> : match)
>> I've tested with the following headlines:
>> - 2013
>> - both with and without trailing spaces
>> - 2013 :abc:
>> - 2013 :abc123:
>> - 2013 :abc123:_underscore:@attaboy::
>> - 2013 :noexport:
>>
>> Any comments on the regular expression are welcome before I make
>> patch.
>
> Thanks for working on fixing this.
>
> The more or less standard regexp for tags-till-end-of-line is this:
>
> :[[:alnum:]_@#%:]*[ \t]*$
> ^
>
> With * if you want to match headlines with no tag.
I may have misapplied what you suggested, but the new regexp (see below)
does not work on a year headline without tags.
: (defun org-datetree-find-year-create (year)
: (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*\\(:[[:alnum:]_@#%:]*[ \t]*$\\)")
: match)
However, the suggestion helped me find the following in org-todo-line-tags-regexp
\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\)
Applying this regexp worked on a tag-free headline (both with and
without trailing spaces)
: (defun org-datetree-find-year-create (year)
: (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\)")
: match)
>
> Please have a look at this page before submitting a patch:
> http://orgmode.org/worg/org-contribute.html#sec-5
Will do.
>
> Thanks!
--
Tim Burt
www.rketburt.org
"It is healthful to every sane man to utter the art within him;" -- GK Chesterton
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: org-capture, datetree, and tags
2013-02-23 12:18 ` Tim Burt
@ 2013-02-24 21:05 ` Tim Burt
0 siblings, 0 replies; 7+ messages in thread
From: Tim Burt @ 2013-02-24 21:05 UTC (permalink / raw)
To: Bastien; +Cc: Jeffrey Brent McBeth, emacs-orgmode
I have just submitted a patch. It is marked with TINYCHANGE so that it
can be processed before the assignment paperwork (which I just began
today) is complete.
Good day,
Tim
Tim Burt <tcburt@rochester.rr.com> writes:
> Bastien <bzg@altern.org> writes:
>
>> Hi Tim,
>>
>> Tim Burt <tcburt@rochester.rr.com> writes:
>>
>>> : (defun org-datetree-find-year-create (year)
>>> : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*\\(:[[:alnum:]_@]*\\)*:*[ \t]*$")
>>> : match)
>>> I've tested with the following headlines:
>>> - 2013
>>> - both with and without trailing spaces
>>> - 2013 :abc:
>>> - 2013 :abc123:
>>> - 2013 :abc123:_underscore:@attaboy::
>>> - 2013 :noexport:
>>>
>>> Any comments on the regular expression are welcome before I make
>>> patch.
>>
>> Thanks for working on fixing this.
>>
>> The more or less standard regexp for tags-till-end-of-line is this:
>>
>> :[[:alnum:]_@#%:]*[ \t]*$
>> ^
>>
>> With * if you want to match headlines with no tag.
>
> I may have misapplied what you suggested, but the new regexp (see below)
> does not work on a year headline without tags.
> : (defun org-datetree-find-year-create (year)
> : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)[ \t]*\\(:[[:alnum:]_@#%:]*[ \t]*$\\)")
> : match)
> However, the suggestion helped me find the following in org-todo-line-tags-regexp
> \\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\)
> Applying this regexp worked on a tag-free headline (both with and
> without trailing spaces)
> : (defun org-datetree-find-year-create (year)
> : (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:[ \t]*\\)?$\\)")
> : match)
>
>
>
>>
>> Please have a look at this page before submitting a patch:
>> http://orgmode.org/worg/org-contribute.html#sec-5
>
> Will do.
>
>>
>> Thanks!
--
Tim Burt
www.rketburt.org
"It is healthful to every sane man to utter the art within him;" -- GK Chesterton
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-02-24 21:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-19 12:25 org-capture, datetree, and tags Jeffrey Brent McBeth
2013-02-20 11:40 ` Tim Burt
2013-02-21 11:42 ` Tim Burt
2013-02-22 13:56 ` Bastien
2013-02-23 12:18 ` Tim Burt
2013-02-24 21:05 ` Tim Burt
2013-02-20 11:43 ` Jeffrey Brent McBeth
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).