From 2b156c210a42631678a5798ceeb84eb382d33b21 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Fri, 28 Jun 2024 10:47:03 +0200 Subject: Include train platform info --- public_transport/db-schedules.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/public_transport/db-schedules.el b/public_transport/db-schedules.el index a8f8b4b..6446c51 100644 --- a/public_transport/db-schedules.el +++ b/public_transport/db-schedules.el @@ -69,11 +69,11 @@ (defun db-schedules--prepare-row (row) "Return tabulated entry vector for ROW." - (-let* (((&hash "stop" "when" "plannedWhen" "delay" "direction" "line") row) + (-let* (((&hash "stop" "when" "plannedWhen" "delay" "platform" "direction" "line") row) ((&hash "name") stop) ((&hash "name" line-name) line) extra) - (when (integerp delay) + (when (and (integerp delay) (cl-plusp delay)) (thread-first (format "Planned: %s" (db-schedules--time plannedWhen)) (propertize 'face 'font-lock-comment-face) @@ -82,11 +82,18 @@ (format "Delayed: %s" (seconds-to-string delay)) (propertize 'face 'font-lock-keyword-face) (push extra))) + (unless (eq :null platform) + (push (thread-last + (propertize platform 'face 'font-lock-variable-name-face) + (format "Platform: %s")) + extra)) (vector name (thread-first (if (eq when :null) plannedWhen when) (db-schedules--time) - (propertize 'face (if (integerp delay) 'font-lock-keyword-face 'font-lock-doc-face))) + (propertize 'face (if (and (integerp delay) (cl-plusp delay)) + 'font-lock-keyword-face + 'font-lock-doc-face))) (thread-first (propertize line-name 'face 'font-lock-string-face) (list direction) @@ -104,9 +111,9 @@ (seq-map-indexed (lambda (row idx) (list idx row)) rows)) (setq tabulated-list-format [("Stop" 25 nil) - ("time" 10 nil ) - ("direction" 38 nil) - ("extra" 25 nil)]) + ("Time" 10 nil ) + ("Direction" 38 nil) + ("Info" 25 nil)]) (tabulated-list-init-header) (tabulated-list-print t) (display-buffer (current-buffer)) ))) -- cgit v1.2.3