From 70cde953eeba44a5a2236d5e8d684ecfd393ed27 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sun, 29 Nov 2026 20:42:59 -0500 Subject: make buffer a number --- emacsconf-schedule.el | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'emacsconf-schedule.el') diff --git a/emacsconf-schedule.el b/emacsconf-schedule.el index 31f7831..74864b7 100644 --- a/emacsconf-schedule.el +++ b/emacsconf-schedule.el @@ -89,7 +89,7 @@ Each function should take the info and manipulate it as needed, returning the ne (mapcar (lambda (o) (when (and (string= (plist-get o :track) "Development") (string-match "live" (or (plist-get o :q-and-a) ""))) - (plist-put o :buffer (number-to-string emacsconf-schedule-default-buffer-minutes-for-dev))) + (plist-put o :buffer emacsconf-schedule-default-buffer-minutes-for-dev)) o) info)) (defun emacsconf-schedule-strategy-pack-everything-in-just-as-confirmed (&optional info) @@ -137,12 +137,11 @@ Each function should take the info and manipulate it as needed, returning the ne (mapcar (lambda (o) (when (plist-get o :slug) (plist-put o :buffer - (number-to-string - (if (string-match "live" (or (plist-get o :q-and-a) "")) - (min (string-to-number (or (plist-get o :max-time) - (plist-get o :time))) - emacsconf-schedule-default-buffer-minutes-for-live-q-and-a) - emacsconf-schedule-default-buffer-minutes)))) + (if (string-match "live" (or (plist-get o :q-and-a) "")) + (min (or (plist-get o :max-time) + (plist-get o :time)) + emacsconf-schedule-default-buffer-minutes-for-live-q-and-a) + emacsconf-schedule-default-buffer-minutes))) o) info)) @@ -187,8 +186,7 @@ Pairs with `emacsconf-schedule-dump-sexp'." (error "Not yet implemented") (let ((start-prop (or (plist-get (cdr seq) :start) (and (stringp (cdr seq)) (cdr seq)))) - (buffer-prop (when (plist-get (cdr seq) :buffer) - (number-to-string (plist-get (cdr seq) :buffer)))) + (buffer-prop (plist-get (cdr seq) :buffer)) (time-prop (or (plist-get (cdr seq) :time) ; this is duration in minutes (and (numberp (cdr seq)) (cdr seq)))) (track-prop (plist-get (cdr seq) :track)) @@ -596,22 +594,25 @@ Other status: gray" info)) ;(emacsconf-update-schedules #'emacsconf-round-start-to-five) -(defvar emacsconf-schedule-default-buffer-minutes-for-live-q-and-a 15) -(defvar emacsconf-schedule-default-buffer-minutes 5) +(defvar emacsconf-schedule-default-buffer-minutes-for-live-q-and-a 20) +(defvar emacsconf-schedule-default-buffer-minutes 10) + +;;;###autoload (defun emacsconf-schedule-allocate-buffer-time (info) "Allocate buffer time based on whether INFO has live Q&A. Uses `emacsconf-schedule-default-buffer-minutes' and `emacsconf-schedule-default-buffer-minutes-for-live-q-and-a'." - (mapcar (lambda (o) - (when (plist-get o :slug) - (unless (plist-get o :buffer) - (plist-put o :buffer - (number-to-string - (if (string-match "live" (or (plist-get o :q-and-a) "live")) - emacsconf-schedule-default-buffer-minutes-for-live-q-and-a - emacsconf-schedule-default-buffer-minutes))))) - o) - info)) + (if (listp (car info)) + (mapcar (lambda (o) + (emacsconf-schedule-allocate-buffer-time o)) + info) + (when (and (plist-get info :slug) + (not (plist-get info :buffer))) + (plist-put info :buffer + (if (string-match "live" (or (plist-get info :qa-type) "live")) + emacsconf-schedule-default-buffer-minutes-for-live-q-and-a + emacsconf-schedule-default-buffer-minutes))) + info)) (defun emacsconf-schedule-allocate-video-time (info) (mapcar (lambda (o) @@ -667,7 +668,7 @@ Uses `emacsconf-schedule-default-buffer-minutes' and (format-time-string "%H:%M" end-time))) (plist-put talk :start-time current-time) (plist-put talk :end-time end-time) - (setq current-time (time-add end-time (* (string-to-number (or (plist-get talk :buffer) "0")) 60)))) + (setq current-time (time-add end-time (* (or (plist-get talk :buffer) 0) 60)))) talk) info))) @@ -693,7 +694,7 @@ Talks with a FIXED_TIME property are not moved." (when (functionp modify-func) (funcall modify-func)) (setq end-time (time-add (org-get-scheduled-time (point)) (seconds-to-time duration))) - (setq current-time (time-add end-time (* (string-to-number (or (plist-get talk :buffer) "0")) 60)))))))))))) + (setq current-time (time-add end-time (* (or (plist-get talk :buffer) 0) 60)))))))))))) (defun emacsconf-schedule-get-key-func () "Get the sorting key for the current entry." @@ -991,7 +992,7 @@ If emacsconf-schedule-apply is non-nil, update `emacsconf-org-file' and the wiki (emacsconf-format-short-time (plist-get o :scheduled)) "") (or (plist-get o :time) "") - (or (plist-get o :buffer) "") + (if (plist-get o :buffer) (number-to-string (plist-get o :buffer)) "") (org-link-make-string (org-link-heading-search-string (plist-get o :title)) (plist-get o :title)) (or (plist-get o :speakers) "") @@ -1008,7 +1009,7 @@ If emacsconf-schedule-apply is non-nil, update `emacsconf-org-file' and the wiki (format-time-string "%l:%M%#p" (plist-get o :start-time)) "") (or (plist-get o :time) "") - (or (plist-get o :buffer) "") + (if (plist-get o :buffer) (number-to-string (plist-get o :buffer)) "") (if (< (string-to-number (or (plist-get o :time) "")) (string-to-number (or (plist-get o :max-time) ""))) (plist-get o :max-time) -- cgit v1.2.3