diff options
author | Bastien Guerry <bzg@altern.org> | 2014-06-02 15:40:04 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2014-06-02 15:40:04 +0200 |
commit | 89cb26ed175fc4893b4b07be4f71ff5a8b857e1a (patch) | |
tree | f161932301207ee351aa818a59161b4bf201f837 | |
parent | 9e09b2d5f62ffcea32194d65127f4b54a6d74440 (diff) | |
download | org-mode-89cb26ed175fc4893b4b07be4f71ff5a8b857e1a.tar.gz |
org.el: Fix setting and deleting properties with a null value
* org.el (org-property-re): Also match null properties by
default.
(org-entry-delete): Also delete null properties.
(org-read-property-value): Allow the empty string as a new
value.
(org-delete-property): Throw a message when there is not
property to delete.
Thanks to Andrea Rossetti for reporting this.
-rw-r--r-- | lisp/org.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el index e41855d..c671263 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6165,7 +6165,7 @@ Use `org-reduced-level' to remove the effect of `org-odd-levels'." ".*?\\)\\(?5:[ \t]*\\)$")) (defconst org-property-re - (org-re-property ".*?" 'literal) + (org-re-property ".*?" 'literal t) "Regular expression matching a property line. There are four matching groups: 1: :PROPKEY: including the leading and trailing colon, @@ -15426,7 +15426,7 @@ an empty drawer to delete." (if (and range (goto-char (car range)) (re-search-forward - (org-re-property property) + (org-re-property property nil t) (cdr range) t)) (progn (delete-region (match-beginning 0) (1+ (point-at-eol))) @@ -15802,9 +15802,7 @@ This is computed according to `org-property-set-functions-alist'." (funcall set-function prompt (mapcar 'list (org-property-values property)) nil nil "" nil cur))))) - (if (equal val "") - cur - val))) + (org-trim val))) (defvar org-last-set-property nil) (defvar org-last-set-property-value nil) @@ -15882,8 +15880,10 @@ an empty drawer to delete." (org-icompleting-read "Property: " props nil t) (caar props)))) (list prop))) - (if (org-entry-delete nil property delete-empty-drawer) - (message "Property %s deleted" property))) + (if (not property) + (message "No property to delete in this entry") + (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." |