Permalink
Browse files

Now, when the first part of a jump specification, but the second part

does not succeed in finding a file, the next spec is tried instead of
short-circuiting the finding process.

In practice this means that when a specific search fails, the most
general of the searches will always be tried.
  • Loading branch information...
1 parent 8b12ea7 commit 34b6fb5c279a39977598178377e3882cb7e76c54 @eschulte committed Nov 17, 2008
Showing with 11 additions and 7 deletions.
  1. +11 −7 jump.el
View
18 jump.el
@@ -206,7 +206,7 @@ path). If path ends in / then just look in that directory"
(defun jump-to (spec &optional matches make)
"Jump to a spot defined by SPEC. If optional argument MATCHES
replace all '\\n' portions of SPEC with the nth (1 indexed)
-element of MATCHES. If optiona argument MAKE, then create the
+element of MATCHES. If optional 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."
(if (functionp spec) (eval (list spec matches)) ;; custom function in spec
@@ -283,12 +283,16 @@ find the current method which defaults to `which-function'."
(car spec)) (cdr spec))
spec))
specs))
- until (setf matches (jump-from (car spec)))
- finally (cond
- ((equal t matches)
- (jump-to (cdr spec) nil (if create (quote ,make))))
- ((consp matches)
- (jump-to (cdr spec) matches (if create (quote ,make))))))))))
+ ;; don't stop until both the front and the back match
+ ;;
+ ;; the back should match if the user is presented with a list
+ ;; of files, or a single file is jumped to
+ until (and (setf matches (jump-from (car spec)))
+ (cond
+ ((equal t matches)
+ (jump-to (cdr spec) nil (if create (quote ,make))))
+ ((consp matches)
+ (jump-to (cdr spec) matches (if create (quote ,make)))))))))))
(provide 'jump)
;;; jump.el ends here

0 comments on commit 34b6fb5

Please sign in to comment.