summaryrefslogtreecommitdiff
path: root/modes/mu4e
diff options
context:
space:
mode:
authorNicolas Wavrant <nicolas.wavrant@gmail.com>2023-07-12 14:20:04 +0900
committerYoumu <condy0919@gmail.com>2023-07-25 00:27:00 +0800
commit3983b6b520f7066bf5c3c6787ec4609024edf33a (patch)
tree3291e82a4595278566a595e7c3a859a1bb70d460 /modes/mu4e
parent163171c7ca32c8e6d1ab5b833924bac78c21d36a (diff)
mu4e: add support for visual actions in header view
Diffstat (limited to 'modes/mu4e')
-rw-r--r--modes/mu4e/evil-collection-mu4e-1.8.el31
-rw-r--r--modes/mu4e/evil-collection-mu4e.el31
2 files changed, 50 insertions, 12 deletions
diff --git a/modes/mu4e/evil-collection-mu4e-1.8.el b/modes/mu4e/evil-collection-mu4e-1.8.el
index d8b0327..8046674 100644
--- a/modes/mu4e/evil-collection-mu4e-1.8.el
+++ b/modes/mu4e/evil-collection-mu4e-1.8.el
@@ -125,7 +125,7 @@ with older release versions of `mu4e.'"
;;; Define bindings
;; TODO: Inhibit insert-state functions as per Evil Collection.
-(defvar evil-collection-mu4e-mode-map-bindings
+(defvar evil-collection-mu4e-mode-normal-map-bindings
`((mu4e-main-mode-map
"J" mu4e~headers-jump-to-maildir
"j" next-line
@@ -264,18 +264,37 @@ with older release versions of `mu4e.'"
(mu4e-headers-mark-thread nil '(read)))
,@(when evil-want-C-u-scroll
'("\C-u" evil-scroll-up))))
- "All evil-mu4e bindings.")
+ "All evil-mu4e bindings for evil normal mode.")
+
+ (defvar evil-collection-mu4e-mode-visual-map-bindings
+ `((mu4e-headers-mode-map
+ "*" mu4e-headers-mark-for-something
+ "A" mu4e-headers-mark-for-action
+ "m" mu4e-headers-mark-for-move
+ "r" mu4e-headers-mark-for-refile
+ "D" mu4e-headers-mark-for-delete
+ "d" mu4e-headers-mark-for-trash
+ "=" mu4e-headers-mark-for-untrash
+ "u" mu4e-headers-mark-for-unmark
+ "?" mu4e-headers-mark-for-unread
+ "!" mu4e-headers-mark-for-read
+ "+" mu4e-headers-mark-for-flag
+ "-" mu4e-headers-mark-for-unflag)
+
+ (mu4e-compose-mode-map
+ "gg" 'mu4e-compose-goto-top
+ "G" 'mu4e-compose-goto-bottom))
+ "All evil-mu4e bindings for evil visual mode.")
(defun evil-collection-mu4e-set-bindings ()
"Set the bindings."
;; WARNING: With lexical binding, lambdas from `mapc' and `dolist' become
;; closures in which we must use `evil-define-key*' instead of
;; `evil-define-key'.
- (dolist (binding evil-collection-mu4e-mode-map-bindings)
+ (dolist (binding evil-collection-mu4e-mode-normal-map-bindings)
(apply #'evil-collection-define-key 'normal binding))
- (evil-collection-define-key 'visual 'mu4e-compose-mode-map
- "gg" 'mu4e-compose-goto-top
- "G" 'mu4e-compose-goto-bottom)
+ (dolist (binding evil-collection-mu4e-mode-visual-map-bindings)
+ (apply #'evil-collection-define-key 'visual binding))
(evil-set-command-property 'mu4e-compose-goto-bottom :keep-visual t)
(evil-set-command-property 'mu4e-compose-goto-top :keep-visual t)
diff --git a/modes/mu4e/evil-collection-mu4e.el b/modes/mu4e/evil-collection-mu4e.el
index efab694..77b6143 100644
--- a/modes/mu4e/evil-collection-mu4e.el
+++ b/modes/mu4e/evil-collection-mu4e.el
@@ -110,7 +110,7 @@
(interactive)
(mu4e-headers-mark-thread nil '(read)))
- (defvar evil-collection-mu4e-mode-map-bindings
+ (defvar evil-collection-mu4e-mode-normal-map-bindings
`((mu4e-main-mode-map
"J" mu4e~headers-jump-to-maildir
"j" next-line
@@ -249,18 +249,37 @@
,(kbd "C-+") mu4e-headers-split-view-grow
,@(when evil-want-C-u-scroll
'("\C-u" evil-scroll-up))))
- "All evil-mu4e bindings.")
+ "All evil-mu4e bindings for evil normal mode.")
+
+ (defvar evil-collection-mu4e-mode-visual-map-bindings
+ `((mu4e-headers-mode-map
+ "*" mu4e-headers-mark-for-something
+ "A" mu4e-headers-mark-for-action
+ "m" mu4e-headers-mark-for-move
+ "r" mu4e-headers-mark-for-refile
+ "D" mu4e-headers-mark-for-delete
+ "d" mu4e-headers-mark-for-trash
+ "=" mu4e-headers-mark-for-untrash
+ "u" mu4e-headers-mark-for-unmark
+ "?" mu4e-headers-mark-for-unread
+ "!" mu4e-headers-mark-for-read
+ "+" mu4e-headers-mark-for-flag
+ "-" mu4e-headers-mark-for-unflag)
+
+ (mu4e-compose-mode-map
+ "gg" 'mu4e-compose-goto-top
+ "G" 'mu4e-compose-goto-bottom))
+ "All evil-mu4e bindings for evil visual mode.")
(defun evil-collection-mu4e-set-bindings ()
"Set the bindings."
;; WARNING: With lexical binding, lambdas from `mapc' and `dolist' become
;; closures in which we must use `evil-define-key*' instead of
;; `evil-define-key'.
- (dolist (binding evil-collection-mu4e-mode-map-bindings)
+ (dolist (binding evil-collection-mu4e-mode-normal-map-bindings)
(apply #'evil-collection-define-key 'normal binding))
- (evil-collection-define-key 'visual 'mu4e-compose-mode-map
- "gg" 'mu4e-compose-goto-top
- "G" 'mu4e-compose-goto-bottom)
+ (dolist (binding evil-collection-mu4e-mode-visual-map-bindings)
+ (apply #'evil-collection-define-key 'visual binding))
(evil-set-command-property 'mu4e-compose-goto-bottom :keep-visual t)
(evil-set-command-property 'mu4e-compose-goto-top :keep-visual t)