1. Ryan Wilcox
  2. dotfiles

Commits

Ryan Wilcox  committed 7bf9066

script so I can reference mail messages from my diary

  • Participants
  • Parent commits 0111ce7
  • Branches default

Comments (0)

Files changed (2)

File bin/mutt_construct_notmuch_reference_query.py

View file
  • Ignore whitespace
+#!/usr/bin/env python
+
+import sys
+import email.parser
+
+def parse_message(raw):
+	 message = email.parser.Parser().parsestr(raw, headersonly=True)
+	 return message.get("Message-ID")[1:-1], message.get("Subject")
+
+raw = sys.stdin.read()
+message_id, subject = parse_message(raw)
+
+print """> Subject: %s
+> REFERENCE: notmuch search --output=files id:%s""" % (subject, message_id)

File muttrc.sh

View file
  • Ignore whitespace
 
 macro index,pager g0 "<change-folder>=INBOX<enter>" "Go to inbox"
 macro index,pager ,e "<enter-command>unset wait_key<enter><pipe-message>bbedit -t 'message.mutt' --view-top --clean<enter><enter-command>set wait_key<enter>"
+macro index,pager ,m "<enter-command>unset wait_key<enter><pipe-message>python ~/bin/mutt_construct_notmuch_reference_query.py | pbcopy<enter><enter-command>set wait_key<enter>"
 macro index,pager ,h "<enter-command>unset wait_key<enter><pipe-message>python ~/bin/mutt_view_html.py<enter><enter-command>set wait_key<enter>"
 macro index,pager gt "<change-folder>=[Gmail]/Sent Mail<enter>" "Go to sent mail"
 
 
 
 # ################################ LABELS ##############################################
-set my_editor="~/bin/bb" 
+set my_editor="~/bin/bb"
 
 macro index y "<enter-command>set editor=\"~/bin/editlabel.pl edit\"\n\
 <tag-prefix><edit><next-undeleted>\
 <enter-command>set editor=\"$my_editor\"\n" "Clean labels"
 
 macro index YL "<enter-command>set editor=\"~/bin/editlabel.pl list\"\n\
-<tag-prefix><edit>\ <enter-command>set editor=\"$my_editor\"\n" "List labels" 
+<tag-prefix><edit>\ <enter-command>set editor=\"$my_editor\"\n" "List labels"
 
 macro index YQ "<limit>~y " "Limit view to label"
-macro index YY "<limit>all<enter>" "View all messages"
+macro index YY "<limit>all<enter>" "View all messages"