Skip to content

ivy.el (ivy--prompt-selectable-p): Fix require-match condition - #1063

Merged
abo-abo merged 1 commit into
abo-abo:masterfrom
fabacino:bugfix/fix-require-match-condition
Jun 9, 2017
Merged

abo-abo merged 1 commit into
abo-abo:masterfrom
fabacino:bugfix/fix-require-match-condition

Conversation

@fabacino

@fabacino fabacino commented Jun 9, 2017

Copy link
Copy Markdown
Contributor

The prompt was not selectable, if predicate :require-match was set to 'confirm or 'confirm-after-completion.

The prompt was not selectable, if predicate :require-match was set to
'confirm or 'confirm-after-completion.
@abo-abo
abo-abo merged commit f494c0a into abo-abo:master Jun 9, 2017
@abo-abo

abo-abo commented Jun 9, 2017

Copy link
Copy Markdown
Owner

Thanks.

@fabacino
fabacino deleted the bugfix/fix-require-match-condition branch June 9, 2017 11:10
basil-conto added a commit to basil-conto/swiper that referenced this pull request Aug 30, 2026
A require-match function was called without arguments, and when it
indicated success the prompt had "(confirm)" appended.  At the same
time, confirm and confirm-after-completion were ignored.

* ivy.el (ivy--prompt-extra): Switch to holding a well-known symbol
value in place of a string.  All uses updated.
(ivy--prompt-extras, ivy-confirm-exit-commands): New variables.
(ivy--old-cands): Clarify docstring.
(ivy--expand-file-name): Don't use beginning-of-line anchor for
matching beginning-of-string.
(ivy--use-selectable-prompt, ivy--prompt-selectable-p):
Remove; use ivy-use-selectable-prompt directly instead.
This makes the prompt selectable even in the presence of
require-match (abo-abo#1059, abo-abo#1063, abo-abo#1924, abo-abo#2364, abo-abo#3059).
(ivy--prompt-selected-p, ivy-next-line, ivy-previous-line)
(ivy--reset-state): Simplify accordingly.
(ivy-done): Exit early when input is empty and there are no matching
candidates, regardless of require-match (abo-abo#909).  If require-match is
a function, call it early, with the input as argument, and display
"(match required)" on failure, not "(confirm)" on
success (abo-abo#3081, abo-abo#3082, abo-abo#3083).  Display "(confirm)" for the
appropriate require-match values of confirm and
confirm-after-completion, using ivy-confirm-exit-commands in
addition to minibuffer-confirm-exit-commands.  Don't force
confirm-nonexistent-file-or-buffer handling on all
read-file-name-internal and internal-complete-buffer
completion (abo-abo#60, abo-abo#76).  Simplify ivy-dispatching-done
condition (abo-abo#2365).
(ivy-tab-space): Mention ivy-partial in docstring.
(ivy-call): Allow require-match functions to reject
ivy-state-current in, e.g., noninteractive test sessions.
(ivy-read, ivy-completing-read)
(ivy-completing-read-with-empty-string-def): Improve docstrings.
(ivy-set-prompt-text-properties-default): Refactor in terms of
ivy--prompt-extras.
(ivy--insert-prompt): Translate ivy--prompt-extra symbols into their
print representation.
(ivy-switch-buffer, ivy-switch-buffer-other-window):
* counsel.el (counsel--find-file-1, counsel-fzf, counsel-file-jump):
Consistently use function confirm-nonexistent-file-or-buffer (abo-abo#60).
(counsel-dired-jump): Require a match; otherwise the action fails.

* ivy-test.el (ivy-test-with): Wrap definition in eval-and-compile
to work around Emacs 25 macroexpansion bug.
(ivy-test-read-matching): New convenience function.
(ivy-completing-read-can-match, ivy-completing-read-must-match)
(ivy-completing-read-confirm, ivy-completing-read-confirm-after)
(ivy-completing-read-must-match-fn): New tests.
(ivy-read-file-name-initial-input): Simplify :require-match.
(ivy-use-selectable-prompt-mustmatch): Rename...
(ivy-use-selectable-prompt-must-match): ...to this.  Extend tests.

* doc/ivy.org (Faces): Generalize description of ivy-confirm-face
and ivy-match-required-face.
* doc/ivy.texi: Regenerate manual.

Fixes abo-abo#3059.
Fixes abo-abo#3081.
Fixes abo-abo#3082.
Closes abo-abo#3083.
basil-conto added a commit to basil-conto/swiper that referenced this pull request Sep 13, 2026
A require-match function was called without arguments, and when it
indicated success the prompt had "(confirm)" appended.  At the same
time, confirm and confirm-after-completion were ignored.

* ivy.el (ivy--prompt-extra): Switch to holding a well-known symbol
value in place of a string.  All uses updated.
(ivy--prompt-extras, ivy-confirm-exit-commands): New variables.
(ivy--old-cands): Clarify docstring.
(ivy--expand-file-name): Don't use beginning-of-line anchor for
matching beginning-of-string.
(ivy--use-selectable-prompt, ivy--prompt-selectable-p):
Remove; use ivy-use-selectable-prompt directly instead.
This makes the prompt selectable even in the presence of
require-match (abo-abo#1059, abo-abo#1063, abo-abo#1924, abo-abo#2364, abo-abo#3059).
(ivy--prompt-selected-p, ivy-next-line, ivy-previous-line)
(ivy--reset-state): Simplify accordingly.
(ivy-done): Exit early when input is empty and there are no matching
candidates, regardless of require-match (abo-abo#909).  If require-match is
a function, call it early, with the input as argument, and display
"(match required)" on failure, not "(confirm)" on
success (abo-abo#3081, abo-abo#3082, abo-abo#3083).  Display "(confirm)" for the
appropriate require-match values of confirm and
confirm-after-completion, using ivy-confirm-exit-commands in
addition to minibuffer-confirm-exit-commands.  Don't force
confirm-nonexistent-file-or-buffer handling on all
read-file-name-internal and internal-complete-buffer
completion (abo-abo#60, abo-abo#76).  Simplify ivy-dispatching-done
condition (abo-abo#2365).
(ivy-tab-space): Mention ivy-partial in docstring.
(ivy-call): Allow require-match functions to reject
ivy-state-current in, e.g., noninteractive test sessions.
(ivy-read, ivy-completing-read)
(ivy-completing-read-with-empty-string-def): Improve docstrings.
(ivy-set-prompt-text-properties-default): Refactor in terms of
ivy--prompt-extras.
(ivy--insert-prompt): Translate ivy--prompt-extra symbols into their
print representation.
(ivy-switch-buffer, ivy-switch-buffer-other-window):
* counsel.el (counsel--find-file-1, counsel-fzf, counsel-file-jump):
Consistently use function confirm-nonexistent-file-or-buffer (abo-abo#60).
(counsel-dired-jump): Require a match; otherwise the action fails.

* ivy-test.el (ivy-test-with): Wrap definition in eval-and-compile
to work around Emacs 25 macroexpansion bug.
(ivy-test-read-matching): New convenience function.
(ivy-completing-read-can-match, ivy-completing-read-must-match)
(ivy-completing-read-confirm, ivy-completing-read-confirm-after)
(ivy-completing-read-must-match-fn): New tests.
(ivy-read-file-name-initial-input): Simplify :require-match.
(ivy-use-selectable-prompt-mustmatch): Rename...
(ivy-use-selectable-prompt-must-match): ...to this.  Extend tests.

* doc/ivy.org (Faces): Generalize description of ivy-confirm-face
and ivy-match-required-face.
* doc/ivy.texi: Regenerate manual.

Fixes abo-abo#3059.
Fixes abo-abo#3081.
Fixes abo-abo#3082.
Closes abo-abo#3083.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants