Function: org-set-effort
org-set-effort is an interactive and byte-compiled function defined in
org.el.gz.
Signature
(org-set-effort &optional INCREMENT VALUE)
Documentation
Set the effort property of the current entry.
If INCREMENT is non-nil, set the property to the next allowed value. Otherwise, if optional argument VALUE is provided, use it. Eventually, prompt for the new value if none of the previous variables is set.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defvar org-clock-current-task) ; Defined in org-clock.el.
(defun org-set-effort (&optional increment value)
"Set the effort property of the current entry.
If INCREMENT is non-nil, set the property to the next allowed
value. Otherwise, if optional argument VALUE is provided, use
it. Eventually, prompt for the new value if none of the previous
variables is set."
(interactive "P")
(let* ((allowed (org-property-get-allowed-values nil org-effort-property t))
(current (org-entry-get nil org-effort-property))
(value
(cond
(increment
(unless allowed (user-error "Allowed effort values are not set"))
(or (caadr (member (list current) allowed))
(user-error "Unknown value %S among allowed values" current)))
(value
(if (stringp value) value
(error "Invalid effort value: %S" value)))
(t
(let ((must-match
(and allowed
(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))
(when (equal (org-get-heading t t t t)
(bound-and-true-p org-clock-current-task))
(setq org-clock-effort value)
(org-clock-update-mode-line))
(message "%s is now %s" org-effort-property value)))