Skip to content
Browse files

• Do not fail miserably when shell variables are not setup. TM_TODO_M…

…ARKERS has to be set for the TODO list to work, otherwise show an error and point the user to the Help command. If a marker does not have a regexp set it is skipped. Colors default to grey and TM_TODO_MARKERS_TRIM to an empty array.

git-svn-id: dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information...
1 parent 82cbb5b commit c4bd0633638a6db26bd33bd065c43493cc28e720 @Soryu Soryu committed Jun 25, 2007
Showing with 13 additions and 2 deletions.
  1. +13 −2 Support/todo.rb
15 Support/todo.rb
@@ -11,7 +11,10 @@
+require "#{ENV['TM_SUPPORT_PATH']}/lib/web_preview"
+ puts html_head(:window_title => "TODO", :page_title => "TODO List", :sub_title => "Error")
puts <<-HTML
<p>Warning: Your project directory is the root directory!</p>
<p>This is problably because you have symbolic links or file references inside your project so that the most common directory of all the files in the project resolves to `/` (root).</p>
@@ -20,14 +23,21 @@
+if ENV['TM_TODO_MARKERS'].nil? then
+ puts html_head(:window_title => "TODO", :page_title => "TODO List", :sub_title => "Error")
+ puts <<-HTML
+<p>Your setup is incomplete. Please invoke the Help for this bundle and look up how to specify TODO markers via a Preferences item.</p>
require "#{ENV['TM_SUPPORT_PATH']}/lib/textmate"
-require "#{ENV['TM_SUPPORT_PATH']}/lib/web_preview"
require "erb"
require "yaml"
include ERB::Util
tag_names = ENV['TM_TODO_MARKERS'].split(",")
-tag_trim = ENV['TM_TODO_MARKERS_TRIM'].split(",")
+tag_trim = ENV['TM_TODO_MARKERS_TRIM'].nil? ? [] : ENV['TM_TODO_MARKERS_TRIM'].split(",")
trim_tags = []
tag_trim.each { |name|
@@ -38,6 +48,7 @@
tag_names.each { |name|
regexp = ENV["TM_TODO_#{name}_REGEXP"]
+ next if regexp.nil?
tags << {
:label => name,
:color => (ENV["TM_TODO_#{name}_COLOR"] or '#808080'),

0 comments on commit c4bd063

Please sign in to comment.
Something went wrong with that request. Please try again.