From 65233db29e1dcfb7a3c377903777cda47ca52538 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Wed, 2 Feb 2022 11:43:10 -0800 Subject: [PATCH] Evil keybindings for Mail and Feed Reader --- ha-email.org | 55 +++++++++++++++++++++++++++++++++++++++++++++- ha-feed-reader.org | 7 +++++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/ha-email.org b/ha-email.org index 3d44238..ea757cb 100644 --- a/ha-email.org +++ b/ha-email.org @@ -33,6 +33,7 @@ Next type ~s~ to view and organize mail I've never seen before. We need to keep - ~S~ :: spam ... so much goes here - ~P~ :: receipts go to this *Paper Trail*, which takes a *tag* as the name of the store - ~f~ :: mailing lists and other things that might be nice to read go to *The Feed* + ** Email Addresses The configuration files below expect email addresses (I store passwords and other encrypted information elsewhere). These email addresses are /hardly/ private, but I figured I would annoy any screenscraping spam-inducing crawlers out there, while still allowing others to follow my lead on configuring Emacs and Email. @@ -98,6 +99,12 @@ Next, we need some basic configuration settings and some global keybindings: "a n" '("new mail" . notmuch-retrieve-messages) "a m" '("read mail" . notmuch) "a c" '("compose mail" . notmuch-mua-new-mail)) + <> + (ha-mail-hello-leader + "u" '("new mail" . notmuch-retrieve-messages) + "m" '("read mail" . notmuch) + "c" '("compose" . notmuch-mua-new-mail) + "C" '("reply-later" . hey-notmuch-reply-later)) <> <>) #+END_SRC @@ -619,11 +626,40 @@ This means: (message "Noted! Reply Later: %s" email-string))) #+END_SRC ** Bucket Keybindings +In /Emacs/ mode, we can just call =define-key=, but since it starts in Evil state (and we may want to use Evil keybindings, let's create some local leaders: -A series of keybindings to quickly send messages to one of the pre-defined buckets. The =notmuch-show-mode= is the ... uhm +#+NAME: local-leader-keybindings +#+BEGIN_SRC emacs-lisp :tangle no + (general-create-definer ha-mail-hello-leader + :states '(normal visual motion) + :keymaps 'notmuch-hello-mode-map + :prefix "SPC m" + :global-prefix "" + :non-normal-prefix "S-SPC") + + (general-create-definer ha-mail-search-leader + :states '(normal visual motion) + :keymaps 'notmuch-search-mode-map + :prefix "SPC m" + :global-prefix "" + :non-normal-prefix "S-SPC") + + (general-create-definer ha-mail-show-leader + :states '(normal visual motion) + :keymaps 'notmuch-show-mode-map + :prefix "SPC m" + :global-prefix "" + :non-normal-prefix "S-SPC") +#+END_SRC + +A series of keybindings to quickly send messages to one of the pre-defined buckets. #+NAME: hey-show-keybindings #+BEGIN_SRC emacs-lisp :tangle no + (ha-mail-show-leader + "c" '("compose" . notmuch-mua-new-mail) + "C" '("reply-later" . hey-notmuch-reply-later)) + (define-key notmuch-show-mode-map (kbd "C") 'hey-notmuch-reply-later) #+END_SRC @@ -631,6 +667,23 @@ The bindings in =notmuch-search-mode= are available when looking at a list of me #+NAME: hey-search-keybindings #+BEGIN_SRC emacs-lisp :tangle no + (ha-mail-search-leader + "r" '("reply" . notmuch-search-reply-to-thread) + "R" '("reply-all" . notmuch-search-reply-to-thread-sender) + "/" '("search" . notmuch-search-filter) + "A" '("archive all" . hey-notmuch-archive-all) + "D" '("delete all" . hey-notmuch-delete-all) + "L" '("filter by from" . hey-notmuch-filter-by-from) + ";" '("search by from" . hey-notmuch-search-by-from) + "d" '("delete thread" . hey-notmuch-search-delete-and-archive-thread) + + "s" '("send to spam" . hey-notmuch-move-sender-to-spam) + "i" '("send to screened" . hey-notmuch-move-sender-to-screened) + "p" '("send to papertrail" . hey-notmuch-move-sender-to-papertrail) + "f" '("send to feed" . hey-notmuch-move-sender-to-thefeed) + "C" '("reply" . hey-notmuch-reply-later) + "c" '("compose" . notmuch-mua-new-mail)) + (define-key notmuch-search-mode-map (kbd "r") 'notmuch-search-reply-to-thread) (define-key notmuch-search-mode-map (kbd "R") 'notmuch-search-reply-to-thread-sender) (define-key notmuch-search-mode-map (kbd "/") 'notmuch-search-filter) diff --git a/ha-feed-reader.org b/ha-feed-reader.org index 361ee9a..d2b2b1e 100644 --- a/ha-feed-reader.org +++ b/ha-feed-reader.org @@ -37,7 +37,12 @@ While I would like to share the /status/ of my reads, so ... (use-package elfeed :config (setq elfeed-db-directory "~/dropbox/.elfeed/") - (evil-define-key 'normal elfeed-show-mode-map (kbd "q") 'delete-window) + (evil-define-key 'normal elfeed-show-mode-map (kbd "b") 'elfeed-show-visit) + (evil-define-key 'normal elfeed-show-mode-map (kbd "n") 'elfeed-show-next) + (evil-define-key 'normal elfeed-show-mode-map (kbd "p") 'elfeed-show-prev) + (evil-define-key 'normal elfeed-show-mode-map (kbd "y") 'elfeed-show-yank) + (evil-define-key 'normal elfeed-show-mode-map (kbd "q") 'evil-delete-buffer) + (evil-define-key 'normal elfeed-show-mode-map (kbd "Q") 'delete-window) (evil-define-key 'normal elfeed-search-mode-map (kbd "r") 'ha-elfeed-tag-unread) (evil-define-key 'normal elfeed-search-mode-map (kbd "R") 'elfeed-search-update--force)