From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Burt Subject: Re: org-capture, datetree, and tags Date: Thu, 21 Feb 2013 06:42:13 -0500 Message-ID: References: <20130219122529.GB26449@broggs.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8UXi-0000i0-Qz for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 06:42:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8UXY-000770-FS for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 06:42:26 -0500 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:8871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8UXY-00075u-Ar for emacs-orgmode@gnu.org; Thu, 21 Feb 2013 06:42:16 -0500 In-Reply-To: (Tim Burt's message of "Wed, 20 Feb 2013 06:40:26 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jeffrey Brent McBeth Cc: emacs-orgmode@gnu.org Tim Burt writes: > Jeffrey Brent McBeth 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