emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Julien Danjou <julien@danjou.info>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Always return refreshed category
Date: Thu, 23 Dec 2010 10:42:36 -0500	[thread overview]
Message-ID: <87d3osa42b.fsf@fastmail.fm> (raw)
In-Reply-To: <74C83FF2-959A-4C7D-B161-0C333EEE36DD@gmail.com> (Carsten Dominik's message of "Thu, 23 Dec 2010 08:43:43 +0100")

Carsten Dominik <carsten.dominik@gmail.com> 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

  reply	other threads:[~2010-12-23 15:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-22 14:06 [PATCH] Always return refreshed category Julien Danjou
2010-12-23  7:43 ` [Accepted] " Carsten Dominik
2010-12-23  7:43 ` [PATCH] " Carsten Dominik
2010-12-23 15:42   ` Matt Lundin [this message]
2010-12-23 16:03     ` Julien Danjou
2010-12-24 15:46       ` Matt Lundin
2010-12-24 16:33         ` Carsten Dominik
2010-12-27 10:56           ` Julien Danjou
2010-12-27 14:23             ` Julien Danjou
2011-01-03  8:39               ` Carsten Dominik
2011-01-03 10:57                 ` Julien Danjou
2011-01-03 12:14                   ` Carsten Dominik
2010-12-24 16:33         ` Julien Danjou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3osa42b.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=julien@danjou.info \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).