Prechádzať zdrojové kódy

Fix `org-refresh-category-properties'

* lisp/org.el (org-refresh-category-properties): Prevent the `put-text-property'
  to change the point in order to take into account the CATEGORY
  property in subtrees also.

* testing/lisp/test-org.el (test-org/entry-properties): Add test.
Konubinix 10 rokov pred
rodič
commit
6f0cf14383
2 zmenil súbory, kde vykonal 8 pridanie a 1 odobranie
  1. 1 1
      lisp/org.el
  2. 7 0
      testing/lisp/test-org.el

+ 1 - 1
lisp/org.el

@@ -9565,7 +9565,7 @@ The refresh happens only for the current tree (not subtree)."
 	    (when (org-at-property-p)
 	      (put-text-property
 	       (save-excursion (org-back-to-heading t) (point))
-	       (org-end-of-subtree t t)
+	       (save-excursion (org-end-of-subtree t t) (point))
 	       'org-category
 	       value)))))))))
 

+ 7 - 0
testing/lisp/test-org.el

@@ -3009,6 +3009,13 @@ Text.
    (equal "cat"
 	  (org-test-with-temp-text "* H\n:PROPERTIES:\n:CATEGORY: cat\n:END:"
 	    (cdr (assoc "CATEGORY" (org-entry-properties nil "CATEGORY"))))))
+  (should
+   (equal "cat2"
+	  (org-test-with-temp-text
+	      (concat "* H\n:PROPERTIES:\n:CATEGORY: cat1\n:END:"
+		      "\n"
+		      "** H2\n:PROPERTIES:\n:CATEGORY: cat2\n:END:<point>")
+	    (cdr (assoc "CATEGORY" (org-entry-properties nil "CATEGORY"))))))
   ;; Get standard properties.
   (should
    (equal "1"