<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -36,5 +36,4 @@
 
   
 == TODO
- * 
- * Support 'alias_method'
\ No newline at end of file
+ * remove bookmark if not found file-line</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,33 +1,27 @@
 require File.dirname(__FILE__) + '/config'
-require &quot;yaml&quot;
+require File.dirname(__FILE__) + '/repository'
 require &quot;pp&quot;
 
-bookmark_file = EasyOpen::Config[:bookmark_file]
 file = ENV['TM_FILEPATH']
 line = ENV['TM_LINE_NUMBER']
 
-if File.exist?(bookmark_file)
-  bookmarks = File.open(bookmark_file) {|yf| YAML.load(yf)}
+begin
+  bookmarks = EasyOpen::BookmarkRepository.load
+rescue
 end
 bookmarks ||= []
 bookmarks.compact!
 
-selected = bookmarks.select{|node|
+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;
-  # puts &quot;file:#{file}&quot;
-  # puts &quot;line:#{line}&quot;
 else
   bookmarks.delete_if {|node|
     node[:file] == file and node[:line] == line
   }
   puts &quot;remove bookmark&quot;
-  # puts &quot;file:#{file}&quot;
-  # puts &quot;line:#{line}&quot;
 end
-File.open(bookmark_file,&quot;w&quot;) {|out|
-  YAML.dump(bookmarks, out)
-}
\ No newline at end of file
+EasyOpen::BookmarkRepository.save bookmarks</diff>
      <filename>Support/lib/easyopen/add_remove_bookmark.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,24 +1,26 @@
 require File.dirname(__FILE__) + '/ui'
 require File.dirname(__FILE__) + '/config'
-require &quot;yaml&quot;
+require File.dirname(__FILE__) + '/repository'
 
+file = ENV['TM_FILEPATH']
+line = ENV['TM_LINE_NUMBER']
 
-bookmark_file = EasyOpen::Config[:bookmark_file]
-unless File.exist?(bookmark_file)
-  puts &quot;Not found bookmark.file =&gt; #{bookmark_file}&quot;
-  exit
-end
-bookmarks = File.open(bookmark_file) {|ym|
-  YAML.load(ym)
-}
-include EasyOpen::UI
-bookmark=bookmarks.shift
+bookmarks = EasyOpen::BookmarkRepository.load
+
+bookmark = bookmarks.shift
 bookmarks &lt;&lt; bookmark
-File.open(bookmark_file, &quot;w&quot;) {|out|
-  YAML.dump(bookmarks, out)
-}
+if (file == bookmark[:file] and line == bookmark[:line]) 
+  bookmark = bookmarks.shift
+  bookmarks &lt;&lt; bookmark
+end
+
+
+EasyOpen::BookmarkRepository.save bookmarks 
+
 unless bookmark
   puts &quot;bookmark is nil&quot;
   exit
 end
+
+include EasyOpen::UI
 go_to(bookmark)
\ No newline at end of file</diff>
      <filename>Support/lib/easyopen/next_bookmark.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,24 +1,24 @@
 require File.dirname(__FILE__) + '/ui'
 require File.dirname(__FILE__) + '/config'
-require &quot;yaml&quot;
+require File.dirname(__FILE__) + '/repository'
 
-# TODO duplication code next_bookmark.rb
-bookmark_file = EasyOpen::Config[:bookmark_file]
-unless File.exist?(bookmark_file)
-  puts &quot;Not found bookmark.file =&gt; #{bookmark_file}&quot;
-  exit
-end
-bookmarks = File.open(bookmark_file) {|ym|
-  YAML.load(ym)
-}
-include EasyOpen::UI
-bookmark=bookmarks.pop
+file = ENV['TM_FILEPATH']
+line = ENV['TM_LINE_NUMBER']
+
+bookmarks = bookmarks = EasyOpen::BookmarkRepository.load
+
+bookmark = bookmarks.pop
 bookmarks.insert(0, bookmark)
-File.open(bookmark_file, &quot;w&quot;) {|out|
-  YAML.dump(bookmarks, out)
-}
+if (file == bookmark[:file] and line == bookmark[:line]) 
+  bookmark = bookmarks.pop
+  bookmarks.insert(0, bookmark)
+end
+
+EasyOpen::BookmarkRepository.save bookmarks 
 unless bookmark
   puts &quot;bookmark is nil&quot;
   exit
 end
+
+include EasyOpen::UI
 go_to(bookmark)
\ No newline at end of file</diff>
      <filename>Support/lib/easyopen/prev_bookmark.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,6 @@
 require File.dirname(__FILE__) + '/config'
+require &quot;yaml&quot;
+
 
 module EasyOpen
   class CallStackRepository
@@ -50,4 +52,23 @@ module EasyOpen
       end
     end
   end
+
+  class BookmarkRepository
+    class &lt;&lt; self
+      def save(bookmarks)
+        bookmark_file = EasyOpen::Config[:bookmark_file]
+        File.open(bookmark_file, &quot;w&quot;) {|out|
+          YAML.dump(bookmarks, out)
+        }
+      end
+      
+      def load
+        bookmark_file = EasyOpen::Config[:bookmark_file]
+        bookmarks = File.open(bookmark_file) {|ym|
+          YAML.load(ym)
+        }
+        return bookmarks
+      end
+    end
+  end
 end
\ No newline at end of file</diff>
      <filename>Support/lib/easyopen/repository.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b7b9ac5adb05f48228499769c5149d2d46e7eab1</id>
    </parent>
  </parents>
  <author>
    <name>haru01</name>
    <email>ienaga@ienaga-no-macbook.local</email>
  </author>
  <url>http://github.com/subtleGradient/easy-open-tmbundle/commit/3719f7892ca45df98cc4a2633968e0ea53a3560a</url>
  <id>3719f7892ca45df98cc4a2633968e0ea53a3560a</id>
  <committed-date>2009-03-06T22:34:48-08:00</committed-date>
  <authored-date>2009-03-06T22:34:48-08:00</authored-date>
  <message>&#20445;&#23384;&#12398;&#37096;&#20998;&#12398;&#31227;&#21205;&#12290;next prev&#12398;&#24494;&#35519;&#25972;</message>
  <tree>dd1d6f9154fd23a8332833c7d937315da09e63c5</tree>
  <committer>
    <name>haru01</name>
    <email>ienaga@ienaga-no-macbook.local</email>
  </committer>
</commit>
