浏览代码

Use "try-completion" in ido-select-text advice

This adds a list-ditch search for an exact match to the current text
using "try-completion" when the collection is dynamic. This allows for
the possibility that a given collection does not return all
possibilities for "all-completions" bu knows how to check any string
for a match using "try-completion".

Fixes #129.
Ryan C. Thompson 8 年之前
父节点
当前提交
8e987d5cec
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      ido-completing-read+.el

+ 9 - 4
ido-completing-read+.el

@@ -757,12 +757,17 @@ This advice only activates if the current ido completion was
 called through ido-cr+."
   (if (and
        ;; Only override C-j behavior if...
-       ;; We're using ico-cr+
+       ;; We're using ico-cr+, and...
        (ido-cr+-active)
-       ;; Require-match is non-nil
+       ;; Require-match is non-nil, and...
        ido-require-match
-       ;; Current text is incomplete
-       (not (member ido-text ido-cur-list)))
+       ;; The current input doesn't exactly match a known option, and...
+       (not (member ido-text ido-cur-list))
+       ;; The current input doesn't exactly match an option according
+       ;; to `try-completion' (or the collection is not dynamic).
+       (or (not ido-cr+-dynamic-collection)
+           (eq t (try-completion ido-text ido-cr+-dynamic-collection
+                                 (nth 2 ido-cr+-orig-completing-read-args)))))
       (progn
         (ido-cr+--debug-message
          "Overriding C-j behavior for require-match: performing completion instead of exiting with current text. (This might still exit with a match if `ido-confirm-unique-completion' is nil)")