From 95ff24dfc4290dfd173e3834c4443cf8d40bef74 Mon Sep 17 00:00:00 2001 From: Bastien Date: Tue, 11 Feb 2020 10:06:13 +0100 Subject: [PATCH] org.el: Fix bug occurring when setting effort value * lisp/org.el (org-refresh-property) (org-refresh-category-properties): Tiny docstring or comment fixes. (org-set-effort): Fail early when the effort value is wrong. Thanks to Firmin Martin for reporting this. --- lisp/org.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 44c4e27a0..33f9badde 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8309,7 +8309,7 @@ the value of the drawer property." (defun org-refresh-property (tprop p &optional inherit) "Refresh the buffer text property TPROP from the drawer property P. The refresh happens only for the current headline, or the whole -sub-tree if optional argument INHERIT is non-nil." +subtree if optional argument INHERIT is non-nil." (unless (org-before-first-heading-p) (save-excursion (org-back-to-heading t) @@ -8352,7 +8352,7 @@ sub-tree if optional argument INHERIT is non-nil." (throw 'buffer-category (org-element-property :value element))))) default-category)) - ;; Set sub-tree specific categories. + ;; Set subtree specific categories. (goto-char (point-min)) (let ((regexp (org-re-property "CATEGORY"))) (while (re-search-forward regexp nil t) @@ -13022,6 +13022,10 @@ variables is set." (not (get-text-property 0 'org-unrestricted (caar allowed)))))) (completing-read "Effort: " allowed nil must-match)))))) + ;; Test whether the value can be interpreted as a duration before + ;; inserting it in the buffer: + (org-duration-to-minutes value) + ;; Maybe update the effort value: (unless (equal current value) (org-entry-put nil org-effort-property value)) (org-refresh-property '((effort . identity)