[emacs][wip] adapt to evil-collection-notmuch bindings etc
[~bandali/configs] / init.org
index 6aebbf1..c7181f4 100644 (file)
--- a/init.org
+++ b/init.org
@@ -640,11 +640,20 @@ customizing it.
 (use-package evil
   :demand t
   :hook (view-mode . evil-motion-state)
 (use-package evil
   :demand t
   :hook (view-mode . evil-motion-state)
+  :init
+  (setq evil-want-integration nil)
   :config (evil-mode 1)
   (general-swap-key nil '(normal motion) ";" ":")
   (setq evil-want-visual-char-semi-exclusive t))
 #+end_src
 
   :config (evil-mode 1)
   (general-swap-key nil '(normal motion) ";" ":")
   (setq evil-want-visual-char-semi-exclusive t))
 #+end_src
 
+#+begin_src emacs-lisp
+(use-package evil-collection
+  :after evil
+  :config
+  (evil-collection-init))
+#+end_src
+
 #+begin_src emacs-lisp
 (use-package evil-escape
   :demand t
 #+begin_src emacs-lisp
 (use-package evil-escape
   :demand t
@@ -662,6 +671,13 @@ customizing it.
   (push #'minibufferp evil-escape-inhibit-functions))
 #+end_src
 
   (push #'minibufferp evil-escape-inhibit-functions))
 #+end_src
 
+#+begin_src emacs-lisp
+(use-package evil-magit
+  :after magit
+  :config
+  (evil-set-initial-state 'git-commit-mode 'insert))
+#+end_src
+
 #+begin_src emacs-lisp
 (use-package evil-org
   :hook (org-mode . evil-org-mode)
 #+begin_src emacs-lisp
 (use-package evil-org
   :hook (org-mode . evil-org-mode)
@@ -689,6 +705,8 @@ customizing it.
 
 #+begin_src emacs-lisp
 (amin--leader-keys
 
 #+begin_src emacs-lisp
 (amin--leader-keys
+ "/"  '(:ignore t :wk "search")
+
  "B"  '(:ignore t :wk "Borg")
  "BA" 'borg-activate
  "Ba" 'borg-assimilate
  "B"  '(:ignore t :wk "Borg")
  "BA" 'borg-activate
  "Ba" 'borg-assimilate
@@ -817,7 +835,8 @@ There's no way I could top that, so I won't attempt to.
 
 #+begin_src emacs-lisp
 (use-package swiper
 
 #+begin_src emacs-lisp
 (use-package swiper
-  :general (:states 'normal "/" 'swiper)
+  :general (:states '(normal motion) "/" 'swiper)
+  (amin--leader-keys "//" 'swiper)
   :bind (([remap isearch-forward]  . swiper)
          ([remap isearch-backward] . swiper)))
 #+end_src
   :bind (([remap isearch-forward]  . swiper)
          ([remap isearch-backward] . swiper)))
 #+end_src
@@ -1234,21 +1253,6 @@ Emacs package that displays available keybindings in popup
 
 See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
 
 
 See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
 
-#+begin_src emacs-lisp
-(defun amin/notmuch ()
-  "Delete other windows, then launch `notmuch'."
-  (interactive)
-  (require 'notmuch)
-  (delete-other-windows)
-  (notmuch))
-
-;; (map!
-;;  :leader
-;;  :desc "notmuch" :n "m" #'amin/notmuch
-;;  (:desc "search" :prefix "/"
-;;    :desc "notmuch" :n "m" #'counsel-notmuch))
-#+end_src
-
 #+begin_src emacs-lisp
 (defvar amin-maildir "~/mail")
 
 #+begin_src emacs-lisp
 (defvar amin-maildir "~/mail")
 
@@ -1289,8 +1293,15 @@ See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
   (setq mml-secure-openpgp-encrypt-to-self t
         mml-secure-openpgp-sign-with-sender t))
 
   (setq mml-secure-openpgp-encrypt-to-self t
         mml-secure-openpgp-sign-with-sender t))
 
+(defun amin/notmuch ()
+  "Delete other windows, then launch `notmuch'."
+  (interactive)
+  (delete-other-windows)
+  (notmuch))
+
 (use-package notmuch
   :general (amin--leader-keys "m" 'amin/notmuch)
 (use-package notmuch
   :general (amin--leader-keys "m" 'amin/notmuch)
+  :commands notmuch
   :config
   (setq notmuch-hello-sections
         '(notmuch-hello-insert-header
   :config
   (setq notmuch-hello-sections
         '(notmuch-hello-insert-header
@@ -1303,18 +1314,27 @@ See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
         '("Subject" "To" "Cc" "Date" "List-Id" "X-RT-Originator")
         notmuch-hello-thousands-separator ","
         notmuch-fcc-dirs
         '("Subject" "To" "Cc" "Date" "List-Id" "X-RT-Originator")
         notmuch-hello-thousands-separator ","
         notmuch-fcc-dirs
-        '(("amin@aminb.org"            . "amin/Sent")
-          ("amin@gnu.org"              . "gnu/Sent")
-          ("abandali@uwaterloo.ca"     . "\"uwaterloo/Sent Items\"")
-          ("mab@gnu.org"               . "gnu/Sent")
-          ("aminb@gnu.org"             . "gnu/Sent")
-          (".*"                        . "sent"))
+        '(("amin@aminb.org"        . "amin/Sent")
+          ("amin@gnu.org"          . "gnu/Sent")
+          ("abandali@uwaterloo.ca" . "\"uwaterloo/Sent Items\"")
+          ("mab@gnu.org"           . "gnu/Sent")
+          ("aminb@gnu.org"         . "gnu/Sent")
+          (".*"                    . "sent"))
         notmuch-search-result-format
         notmuch-search-result-format
-        '(("date" . "%12s ")
-          ("count" . "%-7s ")
+        '(("date"    . "%12s ")
+          ("count"   . "%-7s ")
           ("authors" . "%-40s ")
           ("subject" . "%s ")
           ("authors" . "%-40s ")
           ("subject" . "%s ")
-          ("tags" . "(%s)")))
+          ("tags"    . "(%s)"))
+        notmuch-saved-searches
+        '((:name "inbox"     :query "tag:inbox"     :key "i")
+          (:name "unread"    :query "tag:unread"    :key "u")
+          (:name "latest"    :query "tag:latest"    :key "l")
+          (:name "encrypted" :query "tag:encrypted" :key "e")
+          (:name "flagged"   :query "tag:flagged"   :key "f")
+          (:name "sent"      :query "tag:sent"      :key "s")
+          (:name "drafts"    :query "tag:draft"     :key "d")
+          (:name "all mail"  :query "*"             :key "a")))
   ;; (add-hook 'visual-fill-column-mode-hook
   ;;           (lambda ()
   ;;             (when (string= major-mode 'notmuch-message-mode)
   ;; (add-hook 'visual-fill-column-mode-hook
   ;;           (lambda ()
   ;;             (when (string= major-mode 'notmuch-message-mode)
@@ -1322,32 +1342,14 @@ See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
   ;; (set! :evil-state 'notmuch-message-mode 'insert)
   ;; (advice-add #'notmuch-bury-or-kill-this-buffer
   ;;             :override #'kill-this-buffer)
   ;; (set! :evil-state 'notmuch-message-mode 'insert)
   ;; (advice-add #'notmuch-bury-or-kill-this-buffer
   ;;             :override #'kill-this-buffer)
+  (evil-collection-define-key 'normal 'notmuch-common-keymap
+    "c" (lambda ()
+          "Compose new mail and prompt for sender"
+          (interactive)
+          (let ((current-prefix-arg t))
+            (call-interactively #'notmuch-mua-new-mail))))
   :bind
   :bind
-  (:map notmuch-hello-mode-map
-        ("g" . notmuch-poll-and-refresh-this-buffer)
-        ("u" . (lambda ()
-                 "Search for `unread' tagged messages"
-                 (interactive)
-                 (notmuch-hello-search "tag:unread")))
-        ("i" . (lambda ()
-                 "Search for `inbox' tagged messages"
-                 (interactive)
-                 (notmuch-hello-search "tag:inbox")))
-        ("l" . (lambda ()
-                 "Search for `latest' tagged messages"
-                 (interactive)
-                 (notmuch-hello-search "tag:latest")))
-        ("e" . (lambda ()
-                 "Search for `encrypted' tagged messages"
-                 (interactive)
-                 (notmuch-hello-search "tag:encrypted")))
-        ("M" . (lambda ()
-                 "Compose new mail and prompt for sender"
-                 (interactive)
-                 (let ((current-prefix-arg t))
-                   (call-interactively #'notmuch-mua-new-mail)))))
   (:map notmuch-search-mode-map
   (:map notmuch-search-mode-map
-        ("g" . notmuch-poll-and-refresh-this-buffer)
         ("k" . (lambda ()
                  "Mark message read"
                  (interactive)
         ("k" . (lambda ()
                  "Mark message read"
                  (interactive)
@@ -1377,8 +1379,8 @@ See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
                  (notmuch-tree-archive-thread))))
 )
 
                  (notmuch-tree-archive-thread))))
 )
 
-;; (use-package counsel-notmuch
-;;   :commands counsel-notmuch)
+(use-package counsel-notmuch
+  :general (amin--leader-keys "/m" 'counsel-notmuch))
 
 (after! notmuch-crypto
   (setq notmuch-crypto-process-mime t))
 
 (after! notmuch-crypto
   (setq notmuch-crypto-process-mime t))