Carsten Dominik <carsten.domi...@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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to