<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -70,6 +70,18 @@
   &quot;\\(.*\\.\\(git\\|svn\\|cvs\\).*\\|.*~\\|.*\\#.*\\#\\)&quot;
   &quot;regexp for the find shell command to ignore undesirable files&quot;)
 
+(defun jump-completing-read (prompt choices &amp;optional predicate require-match initial-input hist def)
+  &quot;if `ido-mode' is turned on use ido speedups completing the read&quot;
+  (if ido-mode
+      (ido-completing-read prompt choices predicate require-match initial-input hist def)
+    (completing-read prompt choices predicate require-match initial-input hist def)))
+
+(defun jump-find-file-in-dir (dir)
+  &quot;if `ido-mode' is turned on use ido speedups finding the file&quot;
+  (if ido-mode
+      (ido-find-file-in-dir dir)
+    (let ((default-dir dir)) (find-file))))
+
 (defun jump-method ()
   &quot;Return the method defined at the current position in current
 buffer.&quot;
@@ -89,8 +101,8 @@ Return the path selected or nil if files was empty.&quot;
   (let ((file   (case (length files)
 		  (0 nil)
 		  (1 (caar files))
-		  (t (ido-completing-read &quot;Jump to: &quot;
-					  (mapcar 'car files))))))
+		  (t (jump-completing-read &quot;Jump to: &quot;
+					   (mapcar 'car files))))))
     (if file (find-file (cdr (assoc file files))))))
 
 (defun jump-remove-unwanted-files (files)
@@ -107,7 +119,7 @@ from all matches.&quot;
   (let ((file-cons (cons (file-name-nondirectory file) file))
 	file-alist)
     (if (string-match &quot;/$&quot; file) ;; TODO: ensure that the directory exists
-	(ido-find-file-in-dir (concat root &quot;/&quot; file)) ;; open directory
+	(jump-find-file-in-dir (concat root &quot;/&quot; file)) ;; open directory
       (if (file-exists-p file)
 	  (find-file file) ;; open file
 	(jump-select-and-find-file ;; open with regexp
@@ -148,13 +160,14 @@ path).  If path ends in / then just look in that directory&quot;
 	(when method (jump-to-method method) t))))
 
 (defun jump-insert-matches (spec matches)
+  (message (format &quot;%S&quot; (cons spec matches)))
   (if matches
       (let ((count 1) (new-spec spec) (spec nil))
 	(while (not (equal spec new-spec))
 	  (setf spec new-spec)
 	  (setf new-spec
 		(replace-regexp-in-string (format &quot;\\\\%d&quot; count)
-					  (nth (- count 1) matches)
+					  (or (nth (- count 1) matches) &quot;.*?&quot;)
 					  spec))
 	  (setf count (+ 1 count)))
 	new-spec) spec))
@@ -194,36 +207,36 @@ replace all '\\n' portions of SPEC with the nth (1 indexed)
 element of MATCHES.  If optiona argument MAKE, then create the
 target file if it doesn't exist, if MAKE is a function then use
 MAKE to create the target file.&quot;
-  (let ((path (jump-insert-matches spec matches)))
-    (unless (or (jump-to-path path) (and matches
-					 (jump-to-all-inflections spec matches)))
-      (progn (message (format &quot;no file found matching %s&quot; path)) nil)
-      (when make (message (format &quot;making %s&quot; path))
-	    (when (functionp make) (eval (list make path)))
-	    (find-file (concat root (if (string-match &quot;^\\(.*\\)#&quot; path)
-					(match-string 1 path)
-				      path)))))))
+  (if (functionp spec) (eval (list spec matches)) ;; custom function in spec
+    (let ((path (jump-insert-matches spec matches)))
+      (unless (or (jump-to-path path) (and matches
+					   (jump-to-all-inflections spec matches)))
+	(progn (message (format &quot;no file found matching %s&quot; path)) nil)
+	(when make (message (format &quot;making %s&quot; path))
+	      (when (functionp make) (eval (list make path)))
+	      (find-file (concat root (if (string-match &quot;^\\(.*\\)#&quot; path)
+					  (match-string 1 path)
+					path))))))))
 
 (defun jump-from (spec)
   &quot;Match SPEC to the current location returning a list of any matches&quot;
-  (cond
-   ((stringp spec)
-    (let* ((file (or (and (buffer-file-name)
-			  (expand-file-name (buffer-file-name)))
-		     (buffer-name)))
-	   (method (jump-method))
-	   (path (if (string-match &quot;#.+&quot; spec)
-		     (concat file &quot;#&quot; method)
-		   file)))
-      (and (string-match spec path)
-	   (or (let ((counter 1) mymatch matches)
-		 (while (setf mymatch (match-string counter path))
-		   (setf matches (cons mymatch matches))
-		   (setf counter (+ 1 counter)))
-		 (reverse matches))
-	       t))))
-   ((functionp spec) (eval spec))
-   ((equal t spec) t)))
+  (cond ((stringp spec)
+	 (let* ((file (or (and (buffer-file-name)
+			       (expand-file-name (buffer-file-name)))
+			  (buffer-name)))
+		(method (jump-method))
+		(path (if (string-match &quot;#.+&quot; spec)
+			  (concat file &quot;#&quot; method)
+			file)))
+	   (and (string-match spec path)
+		(or (let ((counter 1) mymatch matches)
+		      (while (setf mymatch (match-string counter path))
+			(setf matches (cons mymatch matches))
+			(setf counter (+ 1 counter)))
+		      (reverse matches)) t))))
+	((functionp spec) (eval (list spec)))
+	((equal t spec) t)
+	(t (message (format &quot;unrecognized jump-from specification format %s&quot;)))))
 
 (defun defjump (name specs root &amp;optional doc make method-command)
   &quot;Define NAME as a function with behavior determined by SPECS.</diff>
      <filename>jump.el</filename>
    </modified>
    <modified>
      <diff>@@ -95,30 +95,12 @@
 	      (apply 'jump-to-path-and-check el))
 	    jump-full-paths)))
 
-;; (deftest jump-to-path-test jump-suite
-;;   ;; test moving from everywhere to everywhere
-;;   (save-excursion
-;;     (unless (y-or-n-p &quot;allways select the first option ok? &quot;)
-;;       (error &quot;if you won't co-operate, I won't run these tests&quot;))
-;;     (cd &quot;./jump-fake-app&quot;)
-;;     (flet ((jump-root () &quot;~/projects/jump/test/jump-fake-app/&quot;)
-;; 	   (jump-method () (ruby-add-log-current-method))
-;; 	   (jumpit (path end)
-;; 		   ;; go there
-;; 		   (jump-to-path path)
-;; 		   ;; assert where there is
-;; 		   (message (format &quot;asserting at %S&quot; end))
-;; 		   (assert-equal (file-name-nondirectory (car end))
-;; 				 (file-name-nondirectory (buffer-file-name)))
-;; 		   (assert-equal (cdr end) (point))
-;; 		   ;; clean up
-;; 		   (kill-buffer (file-name-nondirectory (car end)))))
-;;       (jumpit &quot;animals/.*&quot; '(&quot;chicken.rb&quot; . 1))
-;;       (jumpit &quot;animals/pig.rb#stomach&quot; '(&quot;pig.rb&quot; . 28))
-;;       ;; - failing this test because it needs to start looking from the jump-root
-;;       ;; - also, needs to gracefully fail (return nil) when nothing matches the regexp
-;;       (jumpit &quot;.*pork.rb#cook_butt&quot; '(&quot;pork.rb&quot; . 69))
-;;       )))
+(deftest jump-from-function-test jump-suite
+  (message &quot;testing jumping from a function specification&quot;)
+  (assert-equal
+   (jump-from (lambda ()
+	       '(&quot;pork&quot;)))
+   '(&quot;pork&quot;)))
 
 ;;--------------------------------------------------------------------------------
 ;; run tests</diff>
      <filename>test/init.el</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>504b837719f6df99b4930e5d448904599b72ca5f</id>
    </parent>
  </parents>
  <author>
    <name>Eric Schulte</name>
    <email>schulte.eric@gmail.com</email>
  </author>
  <url>http://github.com/eschulte/jump.el/commit/f4f8852b6dac324811a142ff2c007e8661e4d968</url>
  <id>f4f8852b6dac324811a142ff2c007e8661e4d968</id>
  <committed-date>2008-08-23T11:33:07-07:00</committed-date>
  <authored-date>2008-08-23T11:33:07-07:00</authored-date>
  <message>accepts functions as specs, and more graceful degradation</message>
  <tree>f036e36943bdd2a8455854120b6b8424d3204ae7</tree>
  <committer>
    <name>Eric Schulte</name>
    <email>schulte.eric@gmail.com</email>
  </committer>
</commit>
