bin/sup in sup-0.11 vs bin/sup in sup-0.12
- old
+ new
@@ -10,11 +10,11 @@
no_ncursesw = true
end
require 'fileutils'
require 'trollop'
-require "sup"; Redwood::check_library_version_against "0.11"
+require "sup"; Redwood::check_library_version_against "0.12"
if ENV['SUP_PROFILE']
require 'ruby-prof'
RubyProf.start
end
@@ -47,19 +47,20 @@
Executes at startup
No variables.
No return value.
EOS
-Redwood::HookManager.register "shutdown", <<EOS
+Redwood::HookManager.register "shutdown", <<EOS
Executes when sup is shutting down. May be run when sup is crashing,
so don\'t do anything too important. Run before the label, contacts,
and people are saved.
No variables.
No return value.
EOS
if $opts[:list_hooks]
+ Redwood.start
Redwood::HookManager.print_hooks
exit
end
Thread.abort_on_exception = true # make debugging possible
@@ -84,20 +85,19 @@
k.add :poll_unusual, "Poll for new messages from unusual sources", '{'
k.add :compose, "Compose new message", 'm', 'c'
k.add :nothing, "Do nothing", :ctrl_g
k.add :recall_draft, "Edit most recent draft message", 'R'
k.add :show_inbox, "Show the Inbox buffer", 'I'
+ k.add :clear_hooks, "Clear all hooks", 'H'
k.add :show_console, "Show the Console buffer", '~'
## Submap for less often used keybindings
k.add_multi "reload (c)olors, rerun (k)eybindings hook", 'O' do |kk|
kk.add :reload_colors, "Reload colors", 'c'
kk.add :run_keybindings_hook, "Rerun keybindings hook", 'k'
end
end
-
-Redwood::Keymap.run_hook global_keymap
## the following magic enables wide characters when used with a ruby
## ncurses.so that's been compiled against libncursesw. (note the w.) why
## this works, i have no idea. much like pretty much every aspect of
## dealing with curses. cargo cult programming at its best.
@@ -152,30 +152,10 @@
begin
Redwood::start
Index.load
Index.start_sync_worker unless $opts[:no_threads]
- if Redwood::SourceManager.sources.any? { |x| x.is_a? Redwood::MBox::SSHLoader }
- $stderr.puts <<EOS
-mbox+ssh sources are deprecated and will be removed in the next release.
-Running rsync in your before-poll hook is a good alternative.
-
-Press enter to continue.
-EOS
- $stdin.gets
- end
-
- if Redwood::SourceManager.sources.any? { |x| x.is_a? Redwood::IMAP }
- $stderr.puts <<EOS
-IMAP sources are deprecated and will be removed in the next release.
-Running offlineimap or fetchmail in your before-poll hook is a good alternative.
-
-Press enter to continue.
-EOS
- $stdin.gets
- end
-
$die = false
trap("TERM") { |x| $die = true }
trap("WINCH") { |x| BufferManager.sigwinch_happened! }
if(s = Redwood::SourceManager.source_for DraftManager.source_name)
@@ -190,10 +170,11 @@
else
Redwood::SourceManager.add_source SentManager.default_source
end
HookManager.run "startup"
+ Redwood::Keymap.run_hook global_keymap
debug "starting curses"
Redwood::Logger.remove_sink $stderr
start_cursing
@@ -316,10 +297,12 @@
end
when :search_unread
SearchResultsMode.spawn_from_query "is:unread"
when :list_labels
labels = LabelManager.all_labels.map { |l| LabelManager.string_for l }
+ labels = labels.each { |l| l.force_encoding 'UTF-8' if l.methods.include?(:encoding) }
+
user_label = bm.ask_with_completions :label, "Show threads with label (enter for listing): ", labels
unless user_label.nil?
if user_label.empty?
bm.spawn_unless_exists("Label list") { LabelListMode.new } if user_label && user_label.empty?
else
@@ -348,9 +331,11 @@
b, new = BufferManager.spawn_unless_exists("All drafts") { LabelSearchResultsMode.new [:draft] }
b.mode.load_threads :num => b.content_height if new
end
when :show_inbox
BufferManager.raise_to_front ibuf
+ when :clear_hooks
+ HookManager.clear
when :show_console
b, new = bm.spawn_unless_exists("Console", :system => true) { ConsoleMode.new }
b.mode.run
when :reload_colors
Colormap.reset