diff --git a/dotfiles/mail.org b/dotfiles/mail.org index ee19d57..3951524 100644 --- a/dotfiles/mail.org +++ b/dotfiles/mail.org @@ -341,6 +341,8 @@ Documentation: bind generic,pager,editor,index noop bind generic,pager,editor,index noop + bind generic,pager,editor,index | noop + bind generic,pager,editor,index 1 noop bind generic,pager,editor,index 2 noop bind generic,pager,editor,index 3 noop @@ -650,6 +652,12 @@ Labels bind index,pager Y modify-labels #+END_SRC +*** Limit +#+begin_src conf + bind index L limit + macro index a all +#+end_src + *** Search #+begin_src conf bind generic,index,pager / search @@ -670,7 +678,7 @@ Labels macro attach W ~/Downloads/y "Save entry" #+end_src -*** Compose +*** TODO Compose #+BEGIN_SRC conf bind compose p postpone-message @@ -737,7 +745,7 @@ Use =urlview= to extract urls from the mail. macro attach,compose,index,pager \cw "\ :set my_tmp_pipe_decode=\$pipe_decode\n\ :set pipe_decode\n\ - |urlview\n\ + urlview\n\ :set pipe_decode=\$my_tmp_pipe_decode\n\ :unset my_tmp_pipe_decode\n" \ 'call urlview to extract URLs out of a message' @@ -751,6 +759,11 @@ Use =urlview= to extract urls from the mail. "mu find results" #+end_src +*** Link to Orgmode +#+begin_src conf + macro index,pager S "$HOME/scripts/mutt-save-org-link.py\n" +#+end_src + ** Colors *** Basic colors #+BEGIN_SRC conf @@ -1171,17 +1184,18 @@ First, tag the files you want to send using =t=, then =;= to apply the action on :END: #+begin_src bash if [ "$1" = "all" ]; then - command='mbsync --all' + arg='all' else - command='mbsync gmail-Home esrf-Home ulg-Home' + arg='' fi if [ $TMUX ]; then - tmux split -v -l 1 $command && tmux select-pane -U + tmux split -v -l 1 ~/scripts/checkmail.sh $arg && tmux select-pane -U else $command fi #+end_src + *** Openfile Scripts :PROPERTIES: :header-args: :tangle ~/.config/neomutt/bin/openfile.sh @@ -1302,3 +1316,31 @@ Libreoffice application/wordperfect; libreoffice --nologo --writer '%s'; copiousoutput text/rtf; libreoffice --nologo --writer '%s'; copiousoutput #+end_src +** Link mail to orgmode + :PROPERTIES: + :header-args: :tangle ~/scripts/mutt-save-org-link.py + :header-args+: :comments both :mkdirp yes + :header-args+: :shebang "#!/usr/bin/env python3" + :END: +#+begin_src python + import sys + import email + import subprocess + import urllib.parse + + # Parse the email from standard input + message_bytes = sys.stdin.buffer.read() + message = email.message_from_bytes(message_bytes) + + # Grab the relevant message headers + message_id = urllib.parse.quote(message['message-id'].strip()[1:-1]) + subject = message['subject'].replace('[', '{').replace(']', '}') + + # Ask emacsclient to save a link to the message + p = subprocess.Popen([ + 'emacsclient', + f'org-protocol://store-link?url=message://{message_id}&title={subject}' + ]) + + p.wait() +#+end_src