<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -7,6 +7,7 @@
 	&lt;key&gt;command&lt;/key&gt;
 	&lt;string&gt;#!/usr/bin/env ruby
 require ENV['TM_BUNDLE_SUPPORT'] + &quot;/lib/easyopen/next_bookmark&quot;
+next_bookmark
 &lt;/string&gt;
 	&lt;key&gt;input&lt;/key&gt;
 	&lt;string&gt;none&lt;/string&gt;</diff>
      <filename>Commands/next_bookmark.tmCommand</filename>
    </modified>
    <modified>
      <diff>@@ -16,10 +16,10 @@ selected = bookmarks.select{ |node|
   node[:file] == file and node[:line] == line
 }
 if (selected.empty?)
-  bookmarks.insert(0, { :file=&gt;file, :line=&gt;line })
+  bookmarks.insert(0, {:file=&gt;file, :line=&gt;line})
   puts &quot;add bookmark&quot;
 else
-  bookmarks.delete_if {|node|
+  bookmarks.delete_if { |node|
     node[:file] == file and node[:line] == line
   }
   puts &quot;remove bookmark&quot;</diff>
      <filename>Support/lib/easyopen/add_remove_bookmark.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,25 +2,34 @@ require File.dirname(__FILE__) + '/ui'
 require File.dirname(__FILE__) + '/config'
 require File.dirname(__FILE__) + '/repository'
 
-file = ENV['TM_FILEPATH']
-line = ENV['TM_LINE_NUMBER']
-
-bookmarks = EasyOpen::BookmarkRepository.load
-
-bookmark = bookmarks.shift
-bookmarks &lt;&lt; bookmark
-if (file == bookmark[:file] and line == bookmark[:line]) 
-  bookmark = bookmarks.shift
-  bookmarks &lt;&lt; bookmark
+def next_bookmark
+  bookmarks = EasyOpen::BookmarkRepository.load
+  exit_if_bookmarks_is_empty bookmarks
+  bookmarks = rotate_bookmarks(bookmarks)
+  EasyOpen::BookmarkRepository.save bookmarks 
+  include EasyOpen::UI
+  go_to(bookmarks.last)
 end
 
+def exit_if_bookmarks_is_empty bookmarks
+  if bookmarks.empty?
+    puts &quot;bookmarks is empty&quot;
+    exit
+  end
+end
 
-EasyOpen::BookmarkRepository.save bookmarks 
+def rotate_bookmarks(bookmarks)
 
-unless bookmark
-  puts &quot;bookmark is nil&quot;
-  exit
+  # TODO case &quot;not found bookmark[:file]&quot;
+  # TODO case &quot;found bookmark[:file], but not found bookmark[:line]&quot;
+  file = ENV['TM_FILEPATH']
+  line = ENV['TM_LINE_NUMBER']
+  bookmark = bookmarks.shift
+  bookmarks &lt;&lt; bookmark
+  if (file == bookmark[:file] and line == bookmark[:line]) 
+    bookmark = bookmarks.shift
+    bookmarks &lt;&lt; bookmark
+  end
+  return bookmarks
 end
 
-include EasyOpen::UI
-go_to(bookmark)
\ No newline at end of file</diff>
      <filename>Support/lib/easyopen/next_bookmark.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2207ae8cc151a2ac3ea9b8d7718bef1ac6beafb6</id>
    </parent>
  </parents>
  <author>
    <name>haru01</name>
    <email>ienaga@ienaga-no-macbook.local</email>
  </author>
  <url>http://github.com/haru01/easy-open-tmbundle/commit/5d9febda9b3ef693c692a6708674bb0ba3b6788c</url>
  <id>5d9febda9b3ef693c692a6708674bb0ba3b6788c</id>
  <committed-date>2009-03-22T02:14:41-07:00</committed-date>
  <authored-date>2009-03-22T02:14:41-07:00</authored-date>
  <message>refactoring next_bookmark</message>
  <tree>cf2e4338e5713aa2df33d3fa65033ff4dcdec36a</tree>
  <committer>
    <name>haru01</name>
    <email>ienaga@ienaga-no-macbook.local</email>
  </committer>
</commit>
