2019-05-05 14:11:59 -04:00
|
|
|
;; email/mu4e/autoload/evil.el -*- lexical-binding: t; -*-
|
2022-08-12 20:29:19 +02:00
|
|
|
;;;###if (modulep! :editor evil)
|
2017-04-19 13:18:03 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
2019-05-05 14:11:59 -04:00
|
|
|
(defun +mu4e/mark (&optional beg end)
|
2017-04-19 13:18:03 -04:00
|
|
|
"Mark all messages within the current selection in mu4e's header view. Uses
|
|
|
|
`this-command-keys' to see what flag you mean."
|
|
|
|
(interactive)
|
2017-07-14 18:19:08 +02:00
|
|
|
(let* ((beg (or beg (and (region-active-p) evil-visual-beginning) (line-beginning-position)))
|
|
|
|
(end (or end (and (region-active-p) evil-visual-end) (line-end-position)))
|
2017-04-19 13:18:03 -04:00
|
|
|
(key (this-command-keys))
|
2017-06-08 11:47:56 +02:00
|
|
|
(command
|
|
|
|
(car (cl-find-if (lambda (mark) (equal (car (plist-get (cdr mark) :char)) key))
|
|
|
|
mu4e-marks))))
|
2017-04-19 13:18:03 -04:00
|
|
|
(unless command
|
|
|
|
(error "Not a valid mark command: %s" key))
|
2017-06-08 11:47:56 +02:00
|
|
|
(when (bound-and-true-p evil-mode)
|
2017-04-19 13:18:03 -04:00
|
|
|
(evil-normal-state))
|
|
|
|
(goto-char beg)
|
|
|
|
(dotimes (_ (count-lines beg end))
|
|
|
|
(mu4e-headers-mark-and-next command))))
|