From 1697632becfa5137500d356355dae9f783b37136 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Mon, 25 Oct 2021 14:25:08 +0200 Subject: [PATCH] Change Gmail archive configuration --- mail.org | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/mail.org b/mail.org index 596adcb..f806d11 100644 --- a/mail.org +++ b/mail.org @@ -59,8 +59,8 @@ Channel gmail-Trash Far :gmail-remote:"[Gmail]/Trash" Near :gmail-local:Trash -Channel gmail-All -Far :gmail-remote:"[Gmail]/All Mail" +Channel gmail-Archive +Far :gmail-remote:"[Imap]/Archive" Near :gmail-local:Archive #+END_SRC @@ -75,12 +75,10 @@ Near :gmail-local: Patterns * Patterns !INBOX Patterns ![Gmail]* -Patterns !Archive Patterns !Drafts Patterns !Sent Mail Patterns !Trash -Patterns !Spam -Patterns !Starred +# Patterns ![Imap]/Archive #+END_SRC #+BEGIN_SRC conf @@ -661,6 +659,9 @@ bind generic,index,pager \Cy previous-line bind pager k previous-line bind pager j next-line +# Display mode information +bind pager i display-toggle-weed + bind index collapse-thread bind index,pager K previous-entry @@ -886,28 +887,30 @@ macro index,pager S "$HOME/.config/neomutt/bin/mutt-save-org-link. :header-args+: :comments both :mkdirp yes :header-args+: :shebang "#!/usr/bin/env python3" :END: + +https://orgmode.org/manual/The-capture-protocol.html#The-capture-protocol + #+begin_src python import sys import email +from email import policy import subprocess import urllib.parse # Parse the email from standard input message_bytes = sys.stdin.buffer.read() -message = email.message_from_bytes(message_bytes) +message = email.message_from_bytes(message_bytes, policy=policy.default) # Grab the relevant message headers -message_id = urllib.parse.quote(message['message-id'].strip()[1:-1]) -subject = message['subject'].replace('[', '{').replace(']', '}').replace('\n', ' ') -subject = (subject[:75] + '..') if len(subject) > 75 else subject +message_id = urllib.parse.quote(message['message-id'][1:-1]) +subject = message['subject'] +message_to = message['to'] # Ask emacsclient to save a link to the message -p = subprocess.Popen([ +subprocess.Popen([ 'emacsclient', - f'org-protocol://capture?template=pm&url={message_id}&title={subject}' + f'org-protocol://capture?template=ps&url={message_id}&title={subject}&body={message_to}' ]) - -p.wait() #+end_src ** Colors @@ -1017,10 +1020,11 @@ set from = "dehaeze.thomas@gmail.com" set sendmail = "~/.config/neomutt/bin/send_mail.sh gmail" # Other special folders. -set mbox = "+gmail/Archive" -unset record # Don't copy send message to Sent folder: Gmail does that for us +set mbox = "+gmail/Archive" # Archive Box set postponed = "+gmail/Drafts" +unset record # Don't copy send message to Sent folder: Gmail does that for us + set signature = "~/.config/neomutt/accounts/gmail.signature" macro index,pager d \ @@ -1412,8 +1416,12 @@ application/pdf; zathura %s & audio/*; /usr/bin/xdg-open %s; copiousoutput text/html; export DISPLAY=:0 && setsid qutebrowser %s; nametemplate=%s.html text/html; lynx -width ${COLUMNS:-80} -dump %s; nametemplate=%s.html; copiousoutput; -text/calendar; khal import --batch -a home %s && khal printics %s; copiousoutput; -application/ics; khal import --batch -a home %s && khal printics %s; copiousoutput; +#+END_SRC + +For calendar output, a personal =ics-add= script is used. +#+BEGIN_SRC conf +text/calendar; ics-add %s; copiousoutput; +application/ics; ics-add %s; copiousoutput; #+END_SRC Libreoffice