emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: [PATCH] Always return refreshed category


From: Carsten Dominik
Subject: Re: [Orgmode] Re: [PATCH] Always return refreshed category
Date: Mon, 3 Jan 2011 09:39:20 +0100

Hi Julien,

neither in the patch nor in the ChangeLog entry I am
able to find the refresh for categories in agenda
buffer preparation - even though your message states that you
have changed this.

Can you please take a fresh look and write a fresh patch?
Matt, will you be able to test that patch when it comes in?

Thanks

- Carsten

On Dec 27, 2010, at 3:23 PM, Julien Danjou wrote:

On Mon, Dec 27 2010, Julien Danjou wrote:

On Fri, Dec 24 2010, Carsten Dominik wrote:

I have reverted the patch for now.  It would be great if the two of
you could continue to try to fix it before we make another attempt.

Here's an updated patch with all the fixes above.

I've re-added a refresh in the prepare, otherwise the categories are not
being updated in the agenda views.
From f84b0aaa50854ebfcd70008646411e9809874346 Mon Sep 17 00:00:00 2001
From: Julien Danjou <address@hidden>
Date: Wed, 22 Dec 2010 15:00:27 +0100
Subject: [PATCH] Always return refreshed category

* org-icalendar.el (org-print-icalendar-entries): Do not manually
 refresh categories.

* org-clock.el (org-clock-insert-selection-line): Do not manually
 refresh categories.

* org.el (org-get-category): Refresh categories if no category found.
(org-entry-properties): Do not manually refresh categories.

It seems a very bad thing to call manually for a category refresh. It
seems better to try to refresh if we do not have a category.

Signed-off-by: Julien Danjou <address@hidden>
---
lisp/org-archive.el   |    1 -
lisp/org-clock.el     |    4 +---
lisp/org-icalendar.el |    1 -
lisp/org.el           |   13 ++++++-------
4 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index e56b01f..c32ee23 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -226,7 +226,6 @@ this heading."
      (save-excursion
        (org-back-to-heading t)
        ;; Get context information that will be lost by moving the tree
-       (org-refresh-category-properties)
        (setq category (org-get-category)
              todo (and (looking-at org-todo-line-regexp)
                        (match-string 2))
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 93b0b52..17fccae 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -442,9 +442,7 @@ pointing to it."
            (ignore-errors
              (goto-char marker)
              (setq file (buffer-file-name (marker-buffer marker))
-                   cat (or (org-get-category)
-                           (progn (org-refresh-category-properties)
-                                  (org-get-category)))
+                   cat (org-get-category)
                    heading (org-get-heading 'notags)
                    prefix (save-excursion
                             (org-back-to-heading t)
diff --git a/lisp/org-icalendar.el b/lisp/org-icalendar.el
index d4034fe..a1bc5ad 100644
--- a/lisp/org-icalendar.el
+++ b/lisp/org-icalendar.el
@@ -302,7 +302,6 @@ When COMBINE is non nil, add the category to each line."
        scheduledp deadlinep todo prefix due start
        tmp pri categories location summary desc uid alarm
        (sexp-buffer (get-buffer-create "*ical-tmp*")))
-    (org-refresh-category-properties)
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward re1 nil t)
diff --git a/lisp/org.el b/lisp/org.el
index e190b84..61180ca 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8142,7 +8142,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)
+       (progn (org-refresh-category-properties)
+              (get-text-property pos 'org-category)))))

(defun org-refresh-category-properties ()
  "Refresh category text properties in the buffer."
@@ -8150,8 +8153,7 @@ call CMD."
                  ((null org-category)
                   (if buffer-file-name
                       (file-name-sans-extension
-                       (file-name-nondirectory buffer-file-name))
-                    "???"))
+                       (file-name-nondirectory buffer-file-name))))
                  ((symbolp org-category) (symbol-name org-category))
                  (t org-category)))
        beg end cat pos optionp)
@@ -13482,10 +13484,7 @@ things up because then unnecessary parsing is avoided."
                                                       'add_times))
                    props))
          (unless (assoc "CATEGORY" props)
-           (setq value (or (org-get-category)
-                           (progn (org-refresh-category-properties)
-                                  (org-get-category))))
-           (push (cons "CATEGORY" value) props))
+           (push (cons "CATEGORY" (org-get-category)) props))
          (append sum-props (nreverse props)))))))

(defun org-entry-get (pom property &optional inherit literal-nil)
--
1.7.2.3


--
Julien Danjou
❱ http://julien.danjou.info

- Carsten






reply via email to

[Prev in Thread] Current Thread [Next in Thread]