summaryrefslogtreecommitdiffstats
path: root/2020/organizers-notebook.org
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--2020/organizers-notebook.org38
1 files changed, 38 insertions, 0 deletions
diff --git a/2020/organizers-notebook.org b/2020/organizers-notebook.org
index 9a6d42f2..fcb4bbb0 100644
--- a/2020/organizers-notebook.org
+++ b/2020/organizers-notebook.org
@@ -863,6 +863,44 @@ If TALK is not specified, do it in the current buffer."
#+end_src
* Other useful tidbits
+** Translating timezones
+
+#+begin_src emacs-lisp
+ (setq my/timezones '("America/Toronto" "America/Los_Angeles" "UTC" "Europe/Berlin" "Asia/Kolkata" "Asia/Shanghai" "Asia/Singapore"))
+ (defun my/summarize-times (time timezones)
+ (let (prev-day)
+ (mapconcat
+ (lambda (tz)
+ (let ((cur-day (format-time-string "%a %b %-e" time tz))
+ (cur-time (format-time-string "%H%MH %Z" time tz)))
+ (if (equal prev-day cur-day)
+ cur-time
+ (setq prev-day cur-day)
+ (concat cur-day " " cur-time))))
+ (sort timezones (lambda (a b) (< (car (current-time-zone nil a)) (car (current-time-zone nil b)))))
+ " / ")))
+ (defun my/org-summarize-event-in-timezones ()
+ (interactive)
+ (save-window-excursion
+ (save-excursion
+ (when (derived-mode-p 'org-agenda-mode) (org-agenda-goto))
+ (when (re-search-forward org-element--timestamp-regexp nil (save-excursion (org-end-of-subtree) (point)))
+ (goto-char (match-beginning 0))
+ (let* ((times (org-element-timestamp-parser))
+ (start-time (org-timestamp-to-time (org-timestamp-split-range times)))
+ (msg (format "%s - %s - %s"
+ (org-get-heading t t t t)
+ (my/summarize-times start-time my/timezones)
+ ;; (cond
+ ;; ((time-less-p (org-timestamp-to-time (org-timestamp-split-range times t)) (current-time))
+ ;; "(past)")
+ ;; ((time-less-p (current-time) start-time)
+ ;; (concat "in " (format-seconds "%D %H %M%Z" (time-subtract start-time (current-time)))))
+ ;; (t "(ongoing)"))
+ (org-entry-get (point) "LOCATION"))))
+ (message "%s" msg)
+ (kill-new msg))))))
+#+end_src
** Restarting ikiwiki manually