diff options
| author | Jack Jamison <jackqjamison@gmail.com> | 2026-07-05 01:19:30 -0400 |
|---|---|---|
| committer | Jack Jamison <jackqjamison@gmail.com> | 2026-07-05 01:19:30 -0400 |
| commit | bdf9a71ab7baa2b1de9abcfd5df1a9107a55d141 (patch) | |
| tree | c4524e6c41aa5107211103401dabfaefc81aa882 /.config/emacs/lisp/evil-collection/modes/notmuch | |
| parent | fe3984f541bd32bdfa418afb305b614176b55ca0 (diff) | |
add a bunch of emacs packages HELP
Diffstat (limited to '.config/emacs/lisp/evil-collection/modes/notmuch')
| -rw-r--r-- | .config/emacs/lisp/evil-collection/modes/notmuch/README.org | 142 | ||||
| -rw-r--r-- | .config/emacs/lisp/evil-collection/modes/notmuch/evil-collection-notmuch.el | 256 |
2 files changed, 398 insertions, 0 deletions
diff --git a/.config/emacs/lisp/evil-collection/modes/notmuch/README.org b/.config/emacs/lisp/evil-collection/modes/notmuch/README.org new file mode 100644 index 0000000..ea5fa4e --- /dev/null +++ b/.config/emacs/lisp/evil-collection/modes/notmuch/README.org @@ -0,0 +1,142 @@ +* notmuch + + Evil bindings for [[https://notmuchmail.org/][notmuch]]. + +** notmuch-common-keymap + + Inherited by all notmuch buffer maps. Single-letter commands are relocated + under the =g= prefix. + + | Command | Original | Evil | + |----------------------------------------+----------+-----------| + | =notmuch-help= | =?= | =g?= | + | =notmuch-bury-or-kill-this-buffer= | =q= | =q= | + | =notmuch-search= | =s= | =s= | + | =notmuch-tree= | =z= | =S= | + | =notmuch-mua-new-mail= | =m= | =C=, =cc= | + | =notmuch-refresh-this-buffer= | =g=, === | =gr= | + | =notmuch-refresh-all-buffers= | =M-== | =gA= | + | =notmuch-poll-and-refresh-this-buffer= | =G= | =gR= | + | =notmuch-jump-search= | =j= | =J= | + +** notmuch-show-mode-map + + | Command | Original | Evil | + |---------------------------------------------------------+-----------+-------------| + | =notmuch-show-next-open-message= | =n= | =gj= | + | =notmuch-show-previous-open-message= | =p= | =gk= | + | =notmuch-show-next-message= | =N= | =]]=, =C-j= | + | =notmuch-show-previous-message= | =P= | =[[=, =C-k= | + | =notmuch-show-next-thread-show= | =M-n= | =M-j= | + | =notmuch-show-previous-thread-show= | =M-p= | =M-k= | + | =notmuch-show-archive-message-then-next-or-next-thread= | =a= | =a= | + | =notmuch-show-archive-thread-then-next= | =A= | =A= | + | =notmuch-show-archive-thread-then-exit= | =X= | =X= | + | =notmuch-show-archive-message-then-next-or-exit= | =x= | =x= | + | =notmuch-show-reply-sender= | =r= | =cr= | + | =notmuch-show-reply= | =R= | =cR= | + | =notmuch-show-forward-message= | =f= | =cf= | + | =notmuch-show-filter-thread= | =l= | =S= | + | =notmuch-show-save-attachments= | =w= | =p= | + | =notmuch-show-toggle-visibility-headers= | =h= | =H= | + | =notmuch-tag-jump= | =k= | =K= | + | =notmuch-show-tag-all= | =*= | =*= | + | =notmuch-show-add-tag= | =+= | =+= | + | =notmuch-show-remove-tag= | =-= | =-= | + | =notmuch-show-toggle-message= | =RET= | =RET= | + | =notmuch-show-toggle-thread-indentation= | =<= | =<= | + | =notmuch-show-next-button= | =TAB= | =TAB= | + | =notmuch-show-previous-button= | =backtab= | =backtab= | + | =notmuch-show-pipe-message= | =\vert= | =\vert= | + | =notmuch-show-stash-map= | =c= | =ys= | + | =notmuch-show-part-map= | =.= | =.= | + | =notmuch-tree-from-show-current-query= | =Z= | =zv= | + | =goto-address-at-point= | n/a | =gd= | + | =evil-collection-notmuch-show-toggle-delete= | n/a | =d= | + | =evil-collection-notmuch-show-toggle-flagged= | n/a | === | + +** notmuch-tree-mode-map + + | Command | Original | Evil | + |--------------------------------------------------+----------+-----------| + | =notmuch-tree-next-matching-message= | =n= | =gj= | + | =notmuch-tree-prev-matching-message= | =p= | =gk= | + | =notmuch-tree-next-message= | =N= | =]]= | + | =notmuch-tree-prev-message= | =P= | =[[= | + | =notmuch-tree-next-thread= | =M-n= | =C-j= | + | =notmuch-tree-prev-thread= | =M-p= | =C-k= | + | =notmuch-tree-archive-message-then-next= | =a= | =a= | + | =notmuch-tree-archive-thread-then-next= | =A= | =A= | + | =notmuch-tree-archive-thread-then-exit= | =X= | (default) | + | =notmuch-tree-archive-message-then-next-or-exit= | =x= | (default) | + | =notmuch-show-reply-sender= | =r= | =cr= | + | =notmuch-show-reply= | =R= | =cR= | + | =notmuch-tree-filter= | =l= | (default) | + | =notmuch-tree-to-tree= | =z= | =s= | + | =notmuch-search-from-tree-current-query= | =S= | =zv= | + | =notmuch-show-save-attachments= | =w= | (default) | + | =notmuch-tag-jump= | =k= | =K= | + | =notmuch-tree-tag-thread= | =*= | =*= | + | =notmuch-tree-add-tag= | =+= | =+= | + | =notmuch-tree-remove-tag= | =-= | =-= | + | =notmuch-tree-show-message= | =RET= | =RET= | + | =notmuch-tree-resume-message= | =e= | =e= | + | =notmuch-show-pipe-message= | =\vert= | =\vert= | + | =evil-collection-notmuch-tree-toggle-delete= | n/a | =d= | + | =evil-collection-notmuch-tree-toggle-unread= | n/a | =!= | + | =evil-collection-notmuch-tree-toggle-flagged= | n/a | === | + +** notmuch-search-mode-map + + | Command | Original | Evil | + |-------------------------------------------------+----------+------------| + | =notmuch-search-next-thread= | =n= | =j= (evil) | + | =notmuch-search-previous-thread= | =p= | =k= (evil) | + | =notmuch-search-archive-thread= | =a= | =a= | + | =notmuch-search-reply-to-thread-sender= | =r= | =cr= | + | =notmuch-search-reply-to-thread= | =R= | =cR= | + | =notmuch-search-filter= | =l= | =S= | + | =notmuch-search-filter-by-tag= | =t= | =t= | + | =notmuch-search-toggle-order= | =o= | =o= | + | =notmuch-tag-jump= | =k= | =K= | + | =notmuch-search-tag-all= | =*= | =*= | + | =notmuch-search-add-tag= | =+= | =+= | + | =notmuch-search-remove-tag= | =-= | =-= | + | =notmuch-search-show-thread= | =RET= | =RET= | + | =notmuch-tree-from-search-current-query= | =Z= | =zv= | + | =notmuch-bury-or-kill-this-buffer= | =x= | =q= | + | =notmuch-search-stash-map= | =c= | =ys= | + | =compose-mail= | n/a | =cc= | + | =compose-mail-other-frame= | n/a | =cC= | + | =evil-collection-notmuch-search-toggle-delete= | n/a | =d= | + | =evil-collection-notmuch-search-toggle-unread= | n/a | =!= | + | =evil-collection-notmuch-search-toggle-flagged= | n/a | === | + +** notmuch-hello-mode-map + + | Command | Original | Evil | + |-------------------------------------+----------+------------------| + | =notmuch-version= | =v= | =g?= | + | =widget-forward= | =TAB= | =TAB= | + | =widget-backward= | =S-TAB= | =S-TAB=, =C-TAB= | + | =evil-collection-notmuch-hello-ret= | n/a | =RET= | + +** New commands + + | Command | Key | | + |-------------------------------------------------+-------+----------------------------------------------------------------| + | =evil-collection-notmuch-show-toggle-delete= | =d= | toggle =evil-collection-notmuch-delete-tag= on current message | + | =evil-collection-notmuch-tree-toggle-delete= | =d= | tree variant | + | =evil-collection-notmuch-search-toggle-delete= | =d= | search variant | + | =evil-collection-notmuch-show-toggle-flagged= | === | toggle =flagged= tag | + | =evil-collection-notmuch-tree-toggle-flagged= | === | | + | =evil-collection-notmuch-search-toggle-flagged= | === | | + | =evil-collection-notmuch-tree-toggle-unread= | =!= | toggle =unread= tag | + | =evil-collection-notmuch-search-toggle-unread= | =!= | | + | =evil-collection-notmuch-hello-ret= | =RET= | activate widget or button at point | + +** Customization + + | Variable | Default | Purpose | + |--------------------------------------+-------------+------------------------------------------------------------------| + | =evil-collection-notmuch-delete-tag= | ="deleted"= | Tag toggled by =d=. Set to ="trash"= for lieer/Gmail-style sync. | diff --git a/.config/emacs/lisp/evil-collection/modes/notmuch/evil-collection-notmuch.el b/.config/emacs/lisp/evil-collection/modes/notmuch/evil-collection-notmuch.el new file mode 100644 index 0000000..2256259 --- /dev/null +++ b/.config/emacs/lisp/evil-collection/modes/notmuch/evil-collection-notmuch.el @@ -0,0 +1,256 @@ +;;; evil-collection-notmuch.el --- Bindings for `notmuch' -*- lexical-binding: t -*- + +;; Copyright (C) 2017 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; Maintainer: James Nguyen <james@jojojames.com> +;; Pierre Neidhardt <mail@ambrevar.xyz> +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.1 +;; Package-Requires: ((emacs "26.3")) +;; Keywords: emacs, tools, evil + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for `notmuch'. + +;;; Code: +(require 'notmuch nil t) +(require 'evil-collection) + +(defcustom evil-collection-notmuch-delete-tag "deleted" + "Tag toggled by the delete bindings (`d') in notmuch modes. + +Defaults to \"deleted\" for backwards compatibility with the self-hosted +notmuch convention where a cron job removes files matching `tag:deleted'. + +Set to \"trash\" when syncing with services that map a Trash tag/label +back to the server (e.g. lieer/Gmail's TRASH label, or an IMAP setup +that moves trashed messages out of the inbox)." + :type 'string + :group 'evil-collection-notmuch) + +(declare-function notmuch-show-get-tags "notmuch-show") +(declare-function notmuch-show-tag "notmuch-show") +(declare-function notmuch-search-get-tags "notmuch") +(declare-function notmuch-search-tag "notmuch") +(declare-function notmuch-tree-tag "notmuch-tree") + +(declare-function widget-field-at "wid-edit") +(declare-function widget-field-activate "wid-edit") +(declare-function widget-button-press "wid-edit") + +;; Since all the other maps in `evil-collection-notmuch-maps` +;; have notmuch-common-keymap as parent +;; https://git.notmuchmail.org/git?p=notmuch;a=blob;f=emacs/notmuch-hello.el;h=fa31694ff0f79a7f2781849394390a673f75aade;hb=HEAD#l651 +;; +;; When `evil-collection-setup-hook` runs, if it changes keymaps +;; using a `dolist` over `evil-collection-notmuch-maps`, then a binding might +;; see 2 changes at once. To avoid that, notmuch-common-keymap is last +(defconst evil-collection-notmuch-maps '(notmuch-hello-mode-map + notmuch-show-mode-map + notmuch-show-part-map + notmuch-tree-mode-map + notmuch-search-mode-map + notmuch-search-stash-map + notmuch-common-keymap)) + +(defun evil-collection-notmuch-toggle-tag (tag mode &optional next-function) + "Toggle TAG tag for message in MODE." + (let ((get (intern (format "notmuch-%s-get-tags" mode))) + (set (intern (format "notmuch-%s-tag" mode))) + (next (or next-function (intern (format "notmuch-%s-next-message" mode))))) + (funcall set (list (concat (if (member tag (funcall get)) + "-" "+") + tag))) + (funcall next))) + +(defun evil-collection-notmuch-show-toggle-delete () + "Toggle `evil-collection-notmuch-delete-tag' for message." + (interactive) + (evil-collection-notmuch-toggle-tag evil-collection-notmuch-delete-tag "show")) + +(defun evil-collection-notmuch-tree-toggle-delete () + "Toggle `evil-collection-notmuch-delete-tag' for message." + (interactive) + (evil-collection-notmuch-toggle-tag evil-collection-notmuch-delete-tag "tree")) + +(defun evil-collection-notmuch-search-toggle-delete () + "Toggle `evil-collection-notmuch-delete-tag' for message." + (interactive) + (evil-collection-notmuch-toggle-tag evil-collection-notmuch-delete-tag "search" 'notmuch-search-next-thread)) + +(defun evil-collection-notmuch-tree-toggle-unread () + "Toggle unread tag for message." + (interactive) + (evil-collection-notmuch-toggle-tag "unread" "tree")) + +(defun evil-collection-notmuch-search-toggle-unread () + "Toggle unread tag for message." + (interactive) + (evil-collection-notmuch-toggle-tag "unread" "search" 'notmuch-search-next-thread)) + +(defun evil-collection-notmuch-show-toggle-flagged () + "Toggle flagged tag for message." + (interactive) + (evil-collection-notmuch-toggle-tag "flagged" "show")) + +(defun evil-collection-notmuch-tree-toggle-flagged () + "Toggle flagged tag for message." + (interactive) + (evil-collection-notmuch-toggle-tag "flagged" "tree")) + +(defun evil-collection-notmuch-search-toggle-flagged () + "Toggle flagged tag for message." + (interactive) + (evil-collection-notmuch-toggle-tag "flagged" "search" 'notmuch-search-next-thread)) + +(defun evil-collection-notmuch-hello-ret () + (interactive) + (if (widget-field-at (point)) + (call-interactively #'widget-field-activate) + (call-interactively #'widget-button-press))) + +;;;###autoload +(defun evil-collection-notmuch-setup () + "Set up `evil' bindings for `notmuch'." + (evil-collection-inhibit-insert-state 'notmuch-show-mode-map) + (evil-collection-inhibit-insert-state 'notmuch-search-mode-map) + (evil-collection-inhibit-insert-state 'notmuch-tree-mode-map) + + (evil-set-initial-state 'notmuch-show-mode 'normal) + (evil-set-initial-state 'notmuch-search-mode 'normal) + (evil-set-initial-state 'notmuch-hello-mode 'normal) + (evil-set-initial-state 'notmuch-tree-mode 'normal) + + (evil-collection-define-key 'normal 'notmuch-common-keymap + "g?" 'notmuch-help + "q" 'notmuch-bury-or-kill-this-buffer + "s" 'notmuch-search + "S" 'notmuch-tree + "C" 'notmuch-mua-new-mail ; like mu4e + "cc" 'notmuch-mua-new-mail ; like mu4e + "gr" 'notmuch-refresh-this-buffer + "gA" 'notmuch-refresh-all-buffers + "gR" 'notmuch-poll-and-refresh-this-buffer + "J" 'notmuch-jump-search) + + (evil-collection-define-key 'normal 'notmuch-hello-mode-map + "g?" 'notmuch-version + (kbd "TAB") 'widget-forward + (kbd "RET") 'evil-collection-notmuch-hello-ret + (kbd "S-TAB") 'widget-backward + (kbd "<C-tab>") 'widget-backward) + + (evil-collection-define-key 'normal 'notmuch-show-mode-map + "gd" 'goto-address-at-point + "p" 'notmuch-show-save-attachments ; like mu4e + "A" 'notmuch-show-archive-thread-then-next + "S" 'notmuch-show-filter-thread + "K" 'notmuch-tag-jump + "C" 'notmuch-mua-new-mail ; like mu4e + "cc" 'notmuch-mua-new-mail ; like mu4e + "cR" 'notmuch-show-reply + "cf" 'notmuch-show-forward-message + "X" 'notmuch-show-archive-thread-then-exit + "zv" 'notmuch-tree-from-show-current-query ; like mu4e-conversation + "<" 'notmuch-show-toggle-thread-indentation + "a" 'notmuch-show-archive-message-then-next-or-next-thread + "d" 'evil-collection-notmuch-show-toggle-delete + "=" 'evil-collection-notmuch-show-toggle-flagged + "H" 'notmuch-show-toggle-visibility-headers + "gj" 'notmuch-show-next-open-message + "gk" 'notmuch-show-previous-open-message + "]]" 'notmuch-show-next-message + "[[" 'notmuch-show-previous-message + (kbd "C-j") 'notmuch-show-next-message + (kbd "C-k") 'notmuch-show-previous-message + (kbd "M-j") 'notmuch-show-next-thread-show + (kbd "M-k") 'notmuch-show-previous-thread-show + "cr" 'notmuch-show-reply-sender + (kbd "x") 'notmuch-show-archive-message-then-next-or-exit + "|" 'notmuch-show-pipe-message + "*" 'notmuch-show-tag-all + "-" 'notmuch-show-remove-tag + "+" 'notmuch-show-add-tag + (kbd "TAB") 'notmuch-show-next-button + (kbd "<backtab>") 'notmuch-show-previous-button + (kbd "RET") 'notmuch-show-toggle-message + "." 'notmuch-show-part-map) + + (evil-collection-define-key 'normal 'notmuch-tree-mode-map + "g?" 'notmuch-help + "q" 'notmuch-tree-quit + "S" 'notmuch-tree-to-search + "C" 'notmuch-mua-new-mail ; like mu4e + "cc" 'notmuch-mua-new-mail ; like mu4e + "J" 'notmuch-jump-search + "zv" 'notmuch-search-from-tree-current-query ; like mu4e-conversation + "cr" 'notmuch-show-reply-sender ; like mu4e + "cR" 'notmuch-show-reply + "d" 'evil-collection-notmuch-tree-toggle-delete + "!" 'evil-collection-notmuch-tree-toggle-unread + "=" 'evil-collection-notmuch-tree-toggle-flagged + "K" 'notmuch-tag-jump + (kbd "RET") 'notmuch-tree-show-message + [mouse-1] 'notmuch-tree-show-message + "A" 'notmuch-tree-archive-thread-then-next + "a" 'notmuch-tree-archive-message-then-next + "s" 'notmuch-tree-to-tree + "gj" 'notmuch-tree-next-matching-message + "gk" 'notmuch-tree-prev-matching-message + "]]" 'notmuch-tree-next-message + "[[" 'notmuch-tree-prev-message + (kbd "C-k") 'notmuch-tree-prev-thread + (kbd "C-j") 'notmuch-tree-next-thread + "|" 'notmuch-show-pipe-message + "-" 'notmuch-tree-remove-tag + "+" 'notmuch-tree-add-tag + "*" 'notmuch-tree-tag-thread + "e" 'notmuch-tree-resume-message) + + (dolist (state '(normal visual)) + (evil-collection-define-key state 'notmuch-search-mode-map + "cC" 'compose-mail-other-frame + "J" 'notmuch-jump-search + "S" 'notmuch-search-filter + "K" 'notmuch-tag-jump + "o" 'notmuch-search-toggle-order + "zv" 'notmuch-tree-from-search-current-query + "*" 'notmuch-search-tag-all + "a" 'notmuch-search-archive-thread + "cc" 'compose-mail ; like mu4e + "d" 'evil-collection-notmuch-search-toggle-delete + "!" 'evil-collection-notmuch-search-toggle-unread + "=" 'evil-collection-notmuch-search-toggle-flagged + "q" 'notmuch-bury-or-kill-this-buffer + "cr" 'notmuch-search-reply-to-thread-sender + "cR" 'notmuch-search-reply-to-thread + "t" 'notmuch-search-filter-by-tag + [mouse-1] 'notmuch-search-show-thread + "-" 'notmuch-search-remove-tag + "+" 'notmuch-search-add-tag + (kbd "RET") 'notmuch-search-show-thread)) + + ;; ys + (evil-collection-define-operator-key 'yank 'notmuch-search-mode-map + "s" 'notmuch-search-stash-map) + + ;; ys + (evil-collection-define-operator-key 'yank 'notmuch-show-mode-map + "s" 'notmuch-show-stash-map)) + +(provide 'evil-collection-notmuch) +;;; evil-collection-notmuch.el ends here |
