Little mutt hack to toggle gtd tags via the custom email header field X-Label
After reading this (via @felixge) I started using this but disliked the amount of required keystrokes to actually do the tagging of single emails.
Wouldn't it be easier to simple toggle a fixed set of tags? Currently I only use "urgent", "todo", "review" and "waiting" for my email gtd.
Put the script x-label-toggler in your ~/bin
directory and modify ~/.muttrc
in the following way. (Note: If you place it into another directory than ~/bin
, modify the following configuration accordingly)
macro index <esc>w "<enter-command> set my_editor=\$editor<enter><enter-command> set editor=\"~/bin/x-label-toggler waiting\"<enter><edit><enter-command> set editor=\$my_editor<enter><clear-flag>N<enter><next-undeleted>" "Toggle label waiting"
macro index <esc>t "<enter-command> set my_editor=\$editor<enter><enter-command> set editor=\"~/bin/x-label-toggler todo\"<enter><edit><enter-command> set editor=\$my_editor<enter><clear-flag>N<enter><next-undeleted>" "Toggle label todo"
macro index <esc>u "<enter-command> set my_editor=\$editor<enter><enter-command> set editor=\"~/bin/x-label-toggler urgent\"<enter><edit><enter-command> set editor=\$my_editor<enter><clear-flag>N<enter><next-undeleted>" "Toggle label urgent"
macro index <esc>r "<enter-command> set my_editor=\$editor<enter><enter-command> set editor=\"~/bin/x-label-toggler review\"<enter><edit><enter-command> set editor=\$my_editor<enter><clear-flag>N<enter><next-undeleted>" "Toggle label review"
macro index \Cw "<limit>(~y waiting|~(~y waiting)|~N)!~D<enter><End>" "Limit view to tag waiting"
macro index \Ct "<limit>(~y todo|~(~y todo)|~N)!~D<enter><End>" "Limit view to tag todo"
macro index \Cu "<limit>(~y urgent|~(~y urgent)|~N)!~D<enter><End>" "Limit view to tag urgent"
macro index \Cr "<limit>(~y review|~(~y review)|~N)!~D<enter><End>" "Limit view to tag review"
macro index \Cd "<limit>!(~y review|~(~y review)|~y urgent|~(~y urgent)|~y waiting|~(~y waiting)|~y todo|~(~y todo))!~D<enter><End>" "Limit view to all untagged messages"
color index green default '~y waiting | ~(~y waiting)'
color index yellow default '~y review | ~(~y review)'
color index brightred default '~y todo | ~(~y todo)'
color index brightred default '~y urgent | ~(~y urgent)'
set index_format="%4C %Z %{%b %d} %-15.15L %?M?(#%03M)&(%4l)? %?y?(%.20Y) ?%s"
In mutt you hit <esc>w
to mark an email with the tag "waiting" and unmark it by hitting <esc>w
again. To limit your view to emails with tag "waiting" just hit <ctrl>w
. Use u
for "urgent", t
for "todo" and r
for "review". With <ctrl>d
you limit your view to all email threads that have no tags assigned.
Happy tagging