Remove 'org-category text property cache
* lisp/org.el (org-get-category): Update useing `org-entry-get-with-inheritance'. (org-agenda-ignore-properties): Update docstring. (org-refresh-category-properties): (org-check-agenda-file): Do not call `org-refresh-category-properties'. * lisp/org-compat.el (org-refresh-category-properties): Obsolete. * doc/org-manual.org (Speeding Up Your Agendas): Update the manual. * testing/lisp/test-org.el (test-org/get-category): Update tests, not calling the obsolete function.
This commit is contained in:
parent
771074ba5e
commit
eb0a293a02
|
@ -21768,12 +21768,12 @@ number. Here are tips to speed up:
|
|||
- Disable parsing of some drawer properties:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-agenda-ignore-properties '(effort appt stats category))
|
||||
(setq org-agenda-ignore-properties '(effort appt stats))
|
||||
#+end_src
|
||||
|
||||
The drawer properties you can disable in the agenda are effort
|
||||
estimates (~effort~), appointments (~appt~), statistics (~stats~)
|
||||
and subtree-local categories (~category~).
|
||||
estimates (~effort~), appointments (~appt~), and statistics
|
||||
(~stats~).
|
||||
|
||||
These options can be applied to selected agenda views. For more
|
||||
details about generation of agenda views, see the docstrings for the
|
||||
|
|
|
@ -5664,7 +5664,7 @@ and the timestamp type relevant for the sorting strategy in
|
|||
(throw :skip nil)))
|
||||
(goto-char (match-beginning 2))
|
||||
(setq marker (org-agenda-new-marker (match-beginning 0))
|
||||
category (org-get-category)
|
||||
category (save-match-data (org-get-category))
|
||||
effort (save-match-data (or (get-text-property (point) 'effort)
|
||||
(org-entry-get (point) org-effort-property)))
|
||||
effort-minutes (when effort (save-match-data (org-duration-to-minutes effort)))
|
||||
|
|
|
@ -582,6 +582,8 @@ Counting starts at 1."
|
|||
(define-obsolete-function-alias 'org--math-always-on
|
||||
'org--math-p "9.7")
|
||||
|
||||
(make-obsolete 'org-refresh-category-properties "no longer used" "9.7")
|
||||
|
||||
(defun org-compatible-face (inherits specs)
|
||||
"Make a compatible face specification.
|
||||
If INHERITS is an existing face and if the Emacs version supports
|
||||
|
|
28
lisp/org.el
28
lisp/org.el
|
@ -7956,20 +7956,13 @@ call CMD."
|
|||
(cl-progv vars vals
|
||||
(call-interactively cmd))))
|
||||
|
||||
(defun org-get-category (&optional pos force-refresh)
|
||||
"Get the category applying to position POS."
|
||||
(save-match-data
|
||||
(when force-refresh (org-refresh-category-properties))
|
||||
(let ((pos (or pos (point))))
|
||||
(if (org-element--cache-active-p)
|
||||
;; Sync cache.
|
||||
(org-with-point-at (org-element-begin (org-element-at-point pos))
|
||||
(or (org-entry-get-with-inheritance "CATEGORY")
|
||||
"???"))
|
||||
(or (get-text-property pos 'org-category)
|
||||
(progn
|
||||
(org-refresh-category-properties)
|
||||
(get-text-property pos 'org-category)))))))
|
||||
(defun org-get-category (&optional pos _)
|
||||
"Get the category applying to position POS.
|
||||
Return \"???\" when no category is set."
|
||||
;; Sync cache.
|
||||
(or (org-entry-get-with-inheritance
|
||||
"CATEGORY" nil (or pos (point)))
|
||||
"???"))
|
||||
|
||||
;;; Refresh properties
|
||||
|
||||
|
@ -15246,12 +15239,11 @@ appointments, statistics and subtree-local categories.
|
|||
If you don't use these in the agenda, you can add them to this
|
||||
list and agenda building will be a bit faster.
|
||||
The value is a list, with zero or more of the symbols `effort', `appt',
|
||||
`stats' or `category'."
|
||||
or `stats'."
|
||||
:type '(set :greedy t
|
||||
(const effort)
|
||||
(const appt)
|
||||
(const stats)
|
||||
(const category))
|
||||
(const stats))
|
||||
:version "26.1"
|
||||
:package-version '(Org . "8.3")
|
||||
:group 'org-agenda)
|
||||
|
@ -15536,8 +15528,6 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
|
|||
(org-get-agenda-file-buffer file))
|
||||
(org-with-wide-buffer
|
||||
(org-set-regexps-and-options 'tags-only)
|
||||
(or (memq 'category org-agenda-ignore-properties)
|
||||
(org-refresh-category-properties))
|
||||
(or (memq 'stats org-agenda-ignore-properties)
|
||||
(org-refresh-stats-properties))
|
||||
(or (memq 'effort org-agenda-ignore-properties)
|
||||
|
|
|
@ -6911,47 +6911,39 @@ Paragraph<point>"
|
|||
(org-refresh-properties "A" 'org-test))
|
||||
(get-text-property (point) 'org-test)))))
|
||||
|
||||
(ert-deftest test-org/refresh-category-properties ()
|
||||
"Test `org-refresh-category-properties' specifications"
|
||||
(ert-deftest test-org/get-category ()
|
||||
"Test `org-get-category' specifications."
|
||||
(should
|
||||
(equal "cat1"
|
||||
(org-test-with-temp-text
|
||||
":PROPERTIES:\n:CATEGORY: cat1\n:END:"
|
||||
(org-refresh-category-properties)
|
||||
(org-get-category))))
|
||||
":PROPERTIES:\n:CATEGORY: cat1\n:END:"
|
||||
(org-get-category))))
|
||||
(should
|
||||
(equal "cat1"
|
||||
(org-test-with-temp-text
|
||||
"* H\n:PROPERTIES:\n:CATEGORY: cat1\n:END:"
|
||||
(org-refresh-category-properties)
|
||||
(org-get-category))))
|
||||
"* H\n:PROPERTIES:\n:CATEGORY: cat1\n:END:"
|
||||
(org-get-category))))
|
||||
;; Even though property-inheritance is deactivated, category
|
||||
;; property should be inherited. As described in
|
||||
;; `org-use-property-inheritance'.
|
||||
(should
|
||||
(equal "cat1"
|
||||
(org-test-with-temp-text
|
||||
":PROPERTIES:\n:CATEGORY: cat1\n:END:\n<point>* H"
|
||||
(org-mode-restart)
|
||||
(let ((org-use-property-inheritance nil))
|
||||
(org-refresh-category-properties))
|
||||
(org-get-category))))
|
||||
(let ((org-use-property-inheritance nil))
|
||||
(org-test-with-temp-text
|
||||
":PROPERTIES:\n:CATEGORY: cat1\n:END:\n<point>* H"
|
||||
(org-get-category)))))
|
||||
(should
|
||||
(equal "cat1"
|
||||
(org-test-with-temp-text
|
||||
":PROPERTIES:\n:CATEGORY: cat1\n:END:\n<point>* H"
|
||||
(org-mode-restart)
|
||||
(let ((org-use-property-inheritance t))
|
||||
(org-refresh-category-properties))
|
||||
(org-get-category))))
|
||||
(let ((org-use-property-inheritance t))
|
||||
(org-test-with-temp-text
|
||||
":PROPERTIES:\n:CATEGORY: cat1\n:END:\n<point>* H"
|
||||
(org-get-category)))))
|
||||
(should
|
||||
(equal "cat2"
|
||||
(org-test-with-temp-text
|
||||
":PROPERTIES:\n:CATEGORY: cat1\n:END:\n<point>* H\n:PROPERTIES:\n:CATEGORY: cat2\n:END:\n"
|
||||
(org-mode-restart)
|
||||
(let ((org-use-property-inheritance t))
|
||||
(org-refresh-category-properties))
|
||||
(org-get-category)))))
|
||||
(let ((org-use-property-inheritance t))
|
||||
(org-test-with-temp-text
|
||||
":PROPERTIES:\n:CATEGORY: cat1\n:END:\n<point>* H\n:PROPERTIES:\n:CATEGORY: cat2\n:END:\n"
|
||||
(org-get-category))))))
|
||||
|
||||
|
||||
;;; Refile
|
||||
|
|
Loading…
Reference in New Issue