[neomutt-users] new users questions about virtual folders and searches

Béla Törös kalebris at gmail.com
Thu Mar 18 15:11:24 CET 2021


Hi list,


after a weekend spent with this I have came to conclude this issue
with the below script/macro to search for the emails with the same subject.

A few characters that are frequent in my inbox []# needs to be stripped
out as noemutt doesn't seem to handle it right neither was I able to escape it,
and it is very optimistic approach to the script:

get_subject_vbox.sh:
-------------------------
#!/bin/bash

while IFS= read -r LINE || [[ -n "$LINE" ]]; do
        subject=$(echo $LINE | egrep -e 'Subject: ' |sed -E
"s/^Subject: (.+)$/\1/;s/'/\\\\'/;s/\[/ /g;s/\]/ /g;s/#//g")
        if [[ ${#subject} -gt 0 ]]; then
                break;
        fi
done
echo unvirtual-mailboxes \"notmuchSearch\" > ~/.config/neomutt/subject_vbox
echo virtual-mailboxes \"notmuchSearch\"
\"notmuch://?query=subject:${subject}\"
>>~/.config/neomutt/subject_vbox
-------------------------

than comes the macro itself:

macro index s "<enter-command>unsetwait\_key<enter><pipe-message>~/.config/neomutt/get_subject_vbox.sh<enter>\
               <enter-command>setwait\_key<enter><enter-command>source~/.config/neomutt/subject_vbox<enter>\
               <change-vfolder>notmuchSearch<enter>"

For random searches it was pretty simple:
macro index \\\\ "<vfolder-from-query>"

I have tried to use the same vfolder-from-query command but I couldn't
get it to take input from a different
macro output, or use pipe-message in a meaningful way.

hope this helps some newbie at some point to find emails with the same
subject line in neomutt.


kind regards


More information about the neomutt-users mailing list