An open API service indexing awesome lists of open source software.

https://github.com/bcardoso/notmuch-x

A set of custom extensions for notmuch-emacs
https://github.com/bcardoso/notmuch-x

emacs emacs-lisp extensions mail notmuch

Last synced: 2 months ago
JSON representation

A set of custom extensions for notmuch-emacs

Awesome Lists containing this project

README

        

#+AUTHOR: Bruno Cardoso
#+DATE: 2022-03-30
#+STARTUP: indent content

* notmuch-x

This package provides a set of custom extensions for the [[https://notmuchmail.org/][notmuch]] Emacs-based interface.

** Installation

Clone this repo and add it to your =load-path=:

#+begin_src emacs-lisp
(add-to-list 'load-path "/path/to/notmuch-x")
(require 'notmuch-x)
#+end_src

Or, with use-package + straight.el:

#+begin_src emacs-lisp
(use-package notmuch-x
:straight (notmuch-x :host github :repo "bcardoso/notmuch-x"))
#+end_src

** Usage

Start notmuch with =notmuch-x-run-notmuch=: it will enable both the =notmuch-x-auto-update-mode=, to periodically find and import any new messages, and the mode-line indicator =notmuch-x-indicator-mode=. The relevant customizable variables are accessible through the customize interface:

- =M-x customize-group RET notmuch-x=

** Example configuration

Below are my current =notmuch-x= configuration and keybindings.

#+begin_src emacs-lisp
(use-package notmuch-x
:straight (notmuch-x :host github :repo "bcardoso/notmuch-x")
:after notmuch
:bind (("C-c m" . notmuch-x-run-notmuch)
("C-c M" . notmuch-x-update-dwim)
("C-x m" . notmuch-mua-new-mail)
(:map notmuch-search-mode-map
("G" . notmuch-x-update-dwim)
("Q" . notmuch-x-kill-all-search-buffers)
("S" . notmuch-x-edit-current-search)
("U" . notmuch-unthreaded)
("u" . my/notmuch-tag-toggle-unread)
("f" . my/notmuch-tag-toggle-flagged)
("a" . my/notmuch-tag-archived)
("T" . my/notmuch-tag-todo)
("i" . my/notmuch-tag-inbox)
("d" . my/notmuch-tag-trash))
(:map notmuch-show-mode-map
("" . notmuch-x-toggle-thread-visibility)
("" . notmuch-x-toggle-message-or-browse-url)
("" . notmuch-x-next-button-or-link)
("" . notmuch-x-previous-button-or-link)
("n" . notmuch-show-next-message)
("N" . notmuch-show-next-open-message)
("p" . notmuch-show-previous-message)
("P" . notmuch-show-previous-open-message)
("o" . notmuch-x-view-part-in-browser)
("u" . my/notmuch-tag-toggle-unread)
("f" . my/notmuch-tag-toggle-flagged)
("a" . my/notmuch-tag-archived)
("T" . my/notmuch-tag-todo)
("i" . my/notmuch-tag-inbox)
("d" . my/notmuch-tag-trash)))
:config
;; Alternate format for notmuch-search fields
(setq notmuch-x-search-date-format "%F %R")
(setq notmuch-x-search-truncate-subject-width 68)
(notmuch-x-search-alt-format-mode +1)

(defun my/notmuch-tag-toggle-unread ()
"Toggle 'unread' tag."
(interactive)
(notmuch-x-tag-toggle "unread"))

(defun my/notmuch-tag-toggle-flagged ()
"Toggle 'flagged' tag."
(interactive)
(notmuch-x-tag-toggle "flagged"))

(defun my/notmuch-tag-archived ()
"Tag thread as 'archived'."
(interactive)
(notmuch-x-tag-thread '("+archived" "-inbox" "-todo" "-trash" "-unread") t))

(defun my/notmuch-tag-todo ()
"Tag selected message(s) as 'todo'."
(interactive)
(notmuch-x-tag '("+todo" "+inbox" "-archived" "-trash")))

(defun my/notmuch-tag-inbox ()
"Tag selected message(s) as 'inbox'."
(interactive)
(notmuch-x-tag '("+inbox" "-trash" "-archived")))

(defun my/notmuch-tag-trash ()
"Tag selected message(s) as 'trash'."
(interactive)
(notmuch-x-tag '("+trash" "-inbox" "-archived" "-todo" "-unread"))))
#+end_src