From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: [PATCH] Always return refreshed category Date: Thu, 23 Dec 2010 10:42:36 -0500 Message-ID: <87d3osa42b.fsf@fastmail.fm> References: <1293026785-12467-1-git-send-email-julien@danjou.info> <74C83FF2-959A-4C7D-B161-0C333EEE36DD@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=43539 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVnJR-0000bg-9H for emacs-orgmode@gnu.org; Thu, 23 Dec 2010 10:42:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PVnJP-00015q-T3 for emacs-orgmode@gnu.org; Thu, 23 Dec 2010 10:42:41 -0500 Received: from out3.smtp.messagingengine.com ([66.111.4.27]:59302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PVnJP-00015E-QU for emacs-orgmode@gnu.org; Thu, 23 Dec 2010 10:42:39 -0500 In-Reply-To: <74C83FF2-959A-4C7D-B161-0C333EEE36DD@gmail.com> (Carsten Dominik's message of "Thu, 23 Dec 2010 08:43:43 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: Julien Danjou , emacs-orgmode@gnu.org Carsten Dominik writes: > Applied, thanks. > This patch produces some unexpected category strings. Here's a sample file: --8<---------------cut here---------------start------------->8--- * TODO A todo SCHEDULED: <2010-12-23 Thu> [2010-12-23 Thu 10:22] * TODO Another todo SCHEDULED: <2010-12-23 Thu> [2010-12-23 Thu 10:25] --8<---------------cut here---------------end--------------->8--- When I run the agenda on it, I get the following: --8<---------------cut here---------------start------------->8--- Day-agenda (W51): Thursday 23 December 2010 test: Scheduled: TODO A todo t: Scheduled: TODO Another todo --8<---------------cut here---------------end--------------->8--- This resolves itself the second time I call the agenda. But I also periodically find that "???" is added as a category string when there is no #+CATEGORY line or :CATEGORY: property. > On Dec 22, 2010, at 3:06 PM, Julien Danjou wrote: > >> diff --git a/lisp/org.el b/lisp/org.el >> index 3cecca7..e80d2fc 100644 >> --- a/lisp/org.el >> +++ b/lisp/org.el >> @@ -8141,7 +8141,10 @@ call CMD." >> >> (defun org-get-category (&optional pos) >> "Get the category applying to position POS." >> - (get-text-property (or pos (point)) 'org-category)) >> + (let ((pos (or pos (point)))) >> + (or (get-text-property pos 'org-category) >> + (org-refresh-category-properties) >> + (get-text-property pos 'org-category)))) Another observation: org-refresh-category-properties returns t and thus short-circuits the "or" here. Is the following perhaps the intended behavior? --8<---------------cut here---------------start------------->8--- diff --git a/lisp/org.el b/lisp/org.el index e80d2fc..55f1bf1 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8143,8 +8143,8 @@ call CMD." "Get the category applying to position POS." (let ((pos (or pos (point)))) (or (get-text-property pos 'org-category) - (org-refresh-category-properties) - (get-text-property pos 'org-category)))) + (progn (org-refresh-category-properties) + (get-text-property pos 'org-category))))) (defun org-refresh-category-properties () "Refresh category text properties in the buffer." --8<---------------cut here---------------end--------------->8--- Best, Matt