aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/dirlist.go7
-rw-r--r--app/dirtree.go6
-rw-r--r--commands/account/cf.go4
-rw-r--r--commands/account/mkdir.go2
-rw-r--r--commands/account/query.go3
-rw-r--r--commands/account/rmdir.go4
-rw-r--r--doc/aerc.1.scd6
-rw-r--r--worker/notmuch/worker.go2
-rw-r--r--worker/types/messages.go1
9 files changed, 21 insertions, 14 deletions
diff --git a/app/dirlist.go b/app/dirlist.go
index 1fc2dd63..7dff934c 100644
--- a/app/dirlist.go
+++ b/app/dirlist.go
@@ -24,7 +24,7 @@ type DirectoryLister interface {
Selected() string
Select(string)
- Open(string, string, time.Duration, func(types.WorkerMessage))
+ Open(string, string, time.Duration, func(types.WorkerMessage), bool)
Update(types.WorkerMessage)
List() []string
@@ -175,11 +175,11 @@ func (dirlist *DirectoryList) ExpandFolder() {
}
func (dirlist *DirectoryList) Select(name string) {
- dirlist.Open(name, "", dirlist.UiConfig(name).DirListDelay, nil)
+ dirlist.Open(name, "", dirlist.UiConfig(name).DirListDelay, nil, false)
}
func (dirlist *DirectoryList) Open(name string, query string, delay time.Duration,
- cb func(types.WorkerMessage),
+ cb func(types.WorkerMessage), force bool,
) {
dirlist.selecting = name
@@ -194,6 +194,7 @@ func (dirlist *DirectoryList) Open(name string, query string, delay time.Duratio
Context: ctx,
Directory: name,
Query: query,
+ Force: force,
},
func(msg types.WorkerMessage) {
switch msg := msg.(type) {
diff --git a/app/dirtree.go b/app/dirtree.go
index b735dacd..a7d0a5e7 100644
--- a/app/dirtree.go
+++ b/app/dirtree.go
@@ -239,10 +239,10 @@ func (dt *DirectoryTree) Select(name string) {
if name == "" {
return
}
- dt.Open(name, "", dt.UiConfig(name).DirListDelay, nil)
+ dt.Open(name, "", dt.UiConfig(name).DirListDelay, nil, false)
}
-func (dt *DirectoryTree) Open(name string, query string, delay time.Duration, cb func(types.WorkerMessage)) {
+func (dt *DirectoryTree) Open(name string, query string, delay time.Duration, cb func(types.WorkerMessage), force bool) {
if name == "" {
return
}
@@ -263,7 +263,7 @@ func (dt *DirectoryTree) Open(name string, query string, delay time.Duration, cb
dt.buildTree()
dt.reindex(name)
}
- })
+ }, force)
}
func (dt *DirectoryTree) NextPrev(delta int) {
diff --git a/commands/account/cf.go b/commands/account/cf.go
index 8762f97f..199664fa 100644
--- a/commands/account/cf.go
+++ b/commands/account/cf.go
@@ -117,12 +117,12 @@ func (c ChangeFolder) Execute([]string) error {
if target == "-" {
if dir, ok := history[acct.Name()]; ok {
- acct.Directories().Open(dir, "", 0*time.Second, finalize)
+ acct.Directories().Open(dir, "", 0*time.Second, finalize, false)
} else {
return errors.New("No previous folder to return to")
}
} else {
- acct.Directories().Open(target, "", 0*time.Second, finalize)
+ acct.Directories().Open(target, "", 0*time.Second, finalize, false)
}
return nil
diff --git a/commands/account/mkdir.go b/commands/account/mkdir.go
index dae407cd..5ce7bbf4 100644
--- a/commands/account/mkdir.go
+++ b/commands/account/mkdir.go
@@ -53,7 +53,7 @@ func (m MakeDir) Execute(args []string) error {
case *types.Done:
app.PushStatus("Directory created.", 10*time.Second)
history[acct.Name()] = previous
- acct.Directories().Open(m.Folder, "", 0, nil)
+ acct.Directories().Open(m.Folder, "", 0, nil, false)
case *types.Error:
app.PushError(msg.Error.Error())
}
diff --git a/commands/account/query.go b/commands/account/query.go
index b82d0697..65b5e063 100644
--- a/commands/account/query.go
+++ b/commands/account/query.go
@@ -13,6 +13,7 @@ import (
type Query struct {
Account string `opt:"-a" complete:"CompleteAccount"`
Name string `opt:"-n"`
+ Force bool `opt:"-f"`
Query string `opt:"..." complete:"CompleteNotmuch"`
}
@@ -60,7 +61,7 @@ func (q Query) Execute([]string) error {
if name == "" {
name = q.Query
}
- acct.Directories().Open(name, q.Query, 0*time.Second, finalize)
+ acct.Directories().Open(name, q.Query, 0*time.Second, finalize, q.Force)
return nil
}
diff --git a/commands/account/rmdir.go b/commands/account/rmdir.go
index 22e78a69..b08a2a1e 100644
--- a/commands/account/rmdir.go
+++ b/commands/account/rmdir.go
@@ -89,7 +89,7 @@ func (r RemoveDir) Execute(args []string) error {
return errors.New("No directory to move to afterwards!")
}
- reopenCurrentDir := func() { acct.Directories().Open(curDir, "", 0, nil) }
+ reopenCurrentDir := func() { acct.Directories().Open(curDir, "", 0, nil, false) }
acct.Directories().Open(newDir, "", 0, func(msg types.WorkerMessage) {
switch msg.(type) {
@@ -117,7 +117,7 @@ func (r RemoveDir) Execute(args []string) error {
reopenCurrentDir()
}
})
- })
+ }, false)
return nil
}
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index 62129bff..1da6be3c 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -625,7 +625,7 @@ message list, the message in the message viewer, etc).
*:prev-result*
Selects the next or previous search result.
-*:query* [*-a* _<account>_] [*-n* _name_] _<notmuch query>_
+*:query* [*-a* _<account>_] [*-n* _name_] [*-f*] _<notmuch query>_
Create a virtual folder using the specified top-level notmuch query. This
command is exclusive to the notmuch backend.
@@ -637,6 +637,10 @@ message list, the message in the message viewer, etc).
Specify the display name for the virtual folder. If not provided,
_<notmuch query>_ is used as the display name.
+ *-f*
+ Load the query results into an already existing folder (messages
+ in the original folder are not deleted).
+
*:search* [_<options>_] _<terms>_...
Searches the current folder for messages matching the given set of
conditions. The search syntax is dependent on the underlying backend.
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index fe41446e..a36b44d4 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -365,7 +365,7 @@ func (w *worker) handleOpenDirectory(msg *types.OpenDirectory) error {
q, exists = w.dynamicNameQueryMap[msg.Directory]
}
}
- if !exists {
+ if !exists || msg.Force {
q = msg.Query
if q == "" {
q = msg.Directory
diff --git a/worker/types/messages.go b/worker/types/messages.go
index bbc430ca..9a2d43f8 100644
--- a/worker/types/messages.go
+++ b/worker/types/messages.go
@@ -102,6 +102,7 @@ type OpenDirectory struct {
Context context.Context
Directory string
Query string
+ Force bool
}
type FetchDirectoryContents struct {