From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 2 Jan 2022 04:00:01 +0000 (-0500)
Subject: mutt: speed up folder_format a litte
X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=0623fe260b85d3d4fa334533620f1eae5da317f2;p=home.git

mutt: speed up folder_format a litte
---

diff --git a/.config/mutt/folder.sh b/.config/mutt/folder.sh
index 3676014..5102306 100755
--- a/.config/mutt/folder.sh
+++ b/.config/mutt/folder.sh
@@ -6,7 +6,7 @@ case ${folder} in
 #=*) echo "  ${folder}" | sed -r -e 's:^=::' -e 's:[.]([^/]*)[.]directory/:\1/:g' ;;
 =*)
 	printf '  '
-	echo "${folder}" | sed -r -e 's:^=::' -e 's:[.]([^/]*)[.]directory/:\1/:g' -e 's:[^/]*/(.):    \1:g'
+	echo "${folder}" | sed -E -e 's:^=::' -e 's:[.]([^/]*)[.]directory/:\1/:g' -e 's:[^/]*/(.):    \1:g'
 	;;
 *) echo "${folder}" ;;
 esac
diff --git a/.config/mutt/formatting.rc b/.config/mutt/formatting.rc
index 67e957b..6addceb 100644
--- a/.config/mutt/formatting.rc
+++ b/.config/mutt/formatting.rc
@@ -39,8 +39,11 @@ set date_format = "%d %b %Y %H:%M"
 # %u owner name		%>X right justify the rest and pad with "X"
 # %|X pad to the end of the line with character "X"
 #set folder_format="%3C %t %N %F %-8.8u %-8.8g %8s %d %f" # file browser menu
-set folder_format="%F  %d %8s   %f" # file browser menu
-set folder_format="sh -c '~/.config/mutt/folder.sh \"$@\"' -- '%f' '%F  %d %8s'|"
+#set folder_format="%F  %d %8s   %f" # file browser menu
+# Since folder_format is run through system(), avoid forking another process.
+# We need to use eval to use ; since mutt will chop the string at the first one
+# it sees that isn't quoted.
+set folder_format="eval \"set -- '%f' '%F  %d %8s'; . ~/.config/mutt/folder.sh\"|"
 
 # http://www.mutt.org/doc/devel/manual.html#index-format
 set index_format = "%Z%?M?»& ?%s %*  %B %-20.20n %D"