]> git.cworth.org Git - sup/blobdiff - lib/sup/buffer.rb
Merge branch 'index-locking' into next
[sup] / lib / sup / buffer.rb
index dc0f001b5f26b2e28463f77ce29a0ad6df102612..ebc3587bb44ea547ce2ef665fdf893b10296e23e 100644 (file)
@@ -165,6 +165,15 @@ called at least once per keystroke, so excessive computation is discouraged.
 
 Variables: the same as status-bar-text hook.
 Return value: a string to be used as the terminal title.
+EOS
+
+  HookManager.register "extra-contact-addresses", <<EOS
+A list of extra addresses to propose for tab completion, etc. when the
+user is entering an email address. Can be plain email addresses or can
+be full "User Name <email@domain.tld>" entries.
+
+Variables: none
+Return value: an array of email address strings.
 EOS
 
   def initialize
@@ -263,11 +272,8 @@ EOS
         get_status_and_title @focus_buf # must be called outside of the ncurses lock
       end
 
-    if title && @in_x
-      ## http://rtfm.etla.org/xterm/ctlseq.html (see Operating System Controls)
-      print "\033]2;#{title}\07" # window
-      print "\033]0;#{title}\07" # icon title
-    end
+    ## http://rtfm.etla.org/xterm/ctlseq.html (see Operating System Controls)
+    print "\033]0;#{title}\07" if title && @in_x
 
     Ncurses.mutex.lock unless opts[:sync] == false
 
@@ -496,6 +502,7 @@ EOS
     contacts = ContactManager.contacts.map { |c| [ContactManager.alias_for(c), c.full_address, c.email] }
 
     completions = (recent + contacts).flatten.uniq.sort
+    completions += HookManager.run("extra-contact-addresses") || []
     answer = BufferManager.ask_many_emails_with_completions domain, question, completions, default
 
     if answer