>>108757116
>world-clock
Today's recreational Elisp hacking expands on the world-clock customization from the previous thread.
(defun toggle-world-clock ()
"Toggle the visibility of the *wclock* buffer."
(interactive)
(let* ((frame (selected-frame))
(windows (window-list frame))
(found? nil))
(dolist (w windows)
(let* ((buffer (window-buffer w))
(name (buffer-name buffer)))
(when (string= name "*wclock*")
(quit-window nil w)
(setf found? t))))
(when (not found?)
(world-clock))))
Optional: Display more time zones
(setq
zoneinfo-style-world-list
'(("Pacific/Honolulu" "Honolulu")
("America/Los_Angeles" "Los Angeles")
("America/Phoenix" "Phoenix")
("America/Denver" "Denver")
("America/Chicago" "Chicago")
("America/New_York" "New York")
("America/Argentina/Buenos_Aires" "Buenos Aires")
("America/Sao_Paolo" "Sao Paolo")
("UTC" "UTC")
("Europe/London" "London")
("Europe/Berlin" "Berlin")
("Europe/Helsinki" "Helsinki")
("Europe/Moscow" "Moscow")
("Asia/Bangkok" "Bangkok")
("Asia/Singapore" "Singapore")
("Asia/Shanghai" "Shanghai")
("Australia/Perth" "Perth")
("Asia/Seoul" "Seoul")
("Asia/Tokyo" "Tokyo")
("Australia/Sydney" "Sydney")
("Pacific/Auckland" "Auckland")
))
Optional: Display world-clock in a side window.
(add-to-list
'display-buffer-alist
'((derived-mode . world-clock-mode)
(display-buffer-in-side-window)
(side . right)
(slot . 1)
(window-width . 48)))
Optional: Bind it to a key.
(keymap-global-set "C-;" #'toggle-world-clock)