diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-05 04:56:56 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-05 04:56:56 -0500 |
| commit | d8fd744b0669c6a4b3fb08fb4d75ab421c3a0416 (patch) | |
| tree | e3f458b36a6d8385f962494d13333601c33e5e15 | |
| parent | 5108e05eeb395f1d66122c25c862b1401478853f (diff) | |
| download | chime-d8fd744b0669c6a4b3fb08fb4d75ab421c3a0416.tar.gz chime-d8fd744b0669c6a4b3fb08fb4d75ab421c3a0416.zip | |
refactor: rewrite chime--time-left without threading-pcase
Edebug's defun parser rejects the `(-> seconds (pcase ...) ...)' form,
so undercover can't instrument chime.el and `make coverage' produces
nothing. The let-bound rewrite is equivalent and parses cleanly.
I left an inline note so the form doesn't get folded back later.
| -rw-r--r-- | chime.el | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -686,13 +686,15 @@ Returns non-nil only if the timestamp includes HH:MM time information." "Human-friendly representation for SECONDS. Format is controlled by `chime-time-left-format-at-event', `chime-time-left-format-short', and `chime-time-left-format-long'." - (-> seconds - (pcase - ((pred (>= 0)) chime-time-left-format-at-event) - ((pred (>= 3600)) chime-time-left-format-short) - (_ chime-time-left-format-long)) - - (format-seconds seconds))) + ;; Don't fold this into a `(-> seconds (pcase ...) ...)' threading form — + ;; edebug's defun parser rejects threaded pcase, which breaks coverage + ;; instrumentation (undercover) on this file. + (let ((format-string + (pcase seconds + ((pred (>= 0)) chime-time-left-format-at-event) + ((pred (>= 3600)) chime-time-left-format-short) + (_ chime-time-left-format-long)))) + (format-seconds format-string seconds))) (defun chime--get-hh-mm-from-org-time-string (time-string) "Convert given org time-string TIME-STRING into string with \\='hh:mm\\=' format." |
