about summary refs log tree commit diff stats
path: root/worker/notmuch/worker.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker/notmuch/worker.go')
-rw-r--r--worker/notmuch/worker.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 6300329..09b5d50 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -35,6 +35,7 @@ type worker struct {
 	query               string
 	currentQueryName    string
 	uidStore            *uidstore.Store
+	queryMapOrder       []string
 	nameQueryMap        map[string]string
 	db                  *notmuch.DB
 	setupErr            error
@@ -185,7 +186,7 @@ func (w *worker) handleConnect(msg *types.Connect) error {
 }
 
 func (w *worker) handleListDirectories(msg *types.ListDirectories) error {
-	for name := range w.nameQueryMap {
+	for _, name := range w.queryMapOrder {
 		w.w.PostMessage(&types.Directory{
 			Message: types.RespondTo(msg),
 			Dir: &models.Directory{
@@ -508,6 +509,7 @@ func (w *worker) loadQueryMap(acctConfig *config.AccountConfig) error {
 			return fmt.Errorf("%v: invalid line %q, want name=query", file, line)
 		}
 		w.nameQueryMap[split[0]] = split[1]
+		w.queryMapOrder = append(w.queryMapOrder, split[0])
 	}
 	return nil
 }