diff options
| author | Leo Liu | 2013-05-08 22:22:24 +0800 |
|---|---|---|
| committer | Leo Liu | 2013-05-08 22:22:24 +0800 |
| commit | ea78b95b03f94ea9675d7afdcc01c29d63e6a32a (patch) | |
| tree | a3b66d50fe23519c7516a22a6b7e5b4f5372d727 | |
| parent | 3a019ab4c304914f6a9e67b3c113e1853c95bb1a (diff) | |
| download | emacs-ea78b95b03f94ea9675d7afdcc01c29d63e6a32a.tar.gz emacs-ea78b95b03f94ea9675d7afdcc01c29d63e6a32a.zip | |
Re-work a fix for bug#10994 based on Le Wang's patch.
* ido.el (ido-remove-consecutive-dups): New helper.
(ido-completing-read): Use it.
(ido-chop): Revert fix for bug#10994.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/ido.el | 23 |
2 files changed, 25 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 76ae9231820..cd5d2f4ee61 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-05-08 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | Re-work a fix for bug#10994 based on Le Wang's patch. | ||
| 4 | * ido.el (ido-remove-consecutive-dups): New helper. | ||
| 5 | (ido-completing-read): Use it. | ||
| 6 | (ido-chop): Revert fix for bug#10994. | ||
| 7 | |||
| 1 | 2013-05-08 Adam Spiers <emacs@adamspiers.org> | 8 | 2013-05-08 Adam Spiers <emacs@adamspiers.org> |
| 2 | 9 | ||
| 3 | * cus-edit.el (custom-save-variables): | 10 | * cus-edit.el (custom-save-variables): |
diff --git a/lisp/ido.el b/lisp/ido.el index bedf00e638d..297e3258338 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -3152,15 +3152,13 @@ for first matching file." | |||
| 3152 | (exit-minibuffer))) | 3152 | (exit-minibuffer))) |
| 3153 | 3153 | ||
| 3154 | (defun ido-chop (items elem) | 3154 | (defun ido-chop (items elem) |
| 3155 | "Remove all elements before ELEM and put them at the end of ITEMS. | 3155 | "Remove all elements before ELEM and put them at the end of ITEMS." |
| 3156 | Use `eq' for comparison." | ||
| 3157 | (let ((ret nil) | 3156 | (let ((ret nil) |
| 3158 | (next nil) | 3157 | (next nil) |
| 3159 | (sofar nil)) | 3158 | (sofar nil)) |
| 3160 | (while (not ret) | 3159 | (while (not ret) |
| 3161 | (setq next (car items)) | 3160 | (setq next (car items)) |
| 3162 | ;; Use `eq' to avoid bug http://debbugs.gnu.org/10994 | 3161 | (if (equal next elem) |
| 3163 | (if (eq next elem) | ||
| 3164 | (setq ret (append items (nreverse sofar))) | 3162 | (setq ret (append items (nreverse sofar))) |
| 3165 | ;; else | 3163 | ;; else |
| 3166 | (progn | 3164 | (progn |
| @@ -4678,6 +4676,21 @@ For details of keybindings, see `ido-find-file'." | |||
| 4678 | ido-temp-list)))) | 4676 | ido-temp-list)))) |
| 4679 | (ido-to-end summaries))) | 4677 | (ido-to-end summaries))) |
| 4680 | 4678 | ||
| 4679 | (defun ido-remove-consecutive-dups (list) | ||
| 4680 | "Remove consecutive duplicates in LIST. | ||
| 4681 | Use `equal' for comparison. First and last elements are | ||
| 4682 | considered consecutive." | ||
| 4683 | (let ((tail list) | ||
| 4684 | (last (make-symbol "")) | ||
| 4685 | (result nil)) | ||
| 4686 | (while (consp tail) | ||
| 4687 | (unless (equal (car tail) last) | ||
| 4688 | (push (setq last (car tail)) result)) | ||
| 4689 | (setq tail (cdr tail))) | ||
| 4690 | (nreverse (or (and (equal last (car list)) | ||
| 4691 | (cdr result)) | ||
| 4692 | result)))) | ||
| 4693 | |||
| 4681 | ;;; Helper functions for other programs | 4694 | ;;; Helper functions for other programs |
| 4682 | 4695 | ||
| 4683 | (put 'dired-do-rename 'ido 'ignore) | 4696 | (put 'dired-do-rename 'ido 'ignore) |
| @@ -4795,7 +4808,7 @@ DEF, if non-nil, is the default value." | |||
| 4795 | (ido-directory-nonreadable nil) | 4808 | (ido-directory-nonreadable nil) |
| 4796 | (ido-directory-too-big nil) | 4809 | (ido-directory-too-big nil) |
| 4797 | (ido-context-switch-command 'ignore) | 4810 | (ido-context-switch-command 'ignore) |
| 4798 | (ido-choice-list choices)) | 4811 | (ido-choice-list (ido-remove-consecutive-dups choices))) |
| 4799 | ;; Initialize ido before invoking ido-read-internal | 4812 | ;; Initialize ido before invoking ido-read-internal |
| 4800 | (ido-common-initialization) | 4813 | (ido-common-initialization) |
| 4801 | (ido-read-internal 'list prompt hist def require-match initial-input))) | 4814 | (ido-read-internal 'list prompt hist def require-match initial-input))) |