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.
(org-prepare-agenda-buffers): 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 <julien@danjou.info>
This commit is contained in:
Julien Danjou 2010-12-22 19:06:25 +00:00 committed by Carsten Dominik
parent 6eaad22a37
commit f5bb1b7dbf
4 changed files with 7 additions and 11 deletions

View File

@ -226,7 +226,6 @@ this heading."
(save-excursion (save-excursion
(org-back-to-heading t) (org-back-to-heading t)
;; Get context information that will be lost by moving the tree ;; Get context information that will be lost by moving the tree
(org-refresh-category-properties)
(setq category (org-get-category) (setq category (org-get-category)
todo (and (looking-at org-todo-line-regexp) todo (and (looking-at org-todo-line-regexp)
(match-string 2)) (match-string 2))

View File

@ -442,9 +442,7 @@ pointing to it."
(ignore-errors (ignore-errors
(goto-char marker) (goto-char marker)
(setq file (buffer-file-name (marker-buffer marker)) (setq file (buffer-file-name (marker-buffer marker))
cat (or (org-get-category) cat (org-get-category)
(progn (org-refresh-category-properties)
(org-get-category)))
heading (org-get-heading 'notags) heading (org-get-heading 'notags)
prefix (save-excursion prefix (save-excursion
(org-back-to-heading t) (org-back-to-heading t)

View File

@ -302,7 +302,6 @@ When COMBINE is non nil, add the category to each line."
scheduledp deadlinep todo prefix due start scheduledp deadlinep todo prefix due start
tmp pri categories location summary desc uid alarm tmp pri categories location summary desc uid alarm
(sexp-buffer (get-buffer-create "*ical-tmp*"))) (sexp-buffer (get-buffer-create "*ical-tmp*")))
(org-refresh-category-properties)
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward re1 nil t) (while (re-search-forward re1 nil t)

View File

@ -8142,7 +8142,11 @@ call CMD."
(defun org-get-category (&optional pos) (defun org-get-category (&optional pos)
"Get the category applying to position 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 () (defun org-refresh-category-properties ()
"Refresh category text properties in the buffer." "Refresh category text properties in the buffer."
@ -13482,10 +13486,7 @@ things up because then unnecessary parsing is avoided."
'add_times)) 'add_times))
props)) props))
(unless (assoc "CATEGORY" props) (unless (assoc "CATEGORY" props)
(setq value (or (org-get-category) (push (cons "CATEGORY" (org-get-category)) props))
(progn (org-refresh-category-properties)
(org-get-category))))
(push (cons "CATEGORY" value) props))
(append sum-props (nreverse props))))))) (append sum-props (nreverse props)))))))
(defun org-entry-get (pom property &optional inherit literal-nil) (defun org-entry-get (pom property &optional inherit literal-nil)
@ -15702,7 +15703,6 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(set-buffer (org-get-agenda-file-buffer file))) (set-buffer (org-get-agenda-file-buffer file)))
(widen) (widen)
(setq bmp (buffer-modified-p)) (setq bmp (buffer-modified-p))
(org-refresh-category-properties)
(setq org-todo-keywords-for-agenda (setq org-todo-keywords-for-agenda
(append org-todo-keywords-for-agenda org-todo-keywords-1)) (append org-todo-keywords-for-agenda org-todo-keywords-1))
(setq org-done-keywords-for-agenda (setq org-done-keywords-for-agenda