~bzg/org-mode

129a18abf32f6de085623a572679a5a6c96a5cdd — Ihor Radchenko a month ago 85389da
org-timer-set-timer: Fix when called from agenda buffer

* lisp/org-timer.el (org-timer-set-timer): Get effort minutes from
agenda entry line when in agenda buffer.

Reported-by: Bhavin Gandhi <bhavin7392@gmail.com>
Link: https://orgmode.org/list/CAOn=hbez7-4wFG2M1-MSHqAwvV0mysvLAUYP9_GK6mrSbtz3CQ@mail.gmail.com
1 files changed, 13 insertions(+), 8 deletions(-)

M lisp/org-timer.el
M lisp/org-timer.el => lisp/org-timer.el +13 -8
@@ 420,13 420,18 @@ using three \\[universal-argument] prefix arguments."
	     (not org-timer-countdown-timer))
    (user-error "Relative timer is running.  Stop first"))
  (let* ((default-timer
	   ;; `org-timer-default-timer' used to be a number, don't choke:
	   (if (numberp org-timer-default-timer)
	       (number-to-string org-timer-default-timer)
	     org-timer-default-timer))
	 (effort-minutes (let ((effort (org-entry-get nil org-effort-property)))
			   (when (org-string-nw-p effort)
			     (floor (org-duration-to-minutes effort)))))
	  ;; `org-timer-default-timer' used to be a number, don't choke:
	  (if (numberp org-timer-default-timer)
	      (number-to-string org-timer-default-timer)
	    org-timer-default-timer))
	 (effort-minutes
          (cond ((derived-mode-p 'org-agenda-mode)
                 (org-get-at-bol 'effort-minutes))
                ((derived-mode-p 'org-mode)
                 (let ((effort (org-entry-get nil org-effort-property)))
	           (when (org-string-nw-p effort)
	             (floor (org-duration-to-minutes effort)))))
                (t nil)))
	 (minutes (or (and (numberp opt) (number-to-string opt))
		      (and (not (equal opt '(64)))
			   effort-minutes


@@ 443,7 448,7 @@ using three \\[universal-argument] prefix arguments."
      (let ((secs (org-timer-hms-to-secs (org-timer-fix-incomplete minutes))))
	(if (and org-timer-countdown-timer
		 (not (or (equal opt '(16))
			  (y-or-n-p "Replace current timer? "))))
			(y-or-n-p "Replace current timer? "))))
	    (message "No timer set")
	  (when (timerp org-timer-countdown-timer)
	    (cancel-timer org-timer-countdown-timer))