exe/textbringer in textbringer-0.1.1 vs exe/textbringer in textbringer-0.1.2
- old
+ new
@@ -15,26 +15,40 @@
$VERBOSE = nil
Controller.current = Controller.new
Window.start do
- message("Type C-x C-c to exit Textbringer")
begin
load_user_config
ruby_mode
if ARGV.size > 0
ARGV.each do |arg|
find_file(arg)
end
end
+ if Buffer.dumped_buffers_exist?(CONFIG[:buffer_dump_dir])
+ Window.redisplay
+ if yes_or_no?("Dumped buffers found; restore them?")
+ buffers = Buffer.load_dumped_buffers(CONFIG[:buffer_dump_dir])
+ switch_to_buffer(buffers.last)
+ end
+ end
rescue Exception => e
handle_exception(e)
end
Window.redisplay
- trap(:CONT) do
- Window.redraw
+ begin
+ trap(:CONT) { Window.redraw }
+ rescue ArgumentError
end
- loop do
- Controller.current.command_loop(TOP_LEVEL_TAG)
- Window.redisplay
+ begin
+ loop do
+ Controller.current.command_loop(TOP_LEVEL_TAG)
+ Window.redisplay
+ end
+ rescue Exception => e
+ if !e.is_a?(SystemExit)
+ Buffer.dump_unsaved_buffers(CONFIG[:buffer_dump_dir])
+ end
+ raise
end
end