Skip to content

Instantly share code, notes, and snippets.

@aperezdc
Forked from anonymous/my-notmuch.el.el
Created October 29, 2012 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aperezdc/3973087 to your computer and use it in GitHub Desktop.
Save aperezdc/3973087 to your computer and use it in GitHub Desktop.
Notmuch misc config files
(require 'notmuch)
(require 'notmuch-address)
(notmuch-address-message-insinuate)
(setq notmuch-address-command "/home/aperez/.local/bin/notmuch-addrlookup")
(setq message-kill-buffer-on-exit t)
(setq mail-specify-envelope-from t)
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(add-hook 'message-setup-hook
'mml-secure-message-sign-pgpmime)
;;(add-hook 'message-setup-hook
;; '(lambda () (footnote-mode t)))
(define-key notmuch-search-mode-map "d"
(lambda ()
"toggle deleted tag for thread"
(interactive)
(if (member "deleted" (notmuch-search-get-tags))
(notmuch-search-tag "-deleted")
(notmuch-search-tag '("+deleted" "-inbox" "-unread")))))
(define-key notmuch-show-mode-map "d"
(lambda ()
"toggle deleted tag for message"
(interactive)
(if (member "deleted" (notmuch-show-get-tags))
(notmuch-show-tag "-deleted")
(notmuch-show-tag '("+deleted" "-inbox" "-unread")))))
(define-key notmuch-search-mode-map "j"
(lambda ()
"toggle the spam (junk) tag for thread"
(interactive)
(if (member "spam" (notmuch-search-get-tags))
(notmuch-search-tag "-spam")
(notmuch-search-tag '("+spam" "-ham" "-inbox" "-unread")))))
(define-key notmuch-show-mode-map "j"
(lambda ()
"toggle the spam (junk) tag for message"
(interactive)
(if (member "spam" (notmuch-show-get-tags))
(notmuch-show-tag "-spam")
(notmuch-show-tag '("+spam" "-ham" "-inbox" "-unread")))))
(define-key notmuch-search-mode-map "H"
(lambda ()
"toggle the ham tag for thread"
(interactive)
(if (member "ham" (notmuch-search-get-tags))
(notmuch-search-tag "-ham")
(notmuch-search-tag '("+ham" "-spam")))))
(define-key notmuch-show-mode-map "H"
(lambda ()
"toggle the ham tag for message"
(interactive)
(if (member "ham" (notmuch-show-get-tags))
(notmuch-show-tag "-ham")
(notmuch-show-tag '("+ham" "-ham")))))
(define-key notmuch-search-mode-map "F"
(lambda ()
"toggle the flagged tag for thread"
(interactive)
(if (member "flagged" (notmuch-search-get-tags))
(notmuch-search-tag "-flagged")
(notmuch-search-tag "+flagged"))))
(define-key notmuch-show-mode-map "F"
(lambda ()
"toggle the flagged tag for message"
(interactive)
(if (member "flagged" (notmuch-show-get-tags))
(notmuch-show-tag "-flagged")
(notmuch-show-tag "+flagged"))))
(define-key notmuch-search-mode-map "i"
(lambda ()
"toggle the ignore tag for thread"
(interactive)
(if (member "ignore" (notmuch-search-get-tags))
(notmuch-search-tag "-ignore")
(notmuch-search-tag '("+ignore" "-inbox" "-unread")))))
(define-key notmuch-show-mode-map "i"
(lambda ()
"toggle the ignore tag for message"
(interactive)
(if (member "ignore" (notmuch-show-get-tags))
(notmuch-show-tag "-ignore")
(notmuch-show-tag '("+ignore" "-inbox" "-unread")))))
#! /bin/bash
set -e
# Delete old Spam/ReSpam/ReHam messages
find ~/.mail/Spam.ReSpam/cur -type f -delete
find ~/.mail/Spam.ReHam/cur -type f -delete
notmuch new
# Keep ignored threads, er... ignored
notmuch search --output=threads \( tag:killed or tag:ignore \) \
| xargs -r notmuch tag +killed -unread -inbox --
# Now do some tagging
notmuch tag +notify -- tag:inbox and from:noreply@ or from:no-reply@
notmuch tag +fax -- tag:inbox and from:hylafax@
notmuch tag +log -inbox -- tag:inbox and from:logcheck@
notmuch tag +qsparql -- tag:inbox and to:qsparql-dev@projects.maemo.org
notmuch tag +gnome +ddl -- tag:inbox and to:desktop-devel-list@gnome.org
notmuch tag +lknewbies -- tag:inbox and to:kernelnewbies@kernelnewbies.org
notmuch tag +anaconda -- tag:inbox and to:anaconda-devel-list@redhat.com
notmuch tag +gnome +ostree -- tag:inbox and to:ostree-list@gnome.org
notmuch tag +gnome +os -- tag:inbox and to:gnome-os-list@gnome.org
notmuch tag +notmuch -- tag:inbox and to:notmuch@notmuchmail.org
notmuch tag +lua -- tag:inbox and to:lua-l@lists.lua.org
notmuch tag +webkit -- tag:inbox and to:webkit-dev@lists.webkit.org
notmuch tag +nginx -- tag:inbox and \( to:nginx@nginx.org or to:nginx-devel@nginx.org \)
# Completely get rid of the Nginx SVN commit logs in the mailing list
notmuch tag +deleted -inbox -unread \
-- tag:inbox and tag:nginx and 'subject:"[nginx] svn commit:"'
#! /bin/bash
set -e
# Move Spam messages to re-train spam directory
while read -r filename ; do
[[ -r ${filename} ]] || continue
safecat ~/.mail/Spam.ReSpam/{tmp,cur} < "${filename}"
rm "${filename}"
done < <( notmuch search --output=files tag:spam )
# Same, for ham
while read r filename ; do
[[ -r ${filename} ]] || continue
safecat ~/.mail/Spam.ReHam/{tmp,cur} < "${filename}"
rm "${filename}"
done < <( notmuch search --output=files tag:ham )
notmuch new
# Delete "deleted" files
notmuch search --output=files tag:deleted | xargs -r rm -f
# Update database with info of moved files
notmuch new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment