From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mats Kindahl Subject: [PATCH] Resolve regexp ambiguity for item headers Date: Mon, 10 Sep 2012 15:20:34 +0200 Message-ID: <504DE922.1000707@oracle.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080706020109010707020407" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:58853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB3v2-0000OU-01 for emacs-orgmode@gnu.org; Mon, 10 Sep 2012 09:20:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TB3ur-0001hf-Si for emacs-orgmode@gnu.org; Mon, 10 Sep 2012 09:20:51 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:34763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB3ur-0001hT-Ly for emacs-orgmode@gnu.org; Mon, 10 Sep 2012 09:20:41 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q8ADKcni024018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Sep 2012 13:20:39 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q8ADKbP0010456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 10 Sep 2012 13:20:38 GMT Received: from abhmt109.oracle.com (abhmt109.oracle.com [141.146.116.61]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q8ADKb4t030156 for ; Mon, 10 Sep 2012 08:20:37 -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: emacs-orgmode This is a multi-part message in MIME format. --------------080706020109010707020407 Content-Type: multipart/alternative; boundary="------------090507010707030002060902" --------------090507010707030002060902 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi! I use org-mode quite a lot of most things and also have a number of "workflows" in my setup, use columnview quite a lot, and also have the habit of entering whatever text I need to write to resolve an issue under the item in org-mode format (quite convenient, then I can just export the subtree and send it as mail). I have frequently run up against the issue that when trying to generate a column view for a file, it aborts with a strange error. Since this has become more frequent lately, I decided to resolve it. It turns out that if you have something that looks like this: * Top level ** TODO something *** Proposal Blabla *** Submitted Some more blaha. and you have "SUBMITTED" as one of your todo keywords, this line will be interpreted as an item with a keyword but no headline. Since a lot of code assumes that there is always a headline, many functions can get a "nil" as a headline, failing miserably. I solved this issue by requiring that there should always be a headline text (this is after all an assumption made in the code) and rewrote the org-complex-heading-regexp accordingly. Patch is attached. Just my few cents, Mats Kindahl -- Senior Principal Software Developer Oracle, MySQL Department --------------090507010707030002060902 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi!

I use org-mode quite a lot of most things and also have a number of "workflows" in my setup, use columnview quite a lot, and also have the habit of entering whatever text I need to write to resolve an issue under the item in org-mode format (quite convenient, then I can just export the subtree and send it as mail).

I have frequently run up against the issue that when trying to generate a column view for a file, it aborts with a strange error. Since this has become more frequent lately, I decided to resolve it.

It turns out that if you have something that looks like this:

* Top level

** TODO something


*** Proposal

Blabla

*** Submitted

Some more blaha.
and you have "SUBMITTED" as one of your todo keywords, this line will be interpreted as an item with a keyword but no headline. Since a lot of code assumes that there is always a headline, many functions can get a "nil" as a headline, failing miserably.

I solved this issue by requiring that there should always be a headline text (this is after all an assumption made in the code) and rewrote the org-complex-heading-regexp accordingly.

Patch is attached.

Just my few cents,
Mats Kindahl
-- 
Senior Principal Software Developer
Oracle, MySQL Department
--------------090507010707030002060902-- --------------080706020109010707020407 Content-Type: text/x-patch; name="0001-Resolved-regexp-ambiguity-for-item-headers.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Resolved-regexp-ambiguity-for-item-headers.patch" >From bc3c021d06bb6f0b5971959f769216defae200bd Mon Sep 17 00:00:00 2001 From: Mats Kindahl To: emacs-orgmode@gnu.org Date: Sun, 9 Sep 2012 21:53:45 +0200 Subject: [PATCH] Resolved regexp ambiguity for item headers X-IMAPbase: 1347255850 2 Status: O X-UID: 1 * lisp/org.el (org-complex-heading-regexp): Resolve ambiguity in heading regexp in favor of keywordless headline When a simple headline is provided that just contain a todo keyword, the regular expression will match so that the heading is treated as containing just a keyword and no headline. Since org-column-compact-links only accept a headline text (and not nil), this causes problems with called from org-columns-cleanup-item. This occurs if a 'columnview' dynamic block is used to capture a column view. This patch solves the problem by re-writing the org-complex-heading-regexp to require a headline text instead of allowing it to be optional. This means that items containing only a single word that also happens to be a todo keyword is interpreted as a headline with no todo keyword and just a headline text. --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index fef7597..e990f49 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4824,7 +4824,7 @@ but the stars and the body are.") (concat "^\\(\\*+\\)" "\\(?: +" org-todo-regexp "\\)?" "\\(?: +\\(\\[#.\\]\\)\\)?" - "\\(?: +\\(.*?\\)\\)?" + " +\\(.+?\\)" (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?") "[ \t]*$") org-complex-heading-regexp-format -- 1.7.9.5 --------------080706020109010707020407--