From ee6897094164cff4ea5fc56d7ae768830399c3bb Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 07:55:48 +0100 Subject: [PATCH 01/12] Ctrl-R to mark all as read --- muttrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/muttrc b/muttrc index e5e6d23..9478d8a 100644 --- a/muttrc +++ b/muttrc @@ -43,6 +43,9 @@ bind index,pager R group-reply macro index,pager S ' macro index,pager \Cu |urlview\n +#Ctrl-R to mark all as read +macro index \Cr "T~UN." "mark all messages as read" + # Notmuch searching macro index \Cf "unset wait_keyread -p 'notmuch query: ' x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;chomp@a;s/\^id:// for@a;$,=\"|\";print@a'\`\"" "show only messages matching a notmuch pattern" macro index A "all\n" "show all messages (undo limit)" From ea4b6f5374daf1e3705870c3c59bf5488e0045ca Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 08:05:28 +0100 Subject: [PATCH 02/12] sync email --- muttrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/muttrc b/muttrc index 9478d8a..6a7c108 100644 --- a/muttrc +++ b/muttrc @@ -46,6 +46,10 @@ macro index,pager \Cu |urlview\n #Ctrl-R to mark all as read macro index \Cr "T~UN." "mark all messages as read" +#sync email +macro index O "offlineimap" "run offlineimap to sync all mail" +macro index o "offlineimap -qf INBOX" "run offlineimap to sync inbox" + # Notmuch searching macro index \Cf "unset wait_keyread -p 'notmuch query: ' x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;chomp@a;s/\^id:// for@a;$,=\"|\";print@a'\`\"" "show only messages matching a notmuch pattern" macro index A "all\n" "show all messages (undo limit)" From a243f3ea49b1053dac46a961846d44d26aedbcf7 Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 08:08:13 +0100 Subject: [PATCH 03/12] copy / move dialog --- muttrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/muttrc b/muttrc index 6a7c108..54350ac 100644 --- a/muttrc +++ b/muttrc @@ -50,6 +50,10 @@ macro index \Cr "T~UN." "ma macro index O "offlineimap" "run offlineimap to sync all mail" macro index o "offlineimap -qf INBOX" "run offlineimap to sync inbox" +#copy/move dialogs +macro index C "?" "copy a message to a mailbox" +macro index M "?" "move a message to a mailbox" + # Notmuch searching macro index \Cf "unset wait_keyread -p 'notmuch query: ' x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;chomp@a;s/\^id:// for@a;$,=\"|\";print@a'\`\"" "show only messages matching a notmuch pattern" macro index A "all\n" "show all messages (undo limit)" From ad5bd4c00b08afcd1814dc4c0e21d5a44c589fae Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 08:20:05 +0100 Subject: [PATCH 04/12] delete & quit options - no confirm --- muttrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/muttrc b/muttrc index 54350ac..d54e34e 100644 --- a/muttrc +++ b/muttrc @@ -43,6 +43,9 @@ bind index,pager R group-reply macro index,pager S ' macro index,pager \Cu |urlview\n +set delete # don't ask, just do +set quit # don't ask, just do + #Ctrl-R to mark all as read macro index \Cr "T~UN." "mark all messages as read" From dfba96e57df5722c264a2ebbe2a53dbc04742efa Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 09:07:46 +0100 Subject: [PATCH 05/12] view attachment script --- muttrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/muttrc b/muttrc index d54e34e..c50cb0a 100644 --- a/muttrc +++ b/muttrc @@ -43,6 +43,9 @@ bind index,pager R group-reply macro index,pager S ' macro index,pager \Cu |urlview\n +# View attachments properly. +bind attach view-mailcap + set delete # don't ask, just do set quit # don't ask, just do From 6a9bed04615cdd58812c2929147e39aa643b1da9 Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 09:11:32 +0100 Subject: [PATCH 06/12] skip to compose when replying --- muttrc | 1 + 1 file changed, 1 insertion(+) diff --git a/muttrc b/muttrc index c50cb0a..cc3b2a0 100644 --- a/muttrc +++ b/muttrc @@ -48,6 +48,7 @@ bind attach view-mailcap set delete # don't ask, just do set quit # don't ask, just do +set fast_reply # skip to compose when replying #Ctrl-R to mark all as read macro index \Cr "T~UN." "mark all messages as read" From 708787a101132ad629a6d59aeaa9211688700a02 Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 09:13:30 +0100 Subject: [PATCH 07/12] show headers when composing --- muttrc | 1 + 1 file changed, 1 insertion(+) diff --git a/muttrc b/muttrc index cc3b2a0..f0b693b 100644 --- a/muttrc +++ b/muttrc @@ -49,6 +49,7 @@ bind attach view-mailcap set delete # don't ask, just do set quit # don't ask, just do set fast_reply # skip to compose when replying +set edit_headers # show headers when composing #Ctrl-R to mark all as read macro index \Cr "T~UN." "mark all messages as read" From a487d6b817a05cf9c77a92056923694a5b037f77 Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 09:14:26 +0100 Subject: [PATCH 08/12] ask for CC: --- muttrc | 1 + 1 file changed, 1 insertion(+) diff --git a/muttrc b/muttrc index f0b693b..7d6a49d 100644 --- a/muttrc +++ b/muttrc @@ -50,6 +50,7 @@ set delete # don't ask, just do set quit # don't ask, just do set fast_reply # skip to compose when replying set edit_headers # show headers when composing +set askcc # ask for CC: #Ctrl-R to mark all as read macro index \Cr "T~UN." "mark all messages as read" From 77b6b5b1a2907f3e070afbf525eadbbd802cdc38 Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 09:15:26 +0100 Subject: [PATCH 09/12] save attachments with the body --- muttrc | 1 + 1 file changed, 1 insertion(+) diff --git a/muttrc b/muttrc index 7d6a49d..b779505 100644 --- a/muttrc +++ b/muttrc @@ -51,6 +51,7 @@ set quit # don't ask, just do set fast_reply # skip to compose when replying set edit_headers # show headers when composing set askcc # ask for CC: +set fcc_attach # save attachments with the body #Ctrl-R to mark all as read macro index \Cr "T~UN." "mark all messages as read" From f51ba63e908722ee3d8cff24e78ba414c3f731f8 Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 09:17:30 +0100 Subject: [PATCH 10/12] mail forwarding features --- muttrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/muttrc b/muttrc index b779505..d5c9317 100644 --- a/muttrc +++ b/muttrc @@ -52,6 +52,11 @@ set fast_reply # skip to compose when replying set edit_headers # show headers when composing set askcc # ask for CC: set fcc_attach # save attachments with the body +unset mime_forward # forward attachments as part of body +set forward_format = "Fwd: %s" # format of subject when forwarding +set forward_decode # decode when forwarding +set forward_quote # include message in forwards + #Ctrl-R to mark all as read macro index \Cr "T~UN." "mark all messages as read" From b1dc41e80bbfb147966326164d5ac4627b384145 Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 09:18:27 +0100 Subject: [PATCH 11/12] reply whom ever / inc msg in replies --- muttrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/muttrc b/muttrc index d5c9317..62c1458 100644 --- a/muttrc +++ b/muttrc @@ -56,6 +56,8 @@ unset mime_forward # forward attachments as part of body set forward_format = "Fwd: %s" # format of subject when forwarding set forward_decode # decode when forwarding set forward_quote # include message in forwards +set reverse_name # reply as whomever it was to +set include # include message in replies #Ctrl-R to mark all as read From dd1bbf216f9fe73892760e39afa2b5c6333f7d76 Mon Sep 17 00:00:00 2001 From: ralphe Date: Mon, 19 Mar 2018 09:19:49 +0100 Subject: [PATCH 12/12] wiew_attchment.sh --- view_attachment.sh | 127 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100755 view_attachment.sh diff --git a/view_attachment.sh b/view_attachment.sh new file mode 100755 index 0000000..df8b9a1 --- /dev/null +++ b/view_attachment.sh @@ -0,0 +1,127 @@ +#!/bin/bash +# +# Author: Eric Gebhart +# +# Purpose: To be called by mutt as indicated by .mailcap to handle mail attachments. +# +# Function: Copy the given file to a temporary directory so mutt +# Won't delete it before it is read by the application. +# +# Along the way, discern the file type or use the type +# That is given. +# +# Finally use 'open' or 'open -a' if the third argument is +# given. +# +# +# Arguments: +# +# $1 is the file +# $2 is the type - for those times when file magic isn't enough. +# I frequently get html mail that has no extension +# and file can't figure out what it is. +# +# Set to '-' if you don't want the type to be discerned. +# Many applications can sniff out the type on their own. +# And they do a better job of it too. +# +# Open Office and MS Office for example. +# +# $3 is open with. as in open -a 'open with this .app' foo.xls +# +# Examples: These are typical .mailcap entries which use this program. +# +# Image/JPEG; /Users/vdanen/.mutt/view_attachment %s +# Image/PNG; /Users/vdanen/.mutt/view_attachment %s +# Image/GIF; /Users/vdanen/.mutt/view_attachment %s +# +# Application/PDF; /Users/vdanen/.mutt/view_attachment %s +# +# #This HTML example passes the type because file doesn't always work and +# #there aren't always extensions. +# +# text/html; /Users/vdanen/.mutt/view_attachment %s html +# +# # If your Start OpenOffice.org.app is spelled with a space like this one, <-- +# # then you'll need to precede the space with a \ . I found that too painful +# # and renamed it with an _. +# +# Application/vnd.ms-excel; /Users/vdanen/.mutt/view_attachment %s "-" '/Applications/OpenOffice.org1.1.2/Start_OpenOffice.org.app' +# Application/msword; /Users/vdanen/.mutt/view_attachment %s "-" '/Applications/OpenOffice.org1.1.2/Start_OpenOffice.org.app' +# +# +# Debugging: If you have problems set debug to 'yes'. That will cause a debug file +# be written to /tmp/mutt_attach/debug so you can see what is going on. +# +# See Also: The man pages for open, file, basename +# + +# the tmp directory to use. +tmpdir="$HOME/.tmp/mutt_attach" + +# the name of the debug file if debugging is turned on. +debug_file=$tmpdir/debug + +# debug. yes or no. +#debug="no" +debug="yes" + +type=$2 +open_with=$3 + +# make sure the tmpdir exists. +mkdir -p $tmpdir + +# clean it out. Remove this if you want the directory +# to accumulate attachment files. +rm -f $tmpdir/* + +# Mutt puts everything in /tmp by default. +# This gets the basic filename from the full pathname. +filename=`basename $1` + +# get rid of the extenson and save the name for later. +file=`echo $filename | cut -d"." -f1` + +if [ $debug = "yes" ]; then + echo "1:" $1 " 2:" $2 " 3:" $3 > $debug_file + echo "Filename:"$filename >> $debug_file + echo "File:"$file >> $debug_file + echo "===========================" >> $debug_file +fi + +# if the type is empty then try to figure it out. +if [ -z $type ]; then + file $1 + type=`file -bi $1 | cut -d"/" -f2` +fi + +# if the type is '-' then we don't want to mess with type. +# Otherwise we are rebuilding the name. Either from the +# type that was passed in or from the type we discerned. +if [ $type = "-" ]; then + newfile=$filename +else + newfile=$file.$type +fi + +newfile=$tmpdir/$newfile + +# Copy the file to our new spot so mutt can't delete it +# before the app has a chance to view it. +cp $1 $newfile + +if [ $debug = "yes" ]; then + echo "File:" $file "TYPE:" $type >> $debug_file + echo "Newfile:" $newfile >> $debug_file + echo "Open With:" $open_with >> $debug_file +fi + +# If there's no 'open with' then we can let preview do it's thing. +# Otherwise we've been told what to use. So do an open -a. + +if [ -z $open_with ]; then + open $newfile +else + open -a "$open_with" $newfile +fi