|
@@ -43,6 +43,9 @@
|
|
|
(defcustom org-agenda-dych-default-work-hour "8h"
|
|
|
"The length of your schedule in hours.")
|
|
|
|
|
|
+(defcustom org-agenda-dych-default-end "16:00"
|
|
|
+ "The length of your schedule in hours.")
|
|
|
+
|
|
|
(defcustom org-agenda-dych-default-start "08:00"
|
|
|
"The default start time to start the working day."
|
|
|
:group 'org-properties
|
|
@@ -63,7 +66,6 @@ Includes leading space character.")
|
|
|
(or (bound-and-true-p org-agenda-dych-overriding-start)
|
|
|
(car (alist-get 'org-agenda-dych-overriding-start
|
|
|
(nth 2 (org-get-at-bol 'org-series-cmd))))
|
|
|
- org-agenda-dych-current-start
|
|
|
org-agenda-dych-default-start))
|
|
|
|
|
|
;;; Utilities
|
|
@@ -179,12 +181,15 @@ ARG is passed through to `org-agenda-schedule'."
|
|
|
((bound-and-true-p org-overriding-work-hours))
|
|
|
((let ((m (org-get-at-bol 'org-hd-marker)))
|
|
|
(and m (with-current-buffer (marker-buffer m)
|
|
|
- org-agenda-dych-default-work-hour))))
|
|
|
+ (- (org-duration-to-minutes org-agenda-dych-default-end)
|
|
|
+ (org-duration-to-minutes (org-agenda-dych-get-start)))))))
|
|
|
((let ((m (next-single-property-change (point-min) 'org-hd-marker)))
|
|
|
(and m (let ((m (get-text-property m 'org-hd-marker)))
|
|
|
(with-current-buffer (marker-buffer m)
|
|
|
- org-agenda-dych-default-work-hour)))))
|
|
|
- (t org-agenda-dych-default-work-hour)))
|
|
|
+ (- (org-duration-to-minutes org-agenda-dych-default-end)
|
|
|
+ (org-duration-to-minutes (org-agenda-dych-get-start))))))))
|
|
|
+ (t (- (org-duration-to-minutes org-agenda-dych-default-end)
|
|
|
+ (org-duration-to-minutes (org-agenda-dych-get-start))))))
|
|
|
|
|
|
(defun org-agenda-dych-get-dotime (&optional point)
|
|
|
"Get the scheduled time of the current entry or the entry at POINT."
|
|
@@ -324,7 +329,8 @@ have the user confirm to set its scheduled time as the start of the day."
|
|
|
(org-get-at-bol 'org-hd-marker) t)
|
|
|
(setq rigid-minute
|
|
|
(string-to-number
|
|
|
- (calc-eval (format "%f+%f" rigid-minute (org-get-at-bol 'effort-minutes)))))
|
|
|
+ (calc-eval (format "%f+%f" rigid-minute
|
|
|
+ (org-get-at-bol 'effort-minutes)))))
|
|
|
(cl-incf rigid-count))))
|
|
|
|
|
|
block-start
|
|
@@ -335,10 +341,11 @@ have the user confirm to set its scheduled time as the start of the day."
|
|
|
|
|
|
(setq neffort (abs (string-to-number
|
|
|
(calc-eval (format "(%f-%f-%f)/%d"
|
|
|
- (org-duration-to-minutes
|
|
|
- (or (and (not (eq (org-agenda-dych-get-dotime) 'time))
|
|
|
- (org-agenda-dych-get-dotime))
|
|
|
- (org-agenda-dych-get-workhours)))
|
|
|
+ (or (ignore-errors
|
|
|
+ (org-duration-to-minutes
|
|
|
+ (and (not (eq (org-agenda-dych-get-dotime) 'time))
|
|
|
+ (org-agenda-dych-get-dotime))))
|
|
|
+ (org-agenda-dych-get-workhours))
|
|
|
(org-duration-to-minutes
|
|
|
(or (org-agenda-dych-get-dotime block-start)
|
|
|
"0:00"))
|
|
@@ -349,18 +356,19 @@ have the user confirm to set its scheduled time as the start of the day."
|
|
|
(save-excursion
|
|
|
(dolist (pl effort-plists)
|
|
|
(goto-line (plist-get pl :index))
|
|
|
- (if (plist-get pl :fixed)
|
|
|
+ (if (and (plist-get pl :fixed)
|
|
|
+ (string= (org-get-at-bol 'type) "scheduled"))
|
|
|
(setq org-last-inserted-timestamp
|
|
|
(org-agenda-dych-h:mm-to-full-ts
|
|
|
(plist-get pl :dotime)))
|
|
|
(let ((ntime (seconds-to-time
|
|
|
- (string-to-number
|
|
|
- (calc-eval (format "(%f*60)+%f"
|
|
|
- (if lrigid leffort neffort)
|
|
|
- (org-time-string-to-seconds
|
|
|
- (if org-last-inserted-timestamp
|
|
|
- (substring org-last-inserted-timestamp 1 -1)
|
|
|
- (org-agenda-dych-h:mm-to-full-ts (org-agenda-dych-get-start))))))))))
|
|
|
+ (string-to-number
|
|
|
+ (calc-eval (format "(%f*60)+%f"
|
|
|
+ (if lrigid leffort neffort)
|
|
|
+ (org-time-string-to-seconds
|
|
|
+ (if org-last-inserted-timestamp
|
|
|
+ (substring org-last-inserted-timestamp 1 -1)
|
|
|
+ (org-agenda-dych-h:mm-to-full-ts (org-agenda-dych-get-start))))))))))
|
|
|
(when (org-agenda-dych-time-less-than-tomorrow-p ntime)
|
|
|
(org-agenda-dych-maybe-schedule
|
|
|
nil (format-time-string (org-time-stamp-format t) ntime)))))
|