diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6864cd8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -language: generic -dist: trusty -sudo: false - -env: - matrix: - - EMACS_VERSION=emacs-24.4 - - EMACS_VERSION=emacs-24.5 - - EMACS_VERSION=emacs-25.1 - - EMACS_VERSION=emacs-25.2 - - EMACS_VERSION=emacs-25.3 - - EMACS_VERSION=emacs-26.1 - - EMACS_VERSION=emacs-git-snapshot - - EMACS_VERSION=remacs-git-snapshot - -matrix: - allow_failures: - - env: EMACS_VERSION=remacs-git-snapshot - - env: EMACS_VERSION=emacs-git-snapshot - -before_script: - # Install evm - - git clone https://github.com/rejeep/evm.git ~/.evm - - export PATH="$HOME/.evm/bin:$PATH" - - evm config path /tmp - - evm list - # use this version of emacs for tests - - evm install "${EMACS_VERSION}-travis" --use --skip - - evm list - - emacs --version - # Install cask - - curl -fsSkL https://raw.github.com/cask/cask/master/go | python - - export PATH="$HOME/.cask/bin:$PATH" - # Fix cask (See https://github.com/cask/cask/issues/399#issuecomment-331640427) - - perl -ibak -lape 's{#!/usr/bin/env python}{#!/usr/bin/python}' "$(which cask)" - # Check that cask is finding the right emacs - - cask emacs --version - # Install elisp dependencies - - cask install - -script: - - make compile - # Don't send redundant coverage info - - UNDERCOVER_CONFIG='((:send-report nil))' make test - # For some reason emacs-git-snapshot hangs forever on this step - - if [ "$EMACS_VERSION" != emacs-git-snapshot ]; then make test-with-flx; fi diff --git a/Cask b/Cask deleted file mode 100644 index c521b0e..0000000 --- a/Cask +++ /dev/null @@ -1,13 +0,0 @@ -(source gnu) -(source melpa) - -(package-file "ido-completing-read+.el") - -(depends-on "s") -(depends-on "memoize" "1.1") - -(development - (depends-on "flx-ido") - (depends-on "with-simulated-input" "2.2") - (depends-on "buttercup" "1.9") - (depends-on "undercover")) diff --git a/ChangeLog b/ChangeLog index f6c0a71..0bc86fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2021-03-30 Ryan C. Thompson + + * ido-completing-read+.el (ido-cr+-disable-list): Rename from + ido-cr+-function-blacklist. Related functions and variables are + likewise renamed. + (ido-cr+-allow-list): Rename from ido-cr+-function-whitelist. + Related functions and variables are likewise renamed. + +2021-02-06 Ryan C. Thompson + + * ido-completing-read+.el (ido-cr+-function-blacklist): Disable + ido completion in org-olpath-completing-read + * ido-completing-read+.el: General bug fixes + 2019-07-18 Ryan C. Thompson * ido-completing-read+.el (ido-completing-read+): Disable diff --git a/Eldev b/Eldev new file mode 100644 index 0000000..f70974d --- /dev/null +++ b/Eldev @@ -0,0 +1,21 @@ +;; -*- mode: emacs-lisp; lexical-binding: t; no-byte-compile: t -*- + +(setq eldev-main-fileset "./*.el") + +(eldev-use-plugin 'undercover) +(eldev-use-plugin 'autoloads) + +(eldev-use-package-archive 'gnu) +(eldev-use-package-archive 'melpa-unstable) + +(setq eldev-test-framework 'buttercup) + +(eldev-add-extra-dependencies + 'test + 'flx-ido + 's + '(:package with-simulated-input + :version "3.0")) + +;; Tell checkdoc not to demand two spaces after a period. +(setq sentence-end-double-space nil) diff --git a/Eldev-flx-ido b/Eldev-flx-ido new file mode 100644 index 0000000..1b54c38 --- /dev/null +++ b/Eldev-flx-ido @@ -0,0 +1,5 @@ +;; -*- mode: emacs-lisp; lexical-binding: t; no-byte-compile: t -*- + +;; This file is meant to be loaded with `eldev -S' to run the flx-ido +;; tests instead of the regular ones. +(setq eldev-test-fileset '("./tests-with-flx-ido/" "./tests/")) diff --git a/Makefile b/Makefile deleted file mode 100644 index 4d42e9b..0000000 --- a/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -ELISP_FILES := $(shell cask files) -ELC_FILES := $(patsubst %.el,%.elc,$(ELISP_FILES)) - -.PHONY: test compile clean -.INTERMEDIATE: .compile.intermediate - -all: test - -# We run clean-elc first because undercover.el doesn't support elc -# files. We run the tests first without loading flx-ido, and then with -# it. We only send the coverage report when running the full test -# suite. -test: clean - cask exec buttercup -L . tests - -test-with-flx: clean - cask exec buttercup -l tests/setup-undercover.el -L . tests tests-with-flx-ido - -all-tests: test test-with-flx - -compile: $(ELC_FILES) - -$(ELC_FILES): .compile.intermediate -.compile.intermediate: $(ELISP_FILES) - cask build - -clean: - cask clean-elc diff --git a/README.md b/README.md index 4a8fb43..2029649 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ [![MELPA Stable](https://stable.melpa.org/packages/ido-completing-read+-badge.svg)](https://stable.melpa.org/#/ido-completing-read%2B) [![Join the chat at https://gitter.im/DarwinAwardWinner/ido-ubiquitous](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/DarwinAwardWinner/ido-ubiquitous?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://travis-ci.org/DarwinAwardWinner/ido-completing-read-plus.svg?branch=master)](https://travis-ci.org/DarwinAwardWinner/ido-completing-read-plus) -[![Coverage Status](https://coveralls.io/repos/github/DarwinAwardWinner/ido-completing-read-plus/badge.svg?branch=master)](https://coveralls.io/github/DarwinAwardWinner/ido-completing-read-plus?branch=master) +[![Coverage Status](https://coveralls.io/repos/github/DarwinAwardWinner/ido-completing-read-plus/badge.svg?branch=main)](https://coveralls.io/github/DarwinAwardWinner/ido-completing-read-plus?branch=main) This package replaces stock emacs completion with ido completion wherever it is possible to do so without breaking things (i.e. what @@ -19,8 +18,8 @@ of both packages. The distinction between "new" and "old" default selection styles has been eliminated and replaced by a new variable `ido-cr+-nil-def-alternate-behavior-list` (see [FAQ][1] for details), -and the override system has been accordingly simplified into just a -blacklist and a whitelist. If you have previously customized any +and the override system has been accordingly simplified into just an +allow list and a disable list. If you have previously customized any ido-ubiquitous options, be sure to check out `M-x customize-group ido-completing-read+` @@ -44,44 +43,44 @@ ## Ido itself ## First, enable `ido-mode` and `ido-everywhere`. + ```elisp (ido-mode 1) (ido-everywhere 1) ``` + ## ido-completing-read+ (this package) ## -Install this package [from MELPA](http://melpa.org/#/ido-completing-read+) +Install this package [from MELPA](https://melpa.org/#/ido-completing-read+) and then turn on `ido-ubiquitous-mode`: + ```elisp (require 'ido-completing-read+) (ido-ubiquitous-mode 1) ``` -## Smex ## - -Smex allows you to use ido for completion of commands in M-x, with -enhancements like putting your most-used commands at the front of the -list. First install the [smex](https://github.com/nonsequitur/smex) -package, then follow the directions to load it and replace your normal -M-x key-binding with smex: -```elisp -(require 'smex) ; Not needed if you use package.el -(smex-initialize) ; Can be omitted. This might cause a (minimal) delay - ; when Smex is auto-initialized on its first run. -(global-set-key (kbd "M-x") 'smex) -(global-set-key (kbd "M-X") 'smex-major-mode-commands) -;; This is your old M-x. -(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command) -``` -(These directions are the same ones given in the smex README file.) + +## Amx ## + +Amx, another of my packages, allows you to use alternate completion +systems like ido for commands in M-x, with enhancements like putting +your most-used commands at the front of the list. First install +[amx](https://melpa.org/#/amx) from MELPA, then turn on `amx-mode`: + +```elisp +(require 'amx) +(amx-mode 1) +``` ## ido-yes-or-no ## If you want to use ido for yes-or-no questions, even though it's massive overkill, install my [ido-yes-or-no package from MELPA](http://melpa.org/#/ido-yes-or-no), and then enable the mode: + ```elisp (require 'ido-yes-or-no) (ido-yes-or-no-mode 1) ``` + ## ido for `describe-face` and certain other commands ## Some commands, such as `describe-face`, use `completing-read-multiple` @@ -92,10 +91,12 @@ the [crm-custom](https://github.com/DarwinAwardWinner/crm-custom) package [from MELPA](http://melpa.org/#/crm-custom), then enable the mode: + ```elisp (require 'crm-custom) (crm-custom-mode 1) ``` + Make sure to read and understand the FAQ entry below about the empty entry at the beginning of the completion list before using this mode, or using it will likely be very confusing. @@ -117,10 +118,12 @@ called `icomplete-mode` that integrates with standard emacs completion and adds some ido-like behavior. It is built in to emacs, so no installation is necessary. Just load the file and enable the mode: + ```elisp (require 'icomplete) (icomplete-mode 1) ``` + # Frequently asked questions # ## How does ido-ubiquitous-mode decide when to replace `completing-read`?
Why don't some commands use ido completion? ## @@ -135,10 +138,10 @@ call to `completing-read`. Furthermore, it's not always possible to detect based on the arguments to `completing-read` whether such ido-incompatible features are being used or not, so -ido-completing-read+ also comes with a blacklist of functions that are -known not to work with ido. You can inspect this blacklist using - - `M-x describe-variable ido-cr+-function-blacklist` +ido-completing-read+ also comes with a list of functions that are +known not to work with ido. You can inspect this list using + + M-x describe-variable ido-cr+-disable-list If you want to know why a certain command isn't getting ido completion, you can enable `ido-cr+-debug-mode` and then run the @@ -194,22 +197,22 @@ prompt appears, make a selection to complete the process. Then, examine the Messages buffer, where ido-completing-read+ will explain which mode of operation it selected and why. Based on this, you can -add an entry to `ido-cr+-function-blacklist`, or take some other +add an entry to `ido-cr+-disable-list`, or take some other appropriate action. -Updates to ido-completing-read+ may include new blacklist entries, but -Emacs will not edit your override variables if you have already +Updates to ido-completing-read+ may include new disable list entries, +but Emacs will not edit your override variables if you have already customized them. So, if you have recently upgraded -ido-completing-read+, remember to invoke `ido-cr+-update-blacklist` to -add in any new overrides. By default, ido-completing-read+ will remind -you to do this whenever a new version adds to the blacklist. For more -information, see: - - M-x describe-variable ido-cr+-auto-update-blacklist +ido-completing-read+, remember to invoke `ido-cr+-update-disable-list` +to add in any new overrides. By default, ido-completing-read+ will +remind you to do this whenever a new version adds to the list. For +more information, see: + + M-x describe-variable ido-cr+-auto-update-disable-list ## Where can I report bugs? ## -If you end up adding any blacklist entries, please report them at +If you end up adding any disable list entries, please report them at https://github.com/DarwinAwardWinner/ido-ubiquitous/issues so I can incorporate them into the defaults for future versions. You can also report any bugs you find in ido-completing-read+. @@ -232,25 +235,21 @@ ## What is the "bleeding-edge" branch? ## -All users should just use the master branch, or better yet, install -from MELPA. The bleeding-edge branch is where I test experimental and +All users should just use the main branch, or better yet, install from +MELPA. The bleeding-edge branch is where I test experimental and unfinished features. Because ido-completing-read+ hooks deeply into the bowels of Emacs, a bug in ido-completing-read+ could easily freeze or crash Emacs entirely. Additionally, some bug only show up when ido-completing-read+ is installed and compiled as a package. So I test every new feature myself for some time on this branch before pushing -to the master branch. If you report a bug, I might develop a fix for -it on the bleeding edge branch and ask then you to try this branch. +to the main branch. If you report a bug, I might develop a fix for it +on the bleeding edge branch and ask then you to try this branch. Otherwise, normal users don't need to think about this branch. ## Running the tests This package comes with a test suite. If you want to run it yourself, -first install the [cask](http://cask.readthedocs.io/en/latest/) -dependency manager. Then, from the package directory, run `cask -install` to install all the development dependencies, in -particular -[buttercup](https://github.com/jorgenschaefer/emacs-buttercup). -Finally, to run the tests, execute `cask exec buttercup -L .`. Please -run this test suite before submitting any pull requests, and note in -the pull request whether any of the tests fail. +first install the [Eldev](https://github.com/doublep/eldev), then use +`eldev test` to run the tests. Please run this test suite before +submitting any pull requests, and note in the pull request whether any +of the tests fail. diff --git a/ido-completing-read+.el b/ido-completing-read+.el index fa9fdfa..0d4d318 100644 --- a/ido-completing-read+.el +++ b/ido-completing-read+.el @@ -3,10 +3,10 @@ ;; Copyright (C) 2011-2017 Ryan C. Thompson ;; Filename: ido-completing-read+.el -;; Author: Ryan Thompson +;; Author: Ryan C. Thompson ;; Created: Sat Apr 4 13:41:20 2015 (-0700) -;; Version: 4.13 -;; Package-Requires: ((emacs "24.4") (cl-lib "0.5") (s "0.1") (memoize "1.1")) +;; Version: 4.14 +;; Package-Requires: ((emacs "24.4") (seq "0.5") (memoize "1.1")) ;; URL: https://github.com/DarwinAwardWinner/ido-completing-read-plus ;; Keywords: ido, completion, convenience @@ -48,7 +48,7 @@ ;; this mode is enabled. Some other functions have ido disabled in ;; them because their packages already provide support for ido via ;; other means (for example, magit). See `M-x describe-variable -;; ido-cr+-function-blacklist' for more information. +;; ido-cr+-disable-list' for more information. ;; ido-completing-read+ version 4.0 is a major update. The formerly ;; separate package ido-ubiquitous has been subsumed into @@ -77,17 +77,18 @@ ;; ;;; Code: -(defconst ido-completing-read+-version "4.13" +(defconst ido-completing-read+-version "4.14" "Currently running version of ido-completing-read+. Note that when you update ido-completing-read+, this variable may not be updated until you restart Emacs.") +(require 'nadvice) (require 'ido) +(require 'seq) (require 'minibuf-eldef) (require 'cl-lib) (require 'cus-edit) -(require 's) ;; Optional dependency, only needed for optimization (require 'memoize nil t) @@ -103,11 +104,15 @@ "If non-nil, ido-cr+ will print debug info. Debug info is printed to the *Messages* buffer." - nil + :init-value nil :global t :group 'ido-completing-read-plus) (defsubst ido-cr+--debug-message (format-string &rest args) + "Emit a debug message for ido-cr+. + +This only has an effect when `ido-cr+-debug-mode' is non-nil. +Arguments are identical to `message'." (when ido-cr+-debug-mode (apply #'message (concat "ido-completing-read+: " format-string) args))) @@ -117,8 +122,8 @@ ;; silence byte-compiler warnings, despite already being declared in ;; ido.el. -(defmacro define-ido-internal-var (symbol &optional initvalue docstring) - "Declare and initialize an ido internal variable. +(defmacro ido-cr+-define-ido-internal-var (symbol &optional initvalue docstring) + "Declare and initialize SYMBOL an ido internal variable. This is used to suppress byte-compilation warnings about reference to free variables when ido-cr+ attempts to access @@ -139,11 +144,11 @@ should be, because ido always let-binds this variable before using it, so the initial value shouldn't matter."))) -(define-ido-internal-var ido-context-switch-command) -(define-ido-internal-var ido-cur-list) -(define-ido-internal-var ido-cur-item) -(define-ido-internal-var ido-require-match) -(define-ido-internal-var ido-process-ignore-lists) +(ido-cr+-define-ido-internal-var ido-context-switch-command) +(ido-cr+-define-ido-internal-var ido-cur-list) +(ido-cr+-define-ido-internal-var ido-cur-item) +(ido-cr+-define-ido-internal-var ido-require-match) +(ido-cr+-define-ido-internal-var ido-process-ignore-lists) ;; Vars and functions from flx-ido package (defvar flx-ido-mode) @@ -154,7 +159,7 @@ "Minibuffer depth of the most recent ido-cr+ activation. If this equals the current minibuffer depth, then the minibuffer -is currently being used by ido-cr+, and ido-cr+ feature will be +is currently being used by ido-cr+, and ido-cr+ features will be active. Otherwise, something else is using the minibuffer and ido-cr+ features will be deactivated to avoid interfering with the other command. @@ -194,7 +199,7 @@ "Idle timer for updating dynamic completion list.") (defvar ido-cr+-exhibit-pending nil - "This is non-nil after calling `ido-tidy' until the next call to `ido-exhibit'. + "This is non-nil between calling `ido-tidy' and `ido-exhibit'. Typically this is non-nil while any command is running and nil at all other times, since those two functions are in `pre-command-hook' @@ -229,6 +234,30 @@ Each element is a cons cell of (REMOVEP . TEXT), where REMOVEP is the prefix argument to `ido-restrict-to-matches' and TEXT is the pattern used to restrict.") + +(defvar ido-cr+-need-bug27807-workaround + (cl-letf* + ((ido-exit ido-exit) + ((symbol-function 'read-from-minibuffer) + (lambda (_prompt &optional initial-contents &rest _remaining-args) + (setq ido-exit 'takeprompt) ; Emulate pressing C-j in ido + (if (consp initial-contents) + (substring (car initial-contents) 0 (1- (cdr initial-contents))) + initial-contents))) + ;; Need to get the unadvised original of `ido-completing-read' + ;; because the advice is autoloaded, so calling it while + ;; loading the package will trigger a recursive load. + ((symbol-function 'ido-completing-read) + (advice--cd*r (symbol-function 'ido-completing-read))) + (input-before-point + (ido-completing-read "Pick: " '("aaa" "aab" "aac") nil nil '("aa" . 1)))) + ;; If an initial position of 1 yields a 0-length string, then this + ;; Emacs does not have the bug fix and requires the workaround. + (= (length input-before-point) 0)) + "If non-nil, enable the workaround for Emacs bug #27807. + +This variable is normally set when ido-cr+ is loaded, and should +not need to be modified by users.") (defgroup ido-completing-read-plus nil "Extra features and compatibility for `ido-completing-read'." @@ -248,7 +277,7 @@ ido-ubiquitous-completing-read)) 'completing-read-default completing-read-function) - "Alternate completing-read function to use when ido is not wanted. + "Alternate `completing-read-function' to use when ido is not wanted. This will be used for functions that are incompatible with ido or if ido cannot handle the completion arguments. It will also be @@ -278,9 +307,15 @@ widget))))) :group 'ido-completing-read-plus) -(defcustom ido-cr+-function-blacklist +(define-obsolete-variable-alias + 'ido-cr+-function-blacklist + 'ido-cr+-disable-list + "ido-completing-read+ 4.14") + +(defcustom ido-cr+-disable-list '(read-file-name-internal read-buffer + internal-complete-buffer ;; https://github.com/DarwinAwardWinner/ido-completing-read-plus/issues/60 todo-add-category ;; Gnus already supports ido on its own @@ -302,6 +337,7 @@ ffap-read-file-or-url-internal ;; https://github.com/DarwinAwardWinner/ido-completing-read-plus/issues/161 sly-read-symbol-name + org-olpath-completing-read ) "Functions & commands for which ido-cr+ should be disabled. @@ -310,10 +346,10 @@ expression means to fall back for any function whose name matches that regular expression. When ido-cr+ is called through `completing-read', if any function in the call stack of the -current command matches any of the blacklist entries, ido-cr+ +current command matches any of the disable list entries, ido-cr+ will be disabled for that command. Additionally, if the -collection in the call to `completing-read' matches any of the -blacklist entries, ido-cr+ will be disabled. +collection in the call to `completing-read' is a function name +that matches any of the entries, ido-cr+ will be disabled. Note that using specific function names is generally preferable to regular expressions, because the associated function @@ -324,22 +360,44 @@ :type '(repeat (choice (symbol :tag "Function or command name") (string :tag "Regexp")))) -(defcustom ido-cr+-function-whitelist +(define-obsolete-variable-alias + 'ido-cr+-function-whitelist + 'ido-cr+-allow-list + "ido-completing-read+ 4.14") + +(defcustom ido-cr+-allow-list nil - "Functions & commands for which ido-cr+ should be enabled. - -If this variable is nil, the whitelist will not be used, and -ido-cr+ will be allowed in all functions/commands not listed in -`ido-cr+-function-backlist'. - -If this variable is non-nil, ido-cr+'s whitelisting mode will be + "If non-nil, limit ido-cr+ only to the specified commands & functions. + +If this variable is nil, the ido-cr+ will be enabled for all +commands and functions not specified in all commands/functions +not specified in `ido-cr+-function-backlist'. + +If this variable is non-nil, ido-cr+'s limited mode will be enabled, and ido-cr+ will be disabled for *all* functions unless -they match one of the entries. Matching is done in the same -manner as `ido-cr+-function-blacklist', and blacklisting takes -precedence over whitelisting." +they match one of the entries in this variable. Matching is done +in the same manner as `ido-cr+-disable-list', and the disable +list also takes precedence over the allow list." :group 'ido-completing-read-plus :type '(repeat (choice (symbol :tag "Function or command name") (string :tag "Regexp")))) + +(defvaralias 'ido-cr+-nil-def-wall-of-shame + 'ido-cr+-nil-def-alternate-behavior-list + "Functions and commands that use `completing-read' improperly. + +Many functions that call `completing-read' are written with the +assumption that the setting the REQUIRE-MATCH argument of +`completing-read' to t means it is required to return a match. +While that would make logical sense, it's wrong. the docstring +for `completing-read' describes the correct behavior. + +> If the input is null, ‘completing-read’ returns DEF, or the +> first element of the list of default values, or an empty string +> if DEF is nil, regardless of the value of REQUIRE-MATCH. + +This can be avoided by passing an element of COLLECTION as DEF +instead of leaving it as nil.") (defcustom ido-cr+-nil-def-alternate-behavior-list '("\\`describe-\\(function\\|variable\\)\\'" @@ -363,35 +421,19 @@ ) "Functions & commands with alternate behavior when DEF is nil. -This variable has the same format as -`ido-cr+-function-blacklist'. When `ido-completing-read+` is -called through `completing-read' by/with any command, function, -or collection matched by entries in this list, it will behave -differently when DEF is nil. Instead of using the empty string as -the default value, it will use the first element of COLLECTION. +This variable has the same format as `ido-cr+-disable-list'. When +`ido-completing-read+` is called through `completing-read' +by/with any command, function, or collection matched by entries +in this list, it will behave differently when DEF is nil. Instead +of using the empty string as the default value, it will use the +first element of COLLECTION. This is needed for optimal compatibility with commands written -under the assumption that REQUIRE-MATCH means that a match is -required." +under the reasonable but wrong assumption that REQUIRE-MATCH +means that a match is required." :group 'ido-completing-read-plus :type '(repeat (choice (symbol :tag "Function or command name") (string :tag "Regexp")))) - -(defvaralias 'ido-cr+-nil-def-wall-of-shame 'ido-cr+-nil-def-alternate-behavior-list - "Functions and commands whose authors need to read the docstring for `completing-read'. - -Many functions that call `completing-read' are written with the -assumption that the setting the REQUIRE-MATCH argument of -`completing-read' to t means it is required to return a match. -While that would make logical sense, it's wrong. the docstring -for `completing-read' describes the correct behavior. - -> If the input is null, ‘completing-read’ returns DEF, or the -> first element of the list of default values, or an empty string -> if DEF is nil, regardless of the value of REQUIRE-MATCH. - -This can be avoided by passing an element of COLLECTION as DEF -instead of leaving it as nil.") ;;;###autoload (defcustom ido-cr+-replace-completely nil @@ -407,35 +449,43 @@ (define-error 'ido-cr+-fallback "ido-cr+-fallback") (defsubst ido-cr+--explain-fallback (arg) - ;; This function accepts a string, or an ido-cr+-fallback - ;; signal. + "Emit a debug message explaining the reason for falling back. + +ARG can be a string or an ido-cr+-fallback signal. In the latter +case, the DATA part of the signal is used as the message." (when ido-cr+-debug-mode (when (and (listp arg) (eq (car arg) 'ido-cr+-fallback)) (setq arg (cadr arg))) - (ido-cr+--debug-message "Falling back to `%s' because %s." - ido-cr+-fallback-function arg))) + (ido-cr+--debug-message + "Falling back to `%s' because %s." + (if (symbolp ido-cr+-fallback-function) + ido-cr+-fallback-function + "ido-cr+-fallback-function") + arg))) ;;;###autoload (defsubst ido-cr+-active () - "Returns non-nil if ido-cr+ is currently using the minibuffer." + "Return non-nil if ido-cr+ is currently using the minibuffer." (>= ido-cr+-minibuffer-depth (minibuffer-depth))) (defun ido-cr+--called-from-completing-read () - "Returns non-nil if the most recent call to ido-cr+ was from `completing-read'." + "Return non-nil if the most recent call to ido-cr+ was from `completing-read'." (equal (cadr (backtrace-frame 1 'ido-completing-read+)) 'completing-read)) (defmacro ido-cr+-function-is-in-list (fun fun-list &optional list-name) "Return non-nil if FUN matches an entry in FUN-LIST. -This is used to check for matches to `ido-cr+-function-blacklist' -and `ido-cr+-function-whitelist'. Read those docstrings to see -how the matching is done. +This is used to check for matches to `ido-cr+-disable-list' and +`ido-cr+-allow-list'. Read those docstrings to see how +the matching is done. This is declared as macro only in order to extract the variable name used for the second argument so it can be used in a debug -message. It should be called as if it were a normal function." +message. It should be called as if it were a normal function. The +optional 3rd argument LIST-NAME can be used to provide this +information manually if it is known." (when (null list-name) (if (symbolp fun-list) (setq list-name (symbol-name fun-list)) @@ -461,39 +511,51 @@ ((stringp entry) (and (symbolp ,fun) (string-match-p entry (symbol-name ,fun)))) - ;; Anything else: invalid blacklist entry + ;; Anything else: invalid list entry (t (ido-cr+--debug-message "Ignoring invalid entry in %s: `%S'" ,list-name entry) nil)) return entry - ;; If no blacklist entry matches, return nil + ;; If no list entry matches, return nil finally return nil)) -(defun ido-cr+-function-is-blacklisted (fun) - "Return non-nil if FUN is blacklisted. - -See `ido-cr+-function-blacklist'." - (ido-cr+-function-is-in-list fun ido-cr+-function-blacklist)) - -(defun ido-cr+-function-is-whitelisted (fun) - "Return non-nil if FUN is whitelisted. - -See `ido-cr+-function-whitelist'." - (or (null ido-cr+-function-whitelist) - (ido-cr+-function-is-in-list fun ido-cr+-function-whitelist))) +(define-obsolete-function-alias + 'ido-cr+-function-is-blacklisted + 'ido-cr+-disabled-in-function-p + "ido-completing-read+ 4.14") + +(defsubst ido-cr+-disabled-in-function-p (fun) + "Return non-nil if ido-cr+ is disabled for FUN. + +See `ido-cr+-disable-list'." + (ido-cr+-function-is-in-list fun ido-cr+-disable-list)) + +(define-obsolete-function-alias + 'ido-cr+-function-is-whitelisted + 'ido-cr+-allowed-in-function-p + "ido-completing-read+ 4.14") + +(defsubst ido-cr+-allowed-in-function-p (fun) + "Return non-nil if ido-cr+ is allowed for FUN. + +See `ido-cr+-allow-list'." + (or (null ido-cr+-allow-list) + (ido-cr+-function-is-in-list fun ido-cr+-allow-list))) ;;;###autoload (defun ido-completing-read+ (prompt collection &optional predicate require-match initial-input hist def inherit-input-method) - "ido-based method for reading from the minibuffer with completion. + "Ido-based method for reading from the minibuffer with completion. See `completing-read' for the meaning of the arguments. This function is a wrapper for `ido-completing-read' designed to be used as the value of `completing-read-function'. Importantly, it detects edge cases that ido cannot handle and uses normal -completion for them." +completion for them. + +See `completing-read' for the meaning of the arguments." (let* (;; Save the original arguments in case we need to do the ;; fallback (ido-cr+-orig-completing-read-args @@ -534,8 +596,8 @@ (if (and ido-cr+-dynamic-collection (featurep 'memoize)) (memoize (indirect-function 'all-completions)) 'all-completions)) - ;; If the whitelist is empty, everything is whitelisted - (whitelisted (not ido-cr+-function-whitelist)) + ;; If the allow list is empty, everything is allowed + (ido-cr+-allowed (not ido-cr+-allow-list)) ;; If non-nil, we need alternate nil DEF handling (alt-nil-def nil)) (condition-case sig @@ -545,23 +607,23 @@ (signal 'ido-cr+-fallback '("ido cannot handle alternate input methods"))) - ;; Check for black/white-listed collection function + ;; Check for allow/disable-listed collection function (when (functionp collection) - ;; Blacklist - (when (ido-cr+-function-is-blacklisted collection) + ;; Disable list + (when (ido-cr+-disabled-in-function-p collection) (if (symbolp collection) (signal 'ido-cr+-fallback - (list (format "collection function `%S' is blacklisted" collection))) + (list (format "collection function `%S' is disabled" collection))) (signal 'ido-cr+-fallback - (list "collection function is blacklisted")))) - ;; Whitelist - (when (and (not whitelisted) - (ido-cr+-function-is-whitelisted collection)) + (list "collection function is disabled")))) + ;; Allow list + (when (and (not ido-cr+-allowed) + (ido-cr+-allowed-in-function-p collection)) (ido-cr+--debug-message (if (symbolp collection) - (format "Collection function `%S' is whitelisted" collection) - "Collection function is whitelisted")) - (setq whitelisted t)) + (format "Collection function `%S' is allowed" collection) + "Collection function is allowed")) + (setq ido-cr+-allowed t)) ;; nil DEF list (when (and require-match (null def) @@ -594,21 +656,21 @@ ido-cr+-max-items)))) ;; If called from `completing-read', check for - ;; black/white-listed commands/callers + ;; disabled/allowed commands/callers (when (ido-cr+--called-from-completing-read) ;; Check calling command and `ido-cr+-current-command' (cl-loop for cmd in (list this-command ido-cr+-current-command) - if (ido-cr+-function-is-blacklisted cmd) + if (ido-cr+-disabled-in-function-p cmd) do (signal 'ido-cr+-fallback - (list "calling command `%S' is blacklisted" cmd)) - - if (and (not whitelisted) - (ido-cr+-function-is-whitelisted cmd)) + (list "calling command `%S' is disabled" cmd)) + + if (and (not ido-cr+-allowed) + (ido-cr+-allowed-in-function-p cmd)) do (progn - (ido-cr+--debug-message "Command `%S' is whitelisted" cmd) - (setq whitelisted t)) + (ido-cr+--debug-message "Command `%S' is allowed" cmd) + (setq ido-cr+-allowed t)) if (and require-match (null def) (not alt-nil-def) @@ -633,20 +695,20 @@ '(internal--funcall-interactively (indirect-function 'call-interactively)))) - if (ido-cr+-function-is-blacklisted caller) + if (ido-cr+-disabled-in-function-p caller) do (signal 'ido-cr+-fallback (list (if (symbolp caller) - (format "calling function `%S' is blacklisted" caller) - "a calling function is blacklisted"))) - - if (and (not whitelisted) - (ido-cr+-function-is-whitelisted caller)) + (format "calling function `%S' is disabled" caller) + "a calling function is disabled"))) + + if (and (not ido-cr+-allowed) + (ido-cr+-allowed-in-function-p caller)) do (progn (ido-cr+--debug-message (if (symbolp caller) - (format "Calling function `%S' is whitelisted" caller) - "A calling function is whitelisted")) - (setq whitelisted t)) + (format "Calling function `%S' is allowed" caller) + "A calling function is allowed")) + (setq ido-cr+-allowed t)) if (and require-match (null def) (not alt-nil-def) (ido-cr+-function-is-in-list @@ -658,9 +720,9 @@ "Using alternate nil DEF handling for a calling function")) (setq alt-nil-def t)))) - (unless whitelisted + (unless ido-cr+-allowed (signal 'ido-cr+-fallback - (list "no functions or commands matched the whitelist for this call"))) + (list "no functions or commands matched the allow list for this call"))) (when (and require-match (null def)) ;; Replace nil with "" for DEF if match is required, unless @@ -696,9 +758,9 @@ '("ido cannot handle the empty string as an option when `ido-enable-dot-prefix' is non-nil; see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26997"))) ;; Fix ido's broken handling of cons-style INITIAL-INPUT on - ;; Emacsen older than 27.1. + ;; Emacsen older than 27. See Emacs bug #27807. (when (and (consp initial-input) - (version< emacs-version "27.1")) + ido-cr+-need-bug27807-workaround) ;; `completing-read' uses 0-based index while ;; `read-from-minibuffer' uses 1-based index. (cl-incf (cdr initial-input))) @@ -813,10 +875,12 @@ #'ido-select-text@ido-cr+-fix-require-match) (defun ido-tidy@ido-cr+-set-exhibit-pending (&rest _args) + "Advice to manage the value of `ido-cr+-exhibit-pending'." (setq ido-cr+-exhibit-pending t)) (advice-add 'ido-tidy :after 'ido-tidy@ido-cr+-set-exhibit-pending) (defun ido-exhibit@ido-cr+-clear-exhibit-pending (&rest _args) + "Advice to manage the value of `ido-cr+-exhibit-pending'." (setq ido-cr+-exhibit-pending nil)) (advice-add 'ido-exhibit :before 'ido-exhibit@ido-cr+-clear-exhibit-pending) @@ -843,7 +907,7 @@ for i from 0 upto (length string) append (funcall ido-cr+-all-completions-memoized - (s-left i string) + (substring string 0 i) collection predicate) into completion-list @@ -888,7 +952,7 @@ filtered-collection))) (defun ido-cr+-cyclicp (x) - "Returns non-nill if X is a list containing a circular reference." + "Return non-nill if X is a list containing a circular reference." (cl-loop for tortoise on x for hare on (cdr x) by #'cddr @@ -908,7 +972,7 @@ ;; If current `ido-text' is equal to or a prefix of the previous ;; one, a dynamic update is not needed. (when (or (null ido-cr+-last-dynamic-update-text) - (not (s-prefix? ido-text ido-cr+-last-dynamic-update-text))) + (not (string-prefix-p ido-text ido-cr+-last-dynamic-update-text))) (ido-cr+--debug-message "Doing a dynamic update because `ido-text' changed from %S to %S" ido-cr+-last-dynamic-update-text ido-text) (setq ido-cr+-last-dynamic-update-text ido-text) @@ -923,7 +987,7 @@ ;; If `ido-text' is a prefix of `first-match', then we ;; only need to check `first-match' ((and first-match - (s-prefix? ido-text first-match)) + (string-prefix-p ido-text first-match)) (list first-match)) ;; Otherwise we need to check both (t @@ -1003,7 +1067,7 @@ #'ido-cr+-update-dynamic-collection))))) (defun ido-cr+-minibuffer-setup () - "set up minibuffer `post-command-hook' for ido-cr+ " + "Set up minibuffer `post-command-hook' for ido-cr+." (when (ido-cr+-active) (add-hook 'post-command-hook 'ido-cr+-schedule-dynamic-collection-update))) @@ -1035,7 +1099,7 @@ ;; dynamically-added completions are also properly restricted. (defun ido-restrict-to-matches@ido-cr+-record-restriction (&optional removep) - "Record the restriction criterion for ido-cr+" + "Record the restriction criterion for ido-cr+." (ido-cr+--debug-message "Appending restriction %S to `ido-cr+-active-restrictions'" (cons removep ido-text)) (add-to-list 'ido-cr+-active-restrictions (cons removep ido-text) t)) @@ -1046,7 +1110,7 @@ ;; default when the input is empty and the empty string is the ;; selected choice (defun minibuf-eldef-update-minibuffer@ido-cr+-compat (orig-fun &rest args) - "This advice allows minibuffer-electric-default-mode to work with ido-cr+." + "This advice allows `minibuffer-electric-default-mode' to work with ido-cr+." (if (ido-cr+-active) (unless (eq minibuf-eldef-showing-default-in-prompt (and (string= (car ido-cur-list) "") @@ -1066,8 +1130,8 @@ If this mode causes problems for a function, you can customize when ido completion is or is not used by customizing -`ido-cr+-function-blacklist'." - nil +`ido-cr+-disable-list'." + :init-value nil :global t :group 'ido-completing-read-plus ;; Actually enable/disable the mode by setting @@ -1077,37 +1141,35 @@ #'ido-completing-read+ ido-cr+-fallback-function))) -(defcustom ido-cr+-auto-update-blacklist 'notify +(defcustom ido-cr+-auto-update-disable-list 'notify "Whether to add new overrides when updating ido-cr+. This variable has 3 possible values, with the following meanings: - `t': Auto-update the blacklist + t: Auto-update the disable list `notify': Notify you about updates but do not apply them - `nil': Ignore all blacklist updates - -Ido-cr+ comes with a default blacklist for commands that are -known to be incompatible with ido completion. New versions of -ido-cr+ may come with updates to this blacklist as more -incompatible commands are discovered. However, customizing your -own overrides would normally prevent you from receiving these -updates, since Emacs will not overwrite your customizations. - -To resolve this problem, you can set this variable to `t', and -then ido-cr+ can automatically add any new built-in overrides -whenever it is updated. (Actually, the update will happen the -next time Emacs is restarted after the update.) This allows you -to add your own overrides but still receive updates to the -default set. - -If you want ido-cr+ to just notify you about new default -overrides instead of adding them itself, set this variable to -`notify'. If you don't want this auto-update behavior at all, set -it to `nil'. - -(Note that having this option enabled effectively prevents you -from removing any of the built-in default blacklist entries, -since they will simply be re-added the next time Emacs starts.)" + nil: Ignore all disable list updates + +Ido-cr+ comes with a default list of commands that are known to +be incompatible with ido completion. New versions of ido-cr+ may +come with updates to this \"disable list\" as more incompatible +commands are discovered. However, customizing your own overrides +would normally prevent you from receiving these updates, since +Emacs will not overwrite your customizations. + +To resolve this problem, you can set this variable to t, and then +ido-cr+ can automatically add any new built-in overrides whenever +it is updated. (Actually, the update will happen the next time +Emacs is restarted after the update.) This allows you to add your +own overrides but still receive updates to the default set. + +If you want ido-cr+ to just notify you about new defaults instead +of adding them itself, set this variable to `notify'. If you +don't want this auto-update behavior at all, set it to nil. + +\(Note that having this option enabled effectively prevents you +from removing any of the built-in default entries, since they +will simply be re-added the next time Emacs starts.)" :type '(choice :tag "When new overrides are available:" (const :menu-tag "Auto-add" :tag "Add them automatically" @@ -1120,24 +1182,32 @@ nil)) :group 'ido-completing-read-plus) -(defun ido-cr+-update-blacklist (&optional save quiet) - "Re-add any missing default blacklist entries. +(define-obsolete-function-alias + 'ido-cr+-update-blacklist + 'ido-cr+-update-disable-list + "ido-completing-read+ 4.14") + +(defun ido-cr+-update-disable-list (&optional save quiet) + "Re-add any missing default entries to `ido-cr+-disable-list'. This is useful after an update of ido-ubiquitous that adds new -default overrides. See `ido-cr+-auto-update-blacklist' for more -information. - -If SAVE is non-nil, also save the new blacklist to the user's +default overrides. See `ido-cr+-auto-update-disable-list' for +more information. + +If SAVE is non-nil, also save the new disable list to the user's Custom file (but only if it was already customized beforehand). When called interactively, a prefix argument triggers a save. +Unless QUIET is non-nil, this function produces messages indicating +all changes that were made. + When called from Lisp code, this function returns non-nil if the -blacklist was modified." +disable list was modified." (interactive "P") - (let* ((var-state (custom-variable-state 'ido-cr+-function-blacklist - ido-cr+-function-blacklist)) - (curval ido-cr+-function-blacklist) - (defval (eval (car (get 'ido-cr+-function-blacklist 'standard-value)))) + (let* ((var-state (custom-variable-state 'ido-cr+-disable-list + ido-cr+-disable-list)) + (curval ido-cr+-disable-list) + (defval (eval (car (get 'ido-cr+-disable-list 'standard-value)))) (newval (delete-dups (append defval curval))) (new-entries (cl-set-difference defval curval :test #'equal)) (modified nil) @@ -1146,52 +1216,57 @@ (cl-case var-state (standard ;; Var is not customized, just set the new default - (ido-cr+--debug-message "Blacklist was not customized, so it has been updated to the new default value.") - (setq ido-cr+-function-blacklist defval + (ido-cr+--debug-message "Disable list was not customized, so it has been updated to the new default value.") + (setq ido-cr+-disable-list defval modified new-entries)) ((saved set changed) ;; Var has been customized and saved by the user, so set the ;; new value and maybe save it - (ido-cr+--debug-message "Updating user-customized blacklist with new default entries.") - (setq ido-cr+-function-blacklist newval + (ido-cr+--debug-message "Updating user-customized disable list with new default entries.") + (setq ido-cr+-disable-list newval modified t) (when (and save (eq var-state 'saved)) - (ido-cr+--debug-message "Saving new blacklist value to Custom file.") - (customize-save-variable 'ido-cr+-function-blacklist ido-cr+-function-blacklist) + (ido-cr+--debug-message "Saving new disable list value to Custom file.") + (customize-save-variable 'ido-cr+-disable-list ido-cr+-disable-list) (setq saved t))) (otherwise - (ido-cr+--debug-message "Customization status of blacklist is unknown. Not modifying it."))) + (ido-cr+--debug-message "Customization status of disable list is unknown. Not modifying it."))) (if (and modified (not quiet)) (progn - (push (format "Added the following entries to `ido-cr+-function-blacklist': %S" new-entries) + (push (format "Added the following entries to `ido-cr+-disable-list': %S" new-entries) message-lines) (if saved - (push "Saved the new value of `ido-cr+-function-blacklist' to your Custom file." + (push "Saved the new value of `ido-cr+-disable-list' to your Custom file." message-lines) - (push "However, the new value of `ido-cr+-function-blacklist' has not yet been saved for future sessions. To save it. re-run this command with a prefix argument: `C-u M-x ido-cr+-update-blacklist'; or else manually inspect and save the value using `M-x customize-variable ido-cr+-function-blacklist'." + (push "However, the new value of `ido-cr+-disable-list' has not yet been saved for future sessions. To save it. re-run this command with a prefix argument: `C-u M-x ido-cr+-update-disable-list'; or else manually inspect and save the value using `M-x customize-variable ido-cr+-disable-list'." message-lines))) - (push "No updates were required to `ido-cr+-function-blacklist'." message-lines)) + (push "No updates were required to `ido-cr+-disable-list'." message-lines)) (unless quiet (message (mapconcat #'identity (nreverse message-lines) "\n"))) modified)) -(defun ido-cr+-maybe-update-blacklist () - "Maybe call `ico-cr+-update-blacklist. - - See `ido-cr+-auto-update-blacklist' for more information." - (if ido-cr+-auto-update-blacklist - (let* ((curval ido-cr+-function-blacklist) - (defval (eval (car (get 'ido-cr+-function-blacklist 'standard-value)))) +(define-obsolete-function-alias + 'ido-cr+-maybe-update-blacklist + 'ido-cr+-maybe-update-disable-list + "ido-completing-read+ 4.14") + +(defun ido-cr+-maybe-update-disable-list () + "Maybe call `ico-cr+-update-disable-list. + + See `ido-cr+-auto-update-disable-list' for more information." + (if ido-cr+-auto-update-disable-list + (let* ((curval ido-cr+-disable-list) + (defval (eval (car (get 'ido-cr+-disable-list 'standard-value)))) (new-entries (cl-set-difference defval curval :test #'equal))) (if new-entries - (if (eq ido-cr+-auto-update-blacklist 'notify) - (display-warning 'ido-completing-read+ (format "There are %s new blacklist entries available. Use `M-x ido-cr+-update-blacklist' to install them. (See `ido-cr+-auto-update-blacklist' for more information.)" (length new-entries))) - (ido-cr+--debug-message "Initiating blacklist update.") - (ido-cr+-update-blacklist t)) - (ido-cr+--debug-message "No blacklist updates available."))) - (ido-cr+--debug-message "Skipping blacklist update by user request."))) - -(ido-cr+-maybe-update-blacklist) + (if (eq ido-cr+-auto-update-disable-list 'notify) + (display-warning 'ido-completing-read+ (format "There are %s new disable list entries available. Use `M-x ido-cr+-update-disable-list' to install them. (See `ido-cr+-auto-update-disable-list' for more information.)" (length new-entries))) + (ido-cr+--debug-message "Initiating disable list update.") + (ido-cr+-update-disable-list t)) + (ido-cr+--debug-message "No disable list updates available."))) + (ido-cr+--debug-message "Skipping disable list update by user request."))) + +(ido-cr+-maybe-update-disable-list) (provide 'ido-completing-read+) diff --git a/ido-ubiquitous.el b/ido-ubiquitous.el deleted file mode 100644 index 639348f..0000000 --- a/ido-ubiquitous.el +++ /dev/null @@ -1,84 +0,0 @@ -;;; ido-ubiquitous.el --- Use ido (nearly) everywhere. -*- lexical-binding: t -*- - -;; Copyright (C) 2011-2017 Ryan C. Thompson - -;; Author: Ryan C. Thompson -;; URL: https://github.com/DarwinAwardWinner/ido-ubiquitous -;; Version: 4.13 -;; Created: 2011-09-01 -;; Keywords: convenience, completion, ido -;; EmacsWiki: InteractivelyDoThings -;; Package-Requires: ((ido-completing-read+ "4.13") (cl-lib "0.5")) -;; Filename: ido-ubiquitous.el - -;; This file is NOT part of GNU Emacs. - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: - -;; Previously a separate package, ido-ubiquitous has now been subsumed -;; into ido-completing-read+. You should update your config to install that instead. - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This program is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or (at -;; your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Code: - -(defconst ido-ubiquitous-version "4.13" - "Currently running version of ido-ubiquitous. - -Note that when you update ido-ubiquitous, this variable may not -be updated until you restart Emacs.") - -(require 'ido-completing-read+) - -(display-warning 'ido-ubiquitous "The ido-ubiquitous package is now redundant. All functionality, including ido-ubiquitous-mode, has been merged into the ido-completing-read+ package. You should replace ido-ubiquitous with ido-completing-read+ in your Emacs config. For more information, see: -https://github.com/DarwinAwardWinner/ido-ubiquitous#version-40-changes") - -(define-obsolete-function-alias 'completing-read-ido-ubiquitous 'ido-completing-read+ - "ido-completing-read+ 4.0") -(define-obsolete-function-alias 'ido-ubiquitous-update-overrides 'ido-cr+-update-blacklist - "ido-completing-read+ 4.0") -(define-obsolete-function-alias 'ido-ubiquitous--maybe-update-overrides 'ido-cr+-maybe-update-blacklist - "ido-completing-read+ 4.0") -(define-obsolete-variable-alias 'ido-ubiquitous-auto-update-overrides 'ido-cr+-auto-update-blacklist - "ido-completing-read+ 4.0") - -(make-obsolete-variable - 'ido-ubiquitous-default-state - "For the new variables to control which commands have ido completion, see `ido-cr+-function-blacklist' and `ido-cr+-function-whitelist'. For information on what happened to \"old-style\" default selection, See the FAQ." - "ido-completing-read+ 4.0") -(make-obsolete-variable - 'ido-ubiquitous-command-overrides - "For the new variables to control which commands have ido completion, see `ido-cr+-function-blacklist' and `ido-cr+-function-whitelist'. For information on what happened to \"old-style\" default selection, See the FAQ." - "ido-completing-read+ 4.0") -(make-obsolete-variable - 'ido-ubiquitous-function-overrides - "For the new variables to control which commands have ido completion, see `ido-cr+-function-blacklist' and `ido-cr+-function-whitelist'. For information on what happened to \"old-style\" default selection, See the FAQ." - "ido-completing-read+ 4.0") -(make-obsolete-variable - 'ido-ubiquitous-allow-on-functional-collection - "Ido-cr+ now works with most dynamic completion tables (i.e. \"functional collections\"), so this variable is no longer necessary. If a specific command uses a dynamic completion table that conflicts with ido-cr+, add it to `ido-cr+-function-blacklist' instead." - "ido-completing-read+ 4.0") - -(provide 'ido-ubiquitous) - -;; Local Variables: -;; indent-tabs-mode: nil -;; End: -;;; ido-ubiquitous.el ends here diff --git a/setversion.sh b/setversion.sh index 66a5af4..d2a8fa9 100755 --- a/setversion.sh +++ b/setversion.sh @@ -7,7 +7,7 @@ -e "s/((?:defconst|defvar|setq).*-version\s+)\"[0-9.]+\"/\${1}\"$TARGET_VERSION\"/g;" \ -e "s/(Package-Requires.*\(ido-completing-read\+\s+)\"[0-9.]+\"\)/\${1}\"${TARGET_VERSION}\")/g;" \ -e "s/\(package \"ido-ubiquitous\" \"[0-9.]+\"/(package \"ido-ubiquitous\" \"${TARGET_VERSION}\"/g" \ - *.el Cask + *.el else echo "Usage: $0 VERSION_NUMBER" fi diff --git a/tests/setup-undercover.el b/tests/setup-undercover.el deleted file mode 100644 index a4685c5..0000000 --- a/tests/setup-undercover.el +++ /dev/null @@ -1,3 +0,0 @@ -(require 'undercover) -(undercover "*.el" - (:exclude "test-*.el")) diff --git a/tests/test-ido-completing-read+.el b/tests/test-ido-completing-read+.el index 64b1b23..33e65d1 100644 --- a/tests/test-ido-completing-read+.el +++ b/tests/test-ido-completing-read+.el @@ -6,6 +6,7 @@ (require 'buttercup) (require 'cl-lib) (require 'with-simulated-input) +(require 's) ;; Note: Currently unused, but potentially useful in the future (defun ido-cr+-maybe-chop (items elem) @@ -143,11 +144,11 @@ ((ido-mode t) (ido-ubiquitous-mode t) (ido-cr+-debug-mode t) - ido-cr+-auto-update-blacklist + ido-cr+-auto-update-disable-list ido-cr+-fallback-function ido-cr+-max-items - ido-cr+-function-blacklist - ido-cr+-function-whitelist + ido-cr+-disable-list + ido-cr+-allow-list ido-cr+-nil-def-alternate-behavior-list ido-cr+-replace-completely ido-confirm-unique-completion @@ -207,16 +208,16 @@ (let ((eldef-was-showing nil)) ;; No REQUIRE-MATCH, so electric default should not show (with-simulated-input - '("blu DEL DEL DEL" - (setq eldef-was-showing minibuf-eldef-showing-default-in-prompt) - "RET") + ("blu DEL DEL DEL" + (setq eldef-was-showing minibuf-eldef-showing-default-in-prompt) + "RET") (ido-completing-read+ "Prompt (default green): " '("blue" "yellow" "green"))) (expect eldef-was-showing :not :to-be-truthy) ;; With REQUIRE-MATCH, so electric default should show (with-simulated-input - '("blu DEL DEL DEL" - (setq eldef-was-showing minibuf-eldef-showing-default-in-prompt) - "RET") + ("blu DEL DEL DEL" + (setq eldef-was-showing minibuf-eldef-showing-default-in-prompt) + "RET") (ido-completing-read+ "Prompt (default green): " '("blue" "yellow" "green") nil t)) (expect eldef-was-showing :to-be-truthy))) @@ -314,24 +315,27 @@ (with-simulated-input "C-j" (ido-completing-read+ "Prompt: " - '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t)) + '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t)) :to-equal "")) ;; "C-j" should NOT be allowed to return an empty string if ;; require-match and default are both non-nil. - (it "should not alow exiting with an empty string if DEF is non-nil" + (it "should not allow exiting with an empty string if DEF is non-nil" (expect (with-simulated-input "C-j" (ido-completing-read+ "Prompt: " - '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t nil nil "yellow")) + '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t nil nil "yellow")) :to-throw)) (it "shouldn't allow C-j to select an ambiguous match" + ;; Make this a no-op to avoid end-of-buffer errors, which are + ;; irrelevant to this test. + (spy-on 'scroll-other-window) (expect (with-simulated-input "b C-j C-j C-j" (ido-completing-read+ "Prompt: " - '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t)) + '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t)) :to-throw) ;; First press of C-j should complete to "blue" after the ;; first b, but then get stuck on the choice for the second b. @@ -355,7 +359,7 @@ (with-simulated-input "b l u e g C-j" (ido-completing-read+ "Prompt: " - '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t)) + '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t)) :to-equal "bluegrass")) (it "should require an extra C-j to exit when `ido-confirm-unique-completion' is non-nil" @@ -366,7 +370,7 @@ (with-simulated-input "b l u e g C-j" (ido-completing-read+ "Prompt: " - '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t)) + '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t)) :to-throw) ;; The first "C-j" should complete to "bluegrass", and the second ;; should return. @@ -374,7 +378,7 @@ (with-simulated-input "b l u e g C-j C-j" (ido-completing-read+ "Prompt: " - '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t)) + '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t)) :to-equal "bluegrass")) ;; Finally, a test for the expected wrong behavior without @@ -385,7 +389,7 @@ (with-simulated-input "b C-j" (ido-completing-read "Prompt: " - '("bluebird" "blues" "bluegrass" "blueberry" "yellow ""green") nil t)) + '("bluebird" "blues" "bluegrass" "blueberry" "yellow" "green") nil t)) :to-equal "b"))) (describe "when INHERIT-INPUT-METHOD is non-nil" @@ -507,9 +511,9 @@ (it "should do a dynamic update when idle" (expect (with-simulated-input - '("h" - (wsi-simulate-idle-time (1+ ido-cr+-dynamic-update-idle-time)) - "-ld RET") + ("h" + (wsi-simulate-idle-time (1+ ido-cr+-dynamic-update-idle-time)) + "-ld RET") (ido-completing-read+ "Say something: " my-dynamic-collection)) :to-equal "hello-world") @@ -527,7 +531,7 @@ (it "should not exit with a unique match if new matches are dynamically added" (expect - (with-simulated-input '("hell TAB -ld RET") + (with-simulated-input ("hell TAB -ld RET") (ido-completing-read+ "Say something: " my-dynamic-collection)) :to-equal "hello-world") @@ -536,7 +540,7 @@ (it "should exit with a match that is still unique after dynamic updating" (expect - (with-simulated-input '("helic TAB") + (with-simulated-input ("helic TAB") (ido-completing-read+ "Say something: " my-dynamic-collection)) :to-equal "helicopter") @@ -556,7 +560,7 @@ ;; was not being debugged. (debug-on-error nil)) (expect - (with-simulated-input '("hell TAB RET") + (with-simulated-input ("hell TAB RET") (ido-completing-read+ "Say something: " collection)) :to-equal "hello"))) @@ -601,10 +605,53 @@ (with-simulated-input "eee C-SPC aaa C-u C-SPC ccc C-u C-SPC ggg RET" (ido-completing-read+ "Pick: " (collection-as-function collection) nil t nil nil (car collection))) - :to-equal "bbb-eee-ggg")))) + :to-equal "bbb-eee-ggg"))) + + ;; It turns out that even `completing-read' can't handle this + ;; ridiculousness, so I'm not going to worry about it unless it + ;; becomes a problem in practice. + (xit "should allow exiting with a match that is only detected by `test-completion'" + (let* ((real-collection '("blue" "yellow" "brown")) + ;; A special dynamic collection function that always + ;; returns nil except for `test-completion'. + (special-collection-function + (lambda (string predicate action) + (pcase action + ('metadata nil) + (`(boundaries . _) nil) + ;; `try-completion' + ('nil nil) + ;; `all-completions' + ('t nil) + ;; `test-completion' + (_ (test-completion string real-collection predicate)))))) + ;; Verify that the collection exhibits the desired + ;; pathological behavior + (expect + (all-completions "" special-collection-function) + :to-equal nil) + (expect + (all-completions "yellow" special-collection-function) + :to-equal nil) + (expect + (try-completion "yellow" special-collection-function) + :to-equal nil) + (expect + (test-completion "yellow" special-collection-function) + :to-equal t) + (expect + ;; Unambiguous input, but the collection function only + ;; accepts exact matches, so this should fail. + (with-simulated-input "yel RET RET RET" + (ido-completing-read+ "Pick: " special-collection-function nil t)) + :to-throw 'error) + (expect + (with-simulated-input "yellow RET" + (ido-completing-read+ "Pick: " special-collection-function nil t)) + :to-equal "yellow")))) (describe "with unusual inputs" - (it "should accept a COLLECTION of symbols" + (it "should accept symbols in COLLECTION" (expect (with-simulated-input "g RET" (ido-completing-read+ "Prompt: " '(blue yellow green))) @@ -678,200 +725,200 @@ (command-execute 'test-command))) :to-equal "g")) - (describe "with `ido-cr+-function-blacklist'" + (describe "with `ido-cr+-disable-list'" (before-all - (setf (symbol-function 'blacklisted-command) + (setf (symbol-function 'disabled-command) (lambda (arg) (interactive (list (completing-read "Prompt: " '("blue" "yellow" "green")))) arg) - (symbol-function 'blacklisted-function) + (symbol-function 'disabled-function) (lambda () (completing-read "Prompt: " '("blue" "yellow" "green"))) - (symbol-function 'cmd-that-calls-blacklisted-function) + (symbol-function 'cmd-that-calls-disabled-function) (lambda () (interactive) - (funcall 'blacklisted-function)) - (symbol-function 'blacklisted-collection) + (funcall 'disabled-function)) + (symbol-function 'disabled-collection) (collection-as-function '("blue" "yellow" "green")))) (after-all - (setf (symbol-function 'blacklisted-command) nil - (symbol-function 'blacklisted-function) nil - (symbol-function 'cmd-that-calls-blacklisted-function) nil - (symbol-function 'blacklisted-collection) nil)) - ;; First verify that they work normally before blacklisting them - (describe "when the specified functions are not blacklisted" - - (it "should not affect a non-blacklisted command" - (expect - (with-simulated-input "g RET" - (call-interactively 'blacklisted-command)) + (setf (symbol-function 'disabled-command) nil + (symbol-function 'disabled-function) nil + (symbol-function 'cmd-that-calls-disabled-function) nil + (symbol-function 'disabled-collection) nil)) + ;; First verify that they work normally before disabling them + (describe "when the specified functions are not disabled" + + (it "should not affect a non-disabled command" + (expect + (with-simulated-input "g RET" + (call-interactively 'disabled-command)) :to-equal "green")) - (it "should not affect a non-blacklisted function" - (expect - (with-simulated-input "g RET" - (call-interactively 'cmd-that-calls-blacklisted-function)) + (it "should not affect a non-disabled function" + (expect + (with-simulated-input "g RET" + (call-interactively 'cmd-that-calls-disabled-function)) :to-equal "green")) - (it "should not affect a non-blacklisted collection" - (expect - (with-simulated-input "g RET" - (ido-completing-read+ "Prompt: " 'blacklisted-collection)) + (it "should not affect a non-disabled collection" + (expect + (with-simulated-input "g RET" + (ido-completing-read+ "Prompt: " 'disabled-collection)) :to-equal "green"))) - (describe "when the specified functions are blacklisted" + (describe "when the specified functions are disabled" (before-each - (setq ido-cr+-function-blacklist - (append '(blacklisted-command - blacklisted-function - blacklisted-collection) - ido-cr+-function-blacklist))) - - (it "should prevent ido in a blacklisted command" - (expect - (with-simulated-input "g RET" - (call-interactively 'blacklisted-command)) + (setq ido-cr+-disable-list + (append '(disabled-command + disabled-function + disabled-collection) + ido-cr+-disable-list))) + + (it "should prevent ido in a disabled command" + (expect + (with-simulated-input "g RET" + (call-interactively 'disabled-command)) :to-equal "g")) - (it "should prevent ido in a blacklisted function" - (expect - (with-simulated-input "g RET" - (call-interactively 'cmd-that-calls-blacklisted-function)) + (it "should prevent ido in a disabled function" + (expect + (with-simulated-input "g RET" + (call-interactively 'cmd-that-calls-disabled-function)) :to-equal "g")) - (it "should prevent ido with a blacklisted collection" - (expect - (with-simulated-input "g RET" - (ido-completing-read+ "Prompt: " 'blacklisted-collection)) + (it "should prevent ido with a disabled collection" + (expect + (with-simulated-input "g RET" + (ido-completing-read+ "Prompt: " 'disabled-collection)) :to-equal "g"))) (describe "when updating ido-cr+" (before-each - (spy-on 'ido-cr+-update-blacklist :and-call-through)) - - (it "should update the blacklist when `ido-cr+-auto-update-blacklist' is t" - (assume ido-cr+-function-blacklist) - (let ((orig-blacklist ido-cr+-function-blacklist)) - (customize-set-variable 'ido-cr+-auto-update-blacklist t) - (customize-set-variable 'ido-cr+-function-blacklist nil) - (ido-cr+-maybe-update-blacklist) - (expect 'ido-cr+-update-blacklist :to-have-been-called) - (expect ido-cr+-function-blacklist :to-have-same-items-as orig-blacklist))) - (it "should not update the blacklist when `ido-cr+-auto-update-blacklist' is nil" - (assume ido-cr+-function-blacklist) - (let ((orig-blacklist ido-cr+-function-blacklist)) - (customize-set-variable 'ido-cr+-auto-update-blacklist nil) - (customize-set-variable 'ido-cr+-function-blacklist nil) - (ido-cr+-maybe-update-blacklist) - (expect 'ido-cr+-update-blacklist :not :to-have-been-called) - (expect ido-cr+-function-blacklist :to-have-same-items-as nil))) - - (it "should notify about blacklist updates when `ido-cr+-auto-update-blacklist' is `notify'" - (assume ido-cr+-function-blacklist) + (spy-on 'ido-cr+-update-disable-list :and-call-through)) + + (it "should update the disable list when `ido-cr+-auto-update-disable-list' is t" + (assume ido-cr+-disable-list) + (let ((orig-disable-list ido-cr+-disable-list)) + (customize-set-variable 'ido-cr+-auto-update-disable-list t) + (customize-set-variable 'ido-cr+-disable-list nil) + (ido-cr+-maybe-update-disable-list) + (expect 'ido-cr+-update-disable-list :to-have-been-called) + (expect ido-cr+-disable-list :to-have-same-items-as orig-disable-list))) + (it "should not update the disable list when `ido-cr+-auto-update-disable-list' is nil" + (assume ido-cr+-disable-list) + (let ((orig-disable-list ido-cr+-disable-list)) + (customize-set-variable 'ido-cr+-auto-update-disable-list nil) + (customize-set-variable 'ido-cr+-disable-list nil) + (ido-cr+-maybe-update-disable-list) + (expect 'ido-cr+-update-disable-list :not :to-have-been-called) + (expect ido-cr+-disable-list :to-have-same-items-as nil))) + + (it "should notify about disable list updates when `ido-cr+-auto-update-disable-list' is `notify'" + (assume ido-cr+-disable-list) (spy-on 'display-warning) - (let ((orig-blacklist ido-cr+-function-blacklist)) - (customize-set-variable 'ido-cr+-auto-update-blacklist 'notify) - (customize-set-variable 'ido-cr+-function-blacklist nil) - (ido-cr+-maybe-update-blacklist) - (expect 'ido-cr+-update-blacklist :not :to-have-been-called) + (let ((orig-disable-list ido-cr+-disable-list)) + (customize-set-variable 'ido-cr+-auto-update-disable-list 'notify) + (customize-set-variable 'ido-cr+-disable-list nil) + (ido-cr+-maybe-update-disable-list) + (expect 'ido-cr+-update-disable-list :not :to-have-been-called) (expect 'display-warning :to-have-been-called) - (expect ido-cr+-function-blacklist :to-have-same-items-as nil))))) - - (describe "with `ido-cr+-function-whitelist'" + (expect ido-cr+-disable-list :to-have-same-items-as nil))))) + + (describe "with `ido-cr+-allow-list'" (before-all - (setf (symbol-function 'whitelisted-command) + (setf (symbol-function 'allowed-command) (lambda (arg) (interactive (list (completing-read "Prompt: " '("blue" "yellow" "green")))) arg) - (symbol-function 'whitelisted-function) + (symbol-function 'allowed-function) (lambda () (completing-read "Prompt: " '("blue" "yellow" "green"))) - (symbol-function 'cmd-that-calls-whitelisted-function) + (symbol-function 'cmd-that-calls-allowed-function) (lambda () (interactive) - (funcall 'whitelisted-function)) - (symbol-function 'whitelisted-collection) + (funcall 'allowed-function)) + (symbol-function 'allowed-collection) (lambda (string pred action) (complete-with-action action '("blue" "yellow" "green") string pred)))) (after-all - (setf (symbol-function 'whitelisted-command) nil - (symbol-function 'whitelisted-function) nil - (symbol-function 'cmd-that-calls-whitelisted-function) nil - (symbol-function 'whitelisted-collection) nil)) - - (describe "when the whitelist is inactive (i.e. everything is whitelisted)" + (setf (symbol-function 'allowed-command) nil + (symbol-function 'allowed-function) nil + (symbol-function 'cmd-that-calls-allowed-function) nil + (symbol-function 'allowed-collection) nil)) + + (describe "when the allow list is inactive (i.e. everything is allowed)" (before-each - (setq ido-cr+-function-whitelist nil)) + (setq ido-cr+-allow-list nil)) (it "should enable ido in a command" (expect (with-simulated-input "g RET" - (call-interactively 'whitelisted-command)) + (call-interactively 'allowed-command)) :to-equal "green")) (it "should enable ido in a function" (expect (with-simulated-input "g RET" - (call-interactively 'cmd-that-calls-whitelisted-function)) + (call-interactively 'cmd-that-calls-allowed-function)) :to-equal "green")) (it "should enable ido for a collection" (expect (with-simulated-input "g RET" - (ido-completing-read+ "Prompt: " 'whitelisted-collection)) + (ido-completing-read+ "Prompt: " 'allowed-collection)) :to-equal "green"))) - (describe "when the specified functions are whitelisted" + (describe "when the specified functions are allowed" (before-each - (setq ido-cr+-function-whitelist - (append '(whitelisted-command - whitelisted-function - whitelisted-collection) - ido-cr+-function-whitelist))) - - (it "should enable ido in a whitelisted command" - (expect - (with-simulated-input "g RET" - (call-interactively 'whitelisted-command)) + (setq ido-cr+-allow-list + (append '(allowed-command + allowed-function + allowed-collection) + ido-cr+-allow-list))) + + (it "should enable ido in an allowed command" + (expect + (with-simulated-input "g RET" + (call-interactively 'allowed-command)) :to-equal "green")) - (it "should enable ido in a whitelisted function" - (expect - (with-simulated-input "g RET" - (call-interactively 'cmd-that-calls-whitelisted-function)) + (it "should enable ido in an allowed function" + (expect + (with-simulated-input "g RET" + (call-interactively 'cmd-that-calls-allowed-function)) :to-equal "green")) - (it "should enable ido for a whitelisted collection" - (expect - (with-simulated-input "g RET" - (ido-completing-read+ "Prompt: " 'whitelisted-collection)) + (it "should enable ido for an allowed collection" + (expect + (with-simulated-input "g RET" + (ido-completing-read+ "Prompt: " 'allowed-collection)) :to-equal "green"))) - (describe "when the whitelist is active but empty (i.e. nothing whitelisted)" + (describe "when the allow list is active but empty (i.e. nothing allowed)" (before-each - (setq ido-cr+-function-whitelist (list nil))) + (setq ido-cr+-allow-list (list nil))) (it "should prevent ido in a command" (expect (with-simulated-input "g RET" - (call-interactively 'whitelisted-command)) + (call-interactively 'allowed-command)) :to-equal "g")) (it "should prevent ido in a function" (expect (with-simulated-input "g RET" - (call-interactively 'cmd-that-calls-whitelisted-function)) + (call-interactively 'cmd-that-calls-allowed-function)) :to-equal "g")) (it "should prevent ido for a collection" (expect (with-simulated-input "g RET" - (ido-completing-read+ "Prompt: " 'whitelisted-collection)) + (ido-completing-read+ "Prompt: " 'allowed-collection)) :to-equal "g")))) (describe "with `ido-cr+-nil-def-alternate-behavior-list'" @@ -972,32 +1019,34 @@ :not :to-throw))) (describe "regressions should not occur for" - (it "issue #151: should not hang or error when cycling matches in `Info-menu'" + ;; Disabled because I think the nix CI emacs has no info pages, so + ;; the completion for `Info-menu' has nothing to do. However, this + ;; should be thoroughly fixed by now. + (xit "issue #151: should not hang or error when cycling matches in `Info-menu'" (expect (progn (ido-ubiquitous-mode 1) (with-temp-info-buffer - (with-simulated-input - '("emacs" - (ido-next-match) - (wsi-simulate-idle-time 5) - (ido-next-match) - (wsi-simulate-idle-time 5) - (ido-next-match) - (wsi-simulate-idle-time 5) - (ido-next-match) - (wsi-simulate-idle-time 5) - "RET") - (command-execute 'Info-menu)))) + (with-simulated-input + '((ido-next-match) + (wsi-simulate-idle-time 5) + (ido-next-match) + (wsi-simulate-idle-time 5) + (ido-next-match) + (wsi-simulate-idle-time 5) + (ido-next-match) + (wsi-simulate-idle-time 5) + "RET") + (command-execute 'Info-menu)))) :not :to-throw)) (it "issue #153: should preserve the selected item when doing a deferred dynamic update" (expect (with-simulated-input - '("Emacs" - (ido-next-match) - (wsi-simulate-idle-time 5) - "RET") + ("Emacs" + (ido-next-match) + (wsi-simulate-idle-time 5) + "RET") (ido-completing-read+ "Choose: " (collection-as-function '("Emacs" "Emacs A" "Emacs B" "Emacs C")))) diff --git a/tests-with-flx-ido/test-ido-completing-read+-with-flx-ido.el b/tests-with-flx-ido/test-ido-completing-read+-with-flx-ido.el index 08ff6ee..42b5824 100644 --- a/tests-with-flx-ido/test-ido-completing-read+-with-flx-ido.el +++ b/tests-with-flx-ido/test-ido-completing-read+-with-flx-ido.el @@ -15,6 +15,9 @@ (require 'buttercup) (require 'cl-lib) (require 'with-simulated-input) +(require 's) + +(defvar my-dynamic-collection nil) (defun collection-as-function (collection) "Return a function equivalent to COLLECTION. @@ -127,11 +130,11 @@ ((ido-mode t) (ido-ubiquitous-mode t) (ido-cr+-debug-mode t) - ido-cr+-auto-update-blacklist + ido-cr+-auto-update-disable-list ido-cr+-fallback-function ido-cr+-max-items - ido-cr+-function-blacklist - ido-cr+-function-whitelist + ido-cr+-disable-list + ido-cr+-allow-list ido-cr+-nil-def-alternate-behavior-list ido-cr+-replace-completely ido-confirm-unique-completion @@ -206,9 +209,9 @@ (it "should do a dynamic update when idle" (expect (with-simulated-input - '("h" - (wsi-simulate-idle-time (1+ ido-cr+-dynamic-update-idle-time)) - "-ld RET") + ("h" + (wsi-simulate-idle-time (1+ ido-cr+-dynamic-update-idle-time)) + "-ld RET") (ido-completing-read+ "Say something: " my-dynamic-collection)) :to-equal "hello-world") @@ -226,7 +229,7 @@ (it "should not exit with a unique match if new matches are dynamically added" (expect - (with-simulated-input '("hell TAB -ld RET") + (with-simulated-input ("hell TAB -ld RET") (ido-completing-read+ "Say something: " my-dynamic-collection)) :to-equal "hello-world") @@ -235,7 +238,7 @@ (it "should exit with a match that is still unique after dynamic updating" (expect - (with-simulated-input '("helic TAB") + (with-simulated-input ("helic TAB") (ido-completing-read+ "Say something: " my-dynamic-collection)) :to-equal "helicopter")