Browse Source

org.el (org-delete-property): Don't suggest to delete the CATEGORY property

* org.el (org-delete-property): Don't suggest to delete the
CATEGORY property when the category is not explicitely set in
the property drawer.  Also enforce matching when completing.

Thanks to Oleh for providing a preliminary patch for this.
Bastien Guerry 11 năm trước cách đây
mục cha
commit
b28ebdf3f1
1 tập tin đã thay đổi với 9 bổ sung6 xóa
  1. 9 6
      lisp/org.el

+ 9 - 6
lisp/org.el

@@ -15805,13 +15805,16 @@ When optional argument DELETE-EMPTY-DRAWER is a string, it defines
 an empty drawer to delete."
   (interactive
    (let* ((completion-ignore-case t)
-	  (prop (org-icompleting-read "Property: "
-				      (org-entry-properties nil 'standard))))
+	  (cat (org-entry-get (point) "CATEGORY"))
+	  (props0 (org-entry-properties nil 'standard))
+	  (props (if cat props0
+		   (delete `("CATEGORY" . ,(org-get-category)) props0)))
+	  (prop (if (< 1 (length props))
+		    (org-icompleting-read "Property: " props nil t)
+		  (caar props))))
      (list prop)))
-  (message "Property %s %s" property
-	   (if (org-entry-delete nil property delete-empty-drawer)
-	       "deleted"
-	     "was not present in the entry")))
+  (if (org-entry-delete nil property delete-empty-drawer)
+      (message "Property %s deleted" property)))
 
 (defun org-delete-property-globally (property)
   "Remove PROPERTY globally, from all entries."