Skip to content

Commit

Permalink
replace overlay with text properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Feb 15, 2024
1 parent 48df629 commit c0a93f7
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions org-db-agenda.el
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ CANDIDATE is a string, possibly with a timestamp in it."


;; Note this did not work as well as I hoped. Maybe some things happen like
;; updating the deadline after this is done
;; updating the deadline after this is done, like updating the CLOSED property.
;; It is also pretty slow to update a buffer, so it feels laggy when using it.
;; Leaving it here to remind me I tried it.

;; (defun org-db-todo-hook-fn ()
;; "Run when you change a TODO state.
Expand Down Expand Up @@ -290,17 +292,18 @@ order by headlines.deadline desc")))
;; delta * 4%
(percent (* (- count 2) 4))
(color)
(d (mapcar 'string-to-number (list month day year))))
(d (mapcar 'string-to-number (list month day year)))
(calendar-date-echo-text (format "test %d" count)))
(when (calendar-date-is-visible-p d)
(save-excursion
(calendar-cursor-to-visible-date d)
(setq color (if (time-less-p (org-read-date nil t (string-join (car group) "-"))
(org-read-date nil t "+1w"))
(color-darken-name "red" percent)
(color-darken-name "DarkOliveGreen4" percent)))
(overlay-put
(make-overlay (1- (point)) (1+ (point))) 'face
(list :foreground color :weight 'bold :help-echo "test")))))))
(add-text-properties (1- (point)) (1+ (point))
`(font-lock-face '(:foreground ,color :weight bold)
help-echo (format "%s tasks" ,count))))))))


(defun org-db-agenda-calendar-view ()
Expand All @@ -309,8 +312,18 @@ order by headlines.deadline desc")))
(let ((calendar-today-visible-hook))
(add-hook 'calendar-today-visible-hook
'org-db-agenda-mark-calendar)
(org-db-agenda
(org-read-date))))
;; What do we do with the selected date? This adds a day to what you
;; selected which then shows entries on that day or earlier.
;; (org-db-agenda
;; (org-format-time-string
;; "%Y-%m-%d %H:%M:%S"
;; (time-add (org-read-date t t) (* 60 60 24))))

(let ((selection (org-read-date t t)))
(org-db-ogenda (format-time-string "%Y-%m-%d" selection)
(format-time-string "%Y-%m-%d" (time-add
selection
(* 60 60 24)))))))



Expand Down

0 comments on commit c0a93f7

Please sign in to comment.