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.
This commit is contained in:
parent
3a019ab4c3
commit
ea78b95b03
2 changed files with 25 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-05-08 Leo Liu <sdl.web@gmail.com>
|
||||
|
||||
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.
|
||||
|
||||
2013-05-08 Adam Spiers <emacs@adamspiers.org>
|
||||
|
||||
* cus-edit.el (custom-save-variables):
|
||||
|
|
23
lisp/ido.el
23
lisp/ido.el
|
@ -3152,15 +3152,13 @@ for first matching file."
|
|||
(exit-minibuffer)))
|
||||
|
||||
(defun ido-chop (items elem)
|
||||
"Remove all elements before ELEM and put them at the end of ITEMS.
|
||||
Use `eq' for comparison."
|
||||
"Remove all elements before ELEM and put them at the end of ITEMS."
|
||||
(let ((ret nil)
|
||||
(next nil)
|
||||
(sofar nil))
|
||||
(while (not ret)
|
||||
(setq next (car items))
|
||||
;; Use `eq' to avoid bug http://debbugs.gnu.org/10994
|
||||
(if (eq next elem)
|
||||
(if (equal next elem)
|
||||
(setq ret (append items (nreverse sofar)))
|
||||
;; else
|
||||
(progn
|
||||
|
@ -4678,6 +4676,21 @@ For details of keybindings, see `ido-find-file'."
|
|||
ido-temp-list))))
|
||||
(ido-to-end summaries)))
|
||||
|
||||
(defun ido-remove-consecutive-dups (list)
|
||||
"Remove consecutive duplicates in LIST.
|
||||
Use `equal' for comparison. First and last elements are
|
||||
considered consecutive."
|
||||
(let ((tail list)
|
||||
(last (make-symbol ""))
|
||||
(result nil))
|
||||
(while (consp tail)
|
||||
(unless (equal (car tail) last)
|
||||
(push (setq last (car tail)) result))
|
||||
(setq tail (cdr tail)))
|
||||
(nreverse (or (and (equal last (car list))
|
||||
(cdr result))
|
||||
result))))
|
||||
|
||||
;;; Helper functions for other programs
|
||||
|
||||
(put 'dired-do-rename 'ido 'ignore)
|
||||
|
@ -4795,7 +4808,7 @@ DEF, if non-nil, is the default value."
|
|||
(ido-directory-nonreadable nil)
|
||||
(ido-directory-too-big nil)
|
||||
(ido-context-switch-command 'ignore)
|
||||
(ido-choice-list choices))
|
||||
(ido-choice-list (ido-remove-consecutive-dups choices)))
|
||||
;; Initialize ido before invoking ido-read-internal
|
||||
(ido-common-initialization)
|
||||
(ido-read-internal 'list prompt hist def require-match initial-input)))
|
||||
|
|
Loading…
Add table
Reference in a new issue