diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-10-21 00:27:15 +0300 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-10-21 09:39:15 +0300 |
| commit | ee2ff4cafa3632d1e6de02d89d83366028a81abb (patch) | |
| tree | 66a0613adb760b41f8f1014b60a7409a4a82f0f9 /mu4e | |
| parent | 91c360ce9aaf52d54c00ed8d66be8cf60583864c (diff) | |
mu4e-helpers: restore missing mu4e-get-time-date
It was in use in mu4e-headers-custom-markers, but somehow got lost back in 2021,
it seems. Restore it.
Fixes #2879.
Diffstat (limited to 'mu4e')
| -rw-r--r-- | mu4e/mu4e-headers.el | 8 | ||||
| -rw-r--r-- | mu4e/mu4e-helpers.el | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 20f8e20..f1344c4 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -268,7 +268,7 @@ The first character of NAME is used as the shortcut." (lambda () (mu4e-get-time-date "Match messages after: "))) ("Bigger than" (lambda (msg bytes) (> (mu4e-msg-field msg :size) (* 1024 bytes))) - (lambda () (read-number "Match messages bigger than (Kbytes): ")))) + (lambda () (read-number "Match messages bigger than (KB): ")))) "List of custom markers-functions. The functions are to mark message that match some custom @@ -281,7 +281,11 @@ and (optionally) PARAM, and should return non-nil when there's a match. * PARAM-FUNC is function that is evaluated once, and its value is then passed to PREDICATE-FUNC as PARAM. This is useful for -getting user-input.") +getting user-input. + +The default functions that take dates, use `mu4e-get-time-date' +which wraps `parse-time-string' and hence requires the format to +be compatible with that.") ;;; Internal variables/constants ;; docid cookies diff --git a/mu4e/mu4e-helpers.el b/mu4e/mu4e-helpers.el index 2648808..47c1f22 100644 --- a/mu4e/mu4e-helpers.el +++ b/mu4e/mu4e-helpers.el @@ -501,6 +501,13 @@ This includes expanding e.g. 3-5 into 3,4,5. If the letter (mu4e-warn "Attachment number must be greater than 0 (%d)" x)))) list))) +(defun mu4e-get-time-date (prompt) + "Determine the Emacs time value for time/date entered by user. +Basically, a command around `parse-time-string' to read a user +string after PROMPT." + (let ((timestr (read-string (mu4e-format "%s" prompt)))) + (apply 'encode-time (parse-time-string timestr)))) + (defun mu4e-make-temp-file (ext) "Create a self-destructing temporary file with extension EXT. The file will self-destruct in a short while, enough to open it |
