summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2023-11-19 16:04:30 -0500
committerSacha Chua <sacha@sachachua.com>2023-11-19 16:04:30 -0500
commitb84acc8c76128f7827ac7f5877bb992994770f9f (patch)
treede589e8059b7e18c17ac1aa97f6b8251b02edb41
parent1fc1c7e45b32421e17fcec1b23327bfb264a3fab (diff)
downloademacsconf-el-b84acc8c76128f7827ac7f5877bb992994770f9f.tar.xz
emacsconf-el-b84acc8c76128f7827ac7f5877bb992994770f9f.zip
New function emacsconf-timezone-strings-combined
That should make it easier to specify multiple timezones (comma-separated) and use those in e-mails
-rw-r--r--emacsconf-mail.el24
-rw-r--r--emacsconf.el22
2 files changed, 29 insertions, 17 deletions
diff --git a/emacsconf-mail.el b/emacsconf-mail.el
index 1656bef..8c0fedb 100644
--- a/emacsconf-mail.el
+++ b/emacsconf-mail.el
@@ -677,16 +677,10 @@ ${signature}"
(let ((result
(concat
(plist-get o :title) "\n"
- (format-time-string "%b %-e %a %-I:%M %#p %Z" (plist-get o :start-time) emacsconf-timezone) "\n"
- (if (and (plist-get o :timezone) (not (string= (plist-get o :timezone) emacsconf-timezone)))
- (if (string= (format-time-string "%z" (plist-get o :start-time) (plist-get o :timezone))
- (format-time-string "%z" (plist-get o :start-time) emacsconf-timezone))
- (format "which is the same time in your local timezone %s\n"
- (emacsconf-schedule-rename-etc-timezone (plist-get o :timezone)))
- (format "translated to your local timezone %s: %s\n"
- (emacsconf-schedule-rename-etc-timezone (plist-get o :timezone))
- (format-time-string "%b %-e %a %-I:%M %#p %Z" (plist-get o :start-time) (plist-get o :timezone))))
- ""))))
+ (emacsconf-timezone-strings-combined
+ (plist-get o :start-time)
+ (plist-get o :timezone)
+ "%b %-e %a %-I:%M %#p %Z"))))
(when (called-interactively-p 'any)
(insert result))
result))
@@ -1242,18 +1236,14 @@ as soon as you can and I'll try to shuffle things around. Thank you!")
:checkin-info
(mapconcat
(lambda (o)
- (let ((base-checkin (format-time-string "%b %-d %-l:%M %p" (plist-get o :checkin-time) emacsconf-timezone))
- (speaker-checkin (format-time-string "%b %-d %-l:%M %p" (plist-get o :checkin-time) (plist-get o :timezone))))
(emacsconf-replace-plist-in-string
(append (list :base-url emacsconf-base-url
:check-in
(concat
"Before "
- base-checkin " in " emacsconf-timezone
- (if (string= base-checkin speaker-checkin)
- ""
- (concat
- ", which is the same as " speaker-checkin " in " (plist-get o :timezone))) "\n"
+ (emacsconf-timezone-strings-combined
+ (plist-get o :checkin-time)
+ (plist-get o :timezone))
" (this is " (plist-get o :checkin-label) ")")
:qa-info-speakers
(cond
diff --git a/emacsconf.el b/emacsconf.el
index 9746308..d5e6c3d 100644
--- a/emacsconf.el
+++ b/emacsconf.el
@@ -1098,9 +1098,31 @@ The subheading should match `emacsconf-abstract-heading-regexp'."
(format-time-string "%-l:%M %p %Z"
end tz)
tz))))
+
(defun emacsconf-timezone-strings (o &optional timezones)
(mapcar (lambda (tz) (emacsconf-timezone-string o tz)) (or timezones emacsconf-timezones)))
+(defun emacsconf-timezone-strings-combined (time timezones &optional format)
+ "Show TIME in TIMEZONES.
+If TIMEZONES is a string, split it by commas."
+ (let* ((format (or format "%b %-d %-l:%M %p"))
+ (base-time (format-time-string format time emacsconf-timezone))
+ (timezones (if (stringp timezones) (split-string timezones " *, *" t))))
+ (concat base-time " in " (emacsconf-schedule-rename-etc-timezone emacsconf-timezone)
+ (if timezones
+ (concat
+ " (which is "
+ (mapconcat
+ (lambda (tz)
+ (let ((translated-time (format-time-string format time tz)))
+ (if (string= translated-time base-time)
+ (concat "the same in " (emacsconf-schedule-rename-etc-timezone tz))
+ (concat translated-time " in " (emacsconf-schedule-rename-etc-timezone tz)))))
+ timezones
+ "; ")
+ ")")
+ ""))))
+
;;;###autoload
(defun emacsconf-convert-from-timezone (timezone time)
(interactive (list (progn