From 55376c70d7bceca41cc63ec9a35d31e007581d9f Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Thu, 27 Apr 2017 18:51:18 +0200 Subject: [PATCH] bye sup, hi notmuch/alot --- config/alot/config | 30 +++++++++ config/alot/hooks.py | 16 +++++ local/bin/alot | 12 ++++ mailcap | 1 + notmuch-config | 98 ++++++++++++++++++++++++++++ notmuch-hooks/post-new | 8 +++ notmuch-hooks/pre-new | 2 + sup/.gitignore | 8 --- sup/config.yaml | 49 -------------- sup/hooks/after-poll.rb | 6 -- sup/hooks/before-poll.rb | 4 -- sup/hooks/crypto-mode.rb | 3 - sup/hooks/extra-contact-addresses.rb | 46 ------------- sup/hooks/goto.rb | 1 - sup/hooks/mime-decode.rb | 7 -- sup/sources.yaml | 53 --------------- 16 files changed, 167 insertions(+), 177 deletions(-) create mode 100644 config/alot/config create mode 100644 config/alot/hooks.py create mode 100755 local/bin/alot create mode 100644 mailcap create mode 100644 notmuch-config create mode 100755 notmuch-hooks/post-new create mode 100755 notmuch-hooks/pre-new delete mode 100644 sup/.gitignore delete mode 100644 sup/config.yaml delete mode 100644 sup/hooks/after-poll.rb delete mode 100644 sup/hooks/before-poll.rb delete mode 100644 sup/hooks/crypto-mode.rb delete mode 100755 sup/hooks/extra-contact-addresses.rb delete mode 100644 sup/hooks/goto.rb delete mode 100644 sup/hooks/mime-decode.rb delete mode 100644 sup/sources.yaml diff --git a/config/alot/config b/config/alot/config new file mode 100644 index 0000000..da118d3 --- /dev/null +++ b/config/alot/config @@ -0,0 +1,30 @@ + +initial_command = search tag:inbox OR tag:draft AND NOT tag:killed +periodic_hook_frequency = 60 + +[accounts] + + [[gmail]] + realname = Felix Van der Jeugt + address = felix.vanderjeugt@gmail.com + alias_regexp = felix\.vanderjeugt\+.+@gmail.com + sendmail_command = /usr/bin/msmtp --account=gmail -t + sent_box = maildir:///data/mail/gmail/Sent + draft_box = maildir:///data/mail/gmail/Sent + sent_tags = sent, gmail + sign_by_default = True + + [[ugent]] + realname = Felix Van der Jeugt + address = felix.vanderjeugt@ugent.be + aliases = Felix.VanderJeugt@UGent.be, + gpg_key = 68FF561137C38F9618E97339AF25A2C2862AA368 + sendmail_command = /usr/bin/msmtp --account=ugent -t + sent_box = maildir:///data/mail/ugent/Sent + draft_box = maildir:///data/mail/ugent/Sent + sent_tags = sent, ugent + sign_by_default = True + +[bindings] + + P = shellescape --thread True --refocus True notmuch\ new\ --quiet diff --git a/config/alot/hooks.py b/config/alot/hooks.py new file mode 100644 index 0000000..ae3456a --- /dev/null +++ b/config/alot/hooks.py @@ -0,0 +1,16 @@ + +from alot.commands.globals import ExternalCommand +from alot.commands.search import OpenThreadCommand + +def loop_hook(ui=None): + ui.apply_command(ExternalCommand( + ["notmuch", "new", "--quiet"], + thread=True, + )) + if ui and ui.current_buffer: + ui.update() + +def post_search_select(ui=None, dbm=None, cmd=None): + if isinstance(cmd, OpenThreadCommand): + cmd.thread.remove_tags({"unread"}) + diff --git a/local/bin/alot b/local/bin/alot new file mode 100755 index 0000000..ef76319 --- /dev/null +++ b/local/bin/alot @@ -0,0 +1,12 @@ +#!/usr/bin/python2 +# EASY-INSTALL-ENTRY-SCRIPT: 'alot==0.6.0.dev0','console_scripts','alot' +__requires__ = 'alot==0.6.0.dev0' +import re +import sys +from pkg_resources import load_entry_point + +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) + sys.exit( + load_entry_point('alot==0.6.0.dev0', 'console_scripts', 'alot')() + ) diff --git a/mailcap b/mailcap new file mode 100644 index 0000000..aeea68d --- /dev/null +++ b/mailcap @@ -0,0 +1 @@ +text/html; w3m -dump -o document_charset=%{charset} '%s'; nametemplate=%s.html; copiousoutput diff --git a/notmuch-config b/notmuch-config new file mode 100644 index 0000000..b78915f --- /dev/null +++ b/notmuch-config @@ -0,0 +1,98 @@ +# .notmuch-config - Configuration file for the notmuch mail system +# +# For more information about notmuch, see https://notmuchmail.org + +# Database configuration +# +# The only value supported here is 'path' which should be the top-level +# directory where your mail currently exists and to where mail will be +# delivered in the future. Files should be individual email messages. +# Notmuch will store its database within a sub-directory of the path +# configured here named ".notmuch". +# +[database] +path=/data/mail + +# User configuration +# +# Here is where you can let notmuch know how you would like to be +# addressed. Valid settings are +# +# name Your full name. +# primary_email Your primary email address. +# other_email A list (separated by ';') of other email addresses +# at which you receive email. +# +# Notmuch will use the various email addresses configured here when +# formatting replies. It will avoid including your own addresses in the +# recipient list of replies, and will set the From address based on the +# address to which the original email was addressed. +# +[user] +name=Felix Van der Jeugt +primary_email=felix.vanderjeugt@gmail.com +other_email=felix.vanderjeugt@ugent.be; + +# Configuration for "notmuch new" +# +# The following options are supported here: +# +# tags A list (separated by ';') of the tags that will be +# added to all messages incorporated by "notmuch new". +# +# ignore A list (separated by ';') of file and directory names +# that will not be searched for messages by "notmuch new". +# +# NOTE: *Every* file/directory that goes by one of those +# names will be ignored, independent of its depth/location +# in the mail store. +# +[new] +tags=unread;new; +ignore= + +# Search configuration +# +# The following option is supported here: +# +# exclude_tags +# A ;-separated list of tags that will be excluded from +# search results by default. Using an excluded tag in a +# query will override that exclusion. +# +[search] +exclude_tags=deleted;spam; + +# Maildir compatibility configuration +# +# The following option is supported here: +# +# synchronize_flags Valid values are true and false. +# +# If true, then the following maildir flags (in message filenames) +# will be synchronized with the corresponding notmuch tags: +# +# Flag Tag +# ---- ------- +# D draft +# F flagged +# P passed +# R replied +# S unread (added when 'S' flag is not present) +# +# The "notmuch new" command will notice flag changes in filenames +# and update tags, while the "notmuch tag" and "notmuch restore" +# commands will notice tag changes and update flags in filenames +# +[maildir] +synchronize_flags=true + +# Cryptography related configuration +# +# The following option is supported here: +# +# gpg_path +# binary name or full path to invoke gpg. +# +[crypto] +gpg_path=gpg2 diff --git a/notmuch-hooks/post-new b/notmuch-hooks/post-new new file mode 100755 index 0000000..831acfb --- /dev/null +++ b/notmuch-hooks/post-new @@ -0,0 +1,8 @@ +#!/bin/sh + +# notify for new messages +notmuch search tag:new | cut -d' ' --complement -f1 | xargs -0 --no-run-if-empty notify-send + +# finally, put new messages in the inbox +notmuch tag +inbox -new -- tag:new + diff --git a/notmuch-hooks/pre-new b/notmuch-hooks/pre-new new file mode 100755 index 0000000..79af665 --- /dev/null +++ b/notmuch-hooks/pre-new @@ -0,0 +1,2 @@ +#!/bin/sh +mbsync -qq ugent gmail diff --git a/sup/.gitignore b/sup/.gitignore deleted file mode 100644 index f535d1b..0000000 --- a/sup/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -lock -log -sent.mbox -sync-back-ok -xapian -contacts.txt -labels.txt -drafts diff --git a/sup/config.yaml b/sup/config.yaml deleted file mode 100644 index 1d99951..0000000 --- a/sup/config.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -:editor: nvim -:thread_by_subject: false -:edit_signature: false -:ask_for_from: false -:ask_for_to: true -:ask_for_cc: false -:ask_for_bcc: false -:ask_for_subject: true -:account_selector: true -:confirm_no_attachments: true -:confirm_top_posting: true -:jump_to_open_message: true -:discard_snippets_from_encrypted_messages: false -:load_more_threads_when_scrolling: true -:default_attachment_save_dir: '/data/temporary' -:sent_source: sup://sent -:archive_sent: true -:poll_interval: 300 -:wrap_width: 0 -:slip_rows: 0 -:col_jump: 2 -:stem_language: english -:sync_back_to_maildir: true -:continuous_scroll: true -:always_edit_async: false -:accounts: - :default: - :name: Felix Van der Jeugt - :email: felix.vanderjeugt@gmail.com - :alternates: [felixvdj@zeus.ugent.be] - :sendmail: "/usr/bin/msmtp --account=gmail -t --read-envelope-from" - :signature: "/home/felix/.signature" - :gpgkey: '' - :ugent: - :name: Felix Van der Jeugt - :email: felix.vanderjeugt@ugent.be - :alternates: [] - :sendmail: "/usr/bin/msmtp --account=ugent -t --read-envelope-from" - :signature: "/home/felix/.signature" - :gpgkey: '' - :12ul: - :name: Felix Van der Jeugt - :email: felix.vanderjeugt@12urenloop.be - :alternates: [] - :sendmail: "/usr/bin/msmtp --account=12ul -t --read-envelope-from" - :signature: "/home/felix/.signature" - :gpgkey: '' -:time_mode: 24h diff --git a/sup/hooks/after-poll.rb b/sup/hooks/after-poll.rb deleted file mode 100644 index 5fa40de..0000000 --- a/sup/hooks/after-poll.rb +++ /dev/null @@ -1,6 +0,0 @@ - -if num_inbox > 0 - system "notify-send", \ - "#{num_inbox_total_unread} unread messages (#{num_inbox} new)", \ - from_and_subj_inbox.map {|p| "#{p[0]} - #{p[1]}"}.join("\n") -end diff --git a/sup/hooks/before-poll.rb b/sup/hooks/before-poll.rb deleted file mode 100644 index 77995ef..0000000 --- a/sup/hooks/before-poll.rb +++ /dev/null @@ -1,4 +0,0 @@ -say "Running mbsync..." -if not system "mbsync", "-qq", "ugent", "gmail" - say "mbsync unsuccesful." -end diff --git a/sup/hooks/crypto-mode.rb b/sup/hooks/crypto-mode.rb deleted file mode 100644 index 75a87a2..0000000 --- a/sup/hooks/crypto-mode.rb +++ /dev/null @@ -1,3 +0,0 @@ - -crypto_selector.set_to :sign if crypto_selector.can_set_to? :sign - diff --git a/sup/hooks/extra-contact-addresses.rb b/sup/hooks/extra-contact-addresses.rb deleted file mode 100755 index e8356ca..0000000 --- a/sup/hooks/extra-contact-addresses.rb +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env ruby - -$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) - -require 'xapian' -require 'trollop' -require 'set' - -unless defined? BASE_DIR - BASE_DIR = ENV["SUP_BASE"] || File.join(ENV["HOME"], ".sup") -end - -xapian = Xapian::Database.new File.join(BASE_DIR, 'xapian') -version = xapian.get_metadata 'rescue-version' -version = '0' if version.empty? - -contacts = Hash.new { |key| Set.new } - -case version -when '0' - xapian.postlist('Kmail').each do |x| - entry = Marshal.load(xapian.document(x.docid).data) - ([entry[:from]] + entry[:to] + entry[:cc] + entry[:bcc]).compact.each do |email, name| - next if email.nil? - name = name.strip.chomp("'").chomp('"').reverse - .chomp("'").chomp('"').reverse unless name.nil? - email.downcase! - if name.nil? or email.include? name.downcase - contacts[email] = Set.new unless contacts.has_key? email - else - contacts[email] <<= name - end - end - end -else - abort "this sup-dump version doesn't understand your index" -end - -contacts.map do |email, names| - if names.empty? - email - else - names.map { |name| "#{name} <#{email}>" } - end -end.flatten - diff --git a/sup/hooks/goto.rb b/sup/hooks/goto.rb deleted file mode 100644 index cd58747..0000000 --- a/sup/hooks/goto.rb +++ /dev/null @@ -1 +0,0 @@ -system "xdg-open #{uri} > /dev/null" diff --git a/sup/hooks/mime-decode.rb b/sup/hooks/mime-decode.rb deleted file mode 100644 index ab06463..0000000 --- a/sup/hooks/mime-decode.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'shellwords' -unless sibling_types.member? "text/plain" - case content_type - when "text/html" - `/usr/bin/w3m -dump -T #{content_type} #{Shellwords.escape filename}` - end -end diff --git a/sup/sources.yaml b/sup/sources.yaml deleted file mode 100644 index db49808..0000000 --- a/sup/sources.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -- !supmua.org,2006-10-01/Redwood/Maildir - uri: maildir:/data/mail/gmail/Inbox - usual: true - archived: false - sync_back: true - id: 1 - labels: - - GMail -- !supmua.org,2006-10-01/Redwood/Maildir - uri: maildir:/data/mail/ugent/Inbox - usual: true - archived: false - sync_back: true - id: 3 - labels: - - UGent -- !supmua.org,2006-10-01/Redwood/Maildir - uri: maildir:/data/mail/12ul/Inbox - usual: true - archived: false - sync_back: true - id: 5 - labels: - - 12UL -- !supmua.org,2006-10-01/Redwood/Maildir - uri: maildir:/data/mail/gmail/Sent - usual: true - archived: true - sync_back: true - id: 2 - labels: - - GMail - - Sent -- !supmua.org,2006-10-01/Redwood/Maildir - uri: maildir:/data/mail/ugent/Sent - usual: true - archived: true - sync_back: true - id: 4 - labels: - - UGent - - Sent -- !supmua.org,2006-10-01/Redwood/Maildir - uri: maildir:/data/mail/12ul/Sent - usual: true - archived: true - sync_back: true - id: 6 - labels: - - 12UL - - Sent -- !supmua.org,2006-10-01/Redwood/SentLoader {}