doomemacs/modules/email/mu4e/autoload/evil.el
Henrik Lissner ad6a3d0f33
refactor: deprecate featurep! for modulep!
featurep! will be renamed modulep! in the future, so it's been
deprecated. They have identical interfaces, and can be replaced without
issue.

featurep! was never quite the right name for this macro. It implied that
it had some connection to featurep, which it doesn't (only that it was
similar in purpose; still, Doom modules are not features). To undo such
implications and be consistent with its namespace (and since we're
heading into a storm of breaking changes with the v3 release anyway),
now was the best opportunity to begin the transition.
2022-08-14 20:43:35 +02:00

21 lines
894 B
EmacsLisp

;; email/mu4e/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (modulep! :editor evil)
;;;###autoload
(defun +mu4e/mark (&optional beg end)
"Mark all messages within the current selection in mu4e's header view. Uses
`this-command-keys' to see what flag you mean."
(interactive)
(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)))
(key (this-command-keys))
(command
(car (cl-find-if (lambda (mark) (equal (car (plist-get (cdr mark) :char)) key))
mu4e-marks))))
(unless command
(error "Not a valid mark command: %s" key))
(when (bound-and-true-p evil-mode)
(evil-normal-state))
(goto-char beg)
(dotimes (_ (count-lines beg end))
(mu4e-headers-mark-and-next command))))