|
@@ -6,7 +6,7 @@
|
|
;; Author: Ryan Thompson
|
|
;; Author: Ryan Thompson
|
|
;; Created: Sat Apr 4 13:41:20 2015 (-0700)
|
|
;; Created: Sat Apr 4 13:41:20 2015 (-0700)
|
|
;; Version: 4.13
|
|
;; Version: 4.13
|
|
-;; Package-Requires: ((emacs "24.4") (cl-lib "0.5") (memoize "1.1"))
|
|
|
|
|
|
+;; Package-Requires: ((emacs "24.4") (seq "0.5") (cl-lib "0.5") (memoize "1.1"))
|
|
;; URL: https://github.com/DarwinAwardWinner/ido-completing-read-plus
|
|
;; URL: https://github.com/DarwinAwardWinner/ido-completing-read-plus
|
|
;; Keywords: ido, completion, convenience
|
|
;; Keywords: ido, completion, convenience
|
|
|
|
|
|
@@ -108,6 +108,10 @@ Debug info is printed to the *Messages* buffer."
|
|
:group 'ido-completing-read-plus)
|
|
:group 'ido-completing-read-plus)
|
|
|
|
|
|
(defsubst ido-cr+--debug-message (format-string &rest args)
|
|
(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
|
|
(when ido-cr+-debug-mode
|
|
(apply #'message (concat "ido-completing-read+: " format-string) args)))
|
|
(apply #'message (concat "ido-completing-read+: " format-string) args)))
|
|
|
|
|
|
@@ -118,7 +122,7 @@ Debug info is printed to the *Messages* buffer."
|
|
;; ido.el.
|
|
;; ido.el.
|
|
|
|
|
|
(defmacro define-ido-internal-var (symbol &optional initvalue docstring)
|
|
(defmacro define-ido-internal-var (symbol &optional initvalue docstring)
|
|
- "Declare and initialize an ido internal variable.
|
|
|
|
|
|
+ "Declare and initialize SYMBOL an ido internal variable.
|
|
|
|
|
|
This is used to suppress byte-compilation warnings about
|
|
This is used to suppress byte-compilation warnings about
|
|
reference to free variables when ido-cr+ attempts to access
|
|
reference to free variables when ido-cr+ attempts to access
|
|
@@ -194,7 +198,7 @@ dynamically.")
|
|
"Idle timer for updating dynamic completion list.")
|
|
"Idle timer for updating dynamic completion list.")
|
|
|
|
|
|
(defvar ido-cr+-exhibit-pending nil
|
|
(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
|
|
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'
|
|
other times, since those two functions are in `pre-command-hook'
|
|
@@ -248,7 +252,7 @@ pattern used to restrict.")
|
|
ido-ubiquitous-completing-read))
|
|
ido-ubiquitous-completing-read))
|
|
'completing-read-default
|
|
'completing-read-default
|
|
completing-read-function)
|
|
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
|
|
This will be used for functions that are incompatible with ido
|
|
or if ido cannot handle the completion arguments. It will also be
|
|
or if ido cannot handle the completion arguments. It will also be
|
|
@@ -408,8 +412,10 @@ https://github.com/DarwinAwardWinner/ido-completing-read-plus/issues"
|
|
(define-error 'ido-cr+-fallback "ido-cr+-fallback")
|
|
(define-error 'ido-cr+-fallback "ido-cr+-fallback")
|
|
|
|
|
|
(defsubst ido-cr+--explain-fallback (arg)
|
|
(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 ido-cr+-debug-mode
|
|
(when (and (listp arg)
|
|
(when (and (listp arg)
|
|
(eq (car arg) 'ido-cr+-fallback))
|
|
(eq (car arg) 'ido-cr+-fallback))
|
|
@@ -419,11 +425,11 @@ https://github.com/DarwinAwardWinner/ido-completing-read-plus/issues"
|
|
|
|
|
|
;;;###autoload
|
|
;;;###autoload
|
|
(defsubst ido-cr+-active ()
|
|
(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)))
|
|
(>= ido-cr+-minibuffer-depth (minibuffer-depth)))
|
|
|
|
|
|
(defun ido-cr+--called-from-completing-read ()
|
|
(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+))
|
|
(equal (cadr (backtrace-frame 1 'ido-completing-read+))
|
|
'completing-read))
|
|
'completing-read))
|
|
|
|
|
|
@@ -436,7 +442,9 @@ how the matching is done.
|
|
|
|
|
|
This is declared as macro only in order to extract the variable
|
|
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
|
|
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)
|
|
(when (null list-name)
|
|
(if (symbolp fun-list)
|
|
(if (symbolp fun-list)
|
|
(setq list-name (symbol-name fun-list))
|
|
(setq list-name (symbol-name fun-list))
|
|
@@ -487,14 +495,16 @@ See `ido-cr+-function-whitelist'."
|
|
(defun ido-completing-read+ (prompt collection &optional predicate
|
|
(defun ido-completing-read+ (prompt collection &optional predicate
|
|
require-match initial-input
|
|
require-match initial-input
|
|
hist def inherit-input-method)
|
|
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.
|
|
See `completing-read' for the meaning of the arguments.
|
|
|
|
|
|
This function is a wrapper for `ido-completing-read' designed to
|
|
This function is a wrapper for `ido-completing-read' designed to
|
|
be used as the value of `completing-read-function'. Importantly,
|
|
be used as the value of `completing-read-function'. Importantly,
|
|
it detects edge cases that ido cannot handle and uses normal
|
|
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
|
|
(let* (;; Save the original arguments in case we need to do the
|
|
;; fallback
|
|
;; fallback
|
|
(ido-cr+-orig-completing-read-args
|
|
(ido-cr+-orig-completing-read-args
|
|
@@ -814,10 +824,12 @@ called through ido-cr+."
|
|
#'ido-select-text@ido-cr+-fix-require-match)
|
|
#'ido-select-text@ido-cr+-fix-require-match)
|
|
|
|
|
|
(defun ido-tidy@ido-cr+-set-exhibit-pending (&rest _args)
|
|
(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))
|
|
(setq ido-cr+-exhibit-pending t))
|
|
(advice-add 'ido-tidy :after 'ido-tidy@ido-cr+-set-exhibit-pending)
|
|
(advice-add 'ido-tidy :after 'ido-tidy@ido-cr+-set-exhibit-pending)
|
|
|
|
|
|
(defun ido-exhibit@ido-cr+-clear-exhibit-pending (&rest _args)
|
|
(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))
|
|
(setq ido-cr+-exhibit-pending nil))
|
|
(advice-add 'ido-exhibit :before 'ido-exhibit@ido-cr+-clear-exhibit-pending)
|
|
(advice-add 'ido-exhibit :before 'ido-exhibit@ido-cr+-clear-exhibit-pending)
|
|
|
|
|
|
@@ -889,7 +901,7 @@ result."
|
|
filtered-collection)))
|
|
filtered-collection)))
|
|
|
|
|
|
(defun ido-cr+-cyclicp (x)
|
|
(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
|
|
(cl-loop
|
|
for tortoise on x
|
|
for tortoise on x
|
|
for hare on (cdr x) by #'cddr
|
|
for hare on (cdr x) by #'cddr
|
|
@@ -1004,7 +1016,7 @@ This has no effect unless `ido-cr+-dynamic-collection' is non-nil."
|
|
#'ido-cr+-update-dynamic-collection)))))
|
|
#'ido-cr+-update-dynamic-collection)))))
|
|
|
|
|
|
(defun ido-cr+-minibuffer-setup ()
|
|
(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)
|
|
(when (ido-cr+-active)
|
|
(add-hook 'post-command-hook
|
|
(add-hook 'post-command-hook
|
|
'ido-cr+-schedule-dynamic-collection-update)))
|
|
'ido-cr+-schedule-dynamic-collection-update)))
|
|
@@ -1036,7 +1048,7 @@ This has no effect unless `ido-cr+-dynamic-collection' is non-nil."
|
|
;; dynamically-added completions are also properly restricted.
|
|
;; dynamically-added completions are also properly restricted.
|
|
(defun ido-restrict-to-matches@ido-cr+-record-restriction
|
|
(defun ido-restrict-to-matches@ido-cr+-record-restriction
|
|
(&optional removep)
|
|
(&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'"
|
|
(ido-cr+--debug-message "Appending restriction %S to `ido-cr+-active-restrictions'"
|
|
(cons removep ido-text))
|
|
(cons removep ido-text))
|
|
(add-to-list 'ido-cr+-active-restrictions (cons removep ido-text) t))
|
|
(add-to-list 'ido-cr+-active-restrictions (cons removep ido-text) t))
|
|
@@ -1047,7 +1059,7 @@ This has no effect unless `ido-cr+-dynamic-collection' is non-nil."
|
|
;; default when the input is empty and the empty string is the
|
|
;; default when the input is empty and the empty string is the
|
|
;; selected choice
|
|
;; selected choice
|
|
(defun minibuf-eldef-update-minibuffer@ido-cr+-compat (orig-fun &rest args)
|
|
(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)
|
|
(if (ido-cr+-active)
|
|
(unless (eq minibuf-eldef-showing-default-in-prompt
|
|
(unless (eq minibuf-eldef-showing-default-in-prompt
|
|
(and (string= (car ido-cur-list) "")
|
|
(and (string= (car ido-cur-list) "")
|
|
@@ -1083,9 +1095,9 @@ when ido completion is or is not used by customizing
|
|
|
|
|
|
This variable has 3 possible values, with the following meanings:
|
|
This variable has 3 possible values, with the following meanings:
|
|
|
|
|
|
- `t': Auto-update the blacklist
|
|
|
|
|
|
+ t: Auto-update the blacklist
|
|
`notify': Notify you about updates but do not apply them
|
|
`notify': Notify you about updates but do not apply them
|
|
- `nil': Ignore all blacklist updates
|
|
|
|
|
|
+ nil: Ignore all blacklist updates
|
|
|
|
|
|
Ido-cr+ comes with a default blacklist for commands that are
|
|
Ido-cr+ comes with a default blacklist for commands that are
|
|
known to be incompatible with ido completion. New versions of
|
|
known to be incompatible with ido completion. New versions of
|
|
@@ -1094,19 +1106,18 @@ incompatible commands are discovered. However, customizing your
|
|
own overrides would normally prevent you from receiving these
|
|
own overrides would normally prevent you from receiving these
|
|
updates, since Emacs will not overwrite your customizations.
|
|
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.
|
|
|
|
|
|
+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
|
|
If you want ido-cr+ to just notify you about new default
|
|
overrides instead of adding them itself, set this variable to
|
|
overrides instead of adding them itself, set this variable to
|
|
`notify'. If you don't want this auto-update behavior at all, set
|
|
`notify'. If you don't want this auto-update behavior at all, set
|
|
-it to `nil'.
|
|
|
|
|
|
+it to nil.
|
|
|
|
|
|
-(Note that having this option enabled effectively prevents you
|
|
|
|
|
|
+\(Note that having this option enabled effectively prevents you
|
|
from removing any of the built-in default blacklist entries,
|
|
from removing any of the built-in default blacklist entries,
|
|
since they will simply be re-added the next time Emacs starts.)"
|
|
since they will simply be re-added the next time Emacs starts.)"
|
|
:type '(choice :tag "When new overrides are available:"
|
|
:type '(choice :tag "When new overrides are available:"
|
|
@@ -1132,6 +1143,9 @@ If SAVE is non-nil, also save the new blacklist to the user's
|
|
Custom file (but only if it was already customized beforehand).
|
|
Custom file (but only if it was already customized beforehand).
|
|
When called interactively, a prefix argument triggers a save.
|
|
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
|
|
When called from Lisp code, this function returns non-nil if the
|
|
blacklist was modified."
|
|
blacklist was modified."
|
|
(interactive "P")
|
|
(interactive "P")
|