From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Burt Subject: Re: org-capture, datetree, and tags Date: Sat, 23 Feb 2013 07:18:44 -0500 Message-ID: References: <20130219122529.GB26449@broggs.org> <87ehg8xxjd.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9E46-0004YL-Me for emacs-orgmode@gnu.org; Sat, 23 Feb 2013 07:18:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9E40-0006a8-0T for emacs-orgmode@gnu.org; Sat, 23 Feb 2013 07:18:54 -0500 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:11004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9E3z-0006Zp-Sr for emacs-orgmode@gnu.org; Sat, 23 Feb 2013 07:18:47 -0500 In-Reply-To: <87ehg8xxjd.fsf@bzg.ath.cx> (Bastien's message of "Fri, 22 Feb 2013 14:56:06 +0100") 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: Bastien Cc: Jeffrey Brent McBeth , emacs-orgmode@gnu.org Bastien writes: > Hi Tim, > > Tim Burt 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