diff --git a/lisp/ido.el b/lisp/ido.el index e414408..803fa74 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3145,20 +3145,18 @@ If repeated, insert text from buffer instead." (defun ido-next-match () "Put first element of `ido-matches' at the end of the list." (interactive) - (if ido-matches - (let ((next (cadr ido-matches))) - (setq ido-cur-list (ido-chop ido-cur-list next)) - (setq ido-rescan t) - (setq ido-rotate t)))) + (when ido-matches + (setq ido-matches + (ido-chop ido-matches (cadr ido-matches))) + (setq ido-rotate t))) (defun ido-prev-match () "Put last element of `ido-matches' at the front of the list." (interactive) - (if ido-matches - (let ((prev (car (last ido-matches)))) - (setq ido-cur-list (ido-chop ido-cur-list prev)) - (setq ido-rescan t) - (setq ido-rotate t)))) + (when ido-matches + (setq ido-matches + (ido-chop ido-matches (car (last ido-matches)))) + (setq ido-rotate t))) (defun ido-next-match-dir () "Find next directory in match list. @@ -3177,7 +3175,8 @@ first matching file." (while (and (< i cnt) (not (ido-final-slash (nth i ido-matches)))) (setq i (1+ i))) (if (< i cnt) - (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches))))))) + (setq ido-matches (ido-chop ido-matches (nth i ido-matches)) + ido-rotate t))))) (defun ido-prev-match-dir () "Find previous directory in match list. @@ -3196,7 +3195,8 @@ for first matching file." (while (and (> i 0) (not (ido-final-slash (nth i ido-matches)))) (setq i (1- i))) (if (> i 0) - (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches))))))) + (setq ido-matches (ido-chop ido-matches (nth i ido-matches)) + ido-rotate t))))) (defun ido-restrict-to-matches () "Set current item list to the currently matched items." @@ -4494,8 +4494,10 @@ For details of keybindings, see `ido-find-file'." ;; Update the list of matches (setq ido-text contents) - (ido-set-matches) - (ido-trace "new " ido-matches) + (if ido-rotate + (setq ido-rotate nil) + (ido-set-matches) + (ido-trace "new " ido-matches)) (when (and ido-enter-matching-directory ido-matches