emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/org eb0a293a02 048/101: Remove 'org-category text prope


From: ELPA Syncer
Subject: [elpa] externals/org eb0a293a02 048/101: Remove 'org-category text property cache
Date: Sat, 1 Jul 2023 09:59:08 -0400 (EDT)

branch: externals/org
commit eb0a293a02f60b854bc631a5c10b0be74dc7c2c6
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    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.
---
 doc/org-manual.org       |  6 +++---
 lisp/org-agenda.el       |  2 +-
 lisp/org-compat.el       |  2 ++
 lisp/org.el              | 28 +++++++++-------------------
 testing/lisp/test-org.el | 44 ++++++++++++++++++--------------------------
 5 files changed, 33 insertions(+), 49 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 00901ad130..33648769d9 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -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
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index eb02335b48..da74ed5381 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -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)))
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index a12400ed28..9316aefc56 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -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
diff --git a/lisp/org.el b/lisp/org.el
index 44a41f9f63..856a37a7c5 100644
--- a/lisp/org.el
+++ b/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)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index e1bd00919e..bd8f905d7b 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -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



reply via email to

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