From b8861cdbfe2a082c4d2cbeb9701e41867af1df3f Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 11 Dec 2022 13:59:26 +0200 Subject: [PATCH] mu4e-helpers: fix whitespace Follow .dir-locals. --- mu4e/mu4e-helpers.el | 64 +++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/mu4e/mu4e-helpers.el b/mu4e/mu4e-helpers.el index ef17d188..f746ca84 100644 --- a/mu4e/mu4e-helpers.el +++ b/mu4e/mu4e-helpers.el @@ -161,14 +161,16 @@ Does a local-exit and does not return." "Get PROP from plist LST and raise an error if not present." (or (plist-get lst prop) (if (plist-member lst prop) - nil - (mu4e-error "Missing property %s in %s" prop lst)))) + nil + (mu4e-error "Missing property %s in %s" prop lst)))) -(defun mu4e--read-char-choice (prompt choices) +(defun mu4e--read-char-choice (prompt choices &optional key) "Read and return one of CHOICES, prompting for PROMPT. Any input that is not one of CHOICES is ignored. This is mu4e's version of `read-char-choice' which becomes case-insentive after -trying an exact match." +trying an exact match. + +If optional KEY is provided, use that instead of asking user." (let ((choice) (chosen) (inhibit-quit nil)) (while (not chosen) (message nil);; this seems needed... @@ -369,18 +371,18 @@ http://cr.yp.to/proto/maildir.html." (seq-mapcat (lambda (flag) (pcase flag - (`draft "D") - (`flagged "F") - (`new "N") - (`passed "P") - (`replied "R") - (`seen "S") - (`trashed "T") - (`attach "a") - (`encrypted "x") - (`signed "s") - (`unread "u") - (_ ""))) + (`draft "D") + (`flagged "F") + (`new "N") + (`passed "P") + (`replied "R") + (`seen "S") + (`trashed "T") + (`attach "a") + (`encrypted "x") + (`signed "s") + (`unread "u") + (_ ""))) (seq-uniq flags) 'string))) (defun mu4e-string-to-flags (str) @@ -394,14 +396,14 @@ http://cr.yp.to/proto/maildir.html." (seq-mapcat (lambda (kar) (list - (pcase kar - ('?D 'draft) - ('?F 'flagged) - ('?P 'passed) - ('?R 'replied) - ('?S 'seen) - ('?T 'trashed) - (_ nil)))) + (pcase kar + ('?D 'draft) + ('?F 'flagged) + ('?P 'passed) + ('?R 'replied) + ('?S 'seen) + ('?T 'trashed) + (_ nil)))) str)))) @@ -470,7 +472,7 @@ The file will self-destruct in a short while, enough to open it in an external program." (let ((tmpfile (make-temp-file "mu4e-" nil (concat "." ext)))) (run-at-time "30 sec" nil - (lambda () (ignore-errors (delete-file tmpfile)))) + (lambda () (ignore-errors (delete-file tmpfile)))) tmpfile)) (defsubst mu4e-is-mode-or-derived-p (mode) @@ -492,12 +494,12 @@ Or go to the top level if there is none." (defun mu4e--make-bookmark-record () "Create a bookmark for the message at point." (let* ((msg (mu4e-message-at-point)) - (subject (or (plist-get msg :subject) "No subject")) - (date (plist-get msg :date)) - (date (if date (format-time-string "%F: " date) "")) - (title (format "%s%s" date subject)) - (msgid (or (plist-get msg :message-id) - (mu4e-error "Cannot bookmark message without message-id")))) + (subject (or (plist-get msg :subject) "No subject")) + (date (plist-get msg :date)) + (date (if date (format-time-string "%F: " date) "")) + (title (format "%s%s" date subject)) + (msgid (or (plist-get msg :message-id) + (mu4e-error "Cannot bookmark message without message-id")))) `(,title ,@(bookmark-make-record-default 'no-file 'no-context) (message-id . ,msgid)