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.
This commit is contained in:
Bastien Guerry 2014-03-12 18:41:01 +01:00
parent 250abf061b
commit b28ebdf3f1
1 changed files with 9 additions and 6 deletions

View File

@ -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."