]> git.notmuchmail.org Git - sup/blobdiff - lib/sup/modes/thread-index-mode.rb
keybindings: ; -> buffer-list-mode, b, B, +
[sup] / lib / sup / modes / thread-index-mode.rb
index 3dd049844284664aee2e8ae7a0317179ea240beb..0bce0dee002d4d78be9d72c515a8b0d007520fd2 100644 (file)
@@ -42,7 +42,7 @@ EOS
     k.add :toggle_tagged, "Tag/untag selected thread", 't'
     k.add :toggle_tagged_all, "Tag/untag all threads", 'T'
     k.add :tag_matching, "Tag matching threads", 'g'
-    k.add :apply_to_tagged, "Apply next command to all tagged threads", ';'
+    k.add :apply_to_tagged, "Apply next command to all tagged threads", '+'
     k.add :join_threads, "Force tagged threads to be joined into the same thread", '#'
   end
 
@@ -77,6 +77,7 @@ EOS
     end
   end
 
+  def unsaved?; dirty? end
   def lines; @text.length; end
   def [] i; @text[i]; end
   def contains_thread? t; @threads.include?(t) end
@@ -424,9 +425,14 @@ EOS
   end
 
   def tag_matching
-    query = BufferManager.ask :search, "tag threads matching: "
+    query = BufferManager.ask :search, "tag threads matching (regex): "
     return if query.nil? || query.empty?
-    query = /#{query}/i
+    query = begin
+      /#{query}/i
+    rescue RegexpError => e
+      BufferManager.flash "error interpreting '#{query}': #{e.message}"
+      return
+    end
     @mutex.synchronize { @threads.each { |t| @tags.tag t if thread_matches?(t, query) } }
     regen_text
   end
@@ -567,7 +573,7 @@ protected
   def add_or_unhide m
     @ts_mutex.synchronize do
       if (is_relevant?(m) || @ts.is_relevant?(m)) && !@ts.contains?(m)
-        @ts.load_thread_for_message m
+        @ts.load_thread_for_message m, @load_thread_opts
       end
 
       @hidden_threads.delete @ts.thread_for(m)
@@ -727,7 +733,6 @@ protected
       (t.labels - @hidden_labels).map { |label| [:label_color, "+#{label} "] } +
       [[:snippet_color, snippet]
     ]
-
   end
 
   def dirty?; @mutex.synchronize { (@hidden_threads.keys + @threads).any? { |t| t.dirty? } } end