这是indexloc提供的服务,不要输入任何密码
Skip to content

With ivy-use-selectable-prompt set, can't choose empty input #1924

@DWgit

Description

@DWgit

In ivy-mode with (setq ivy-use-selectable-prompt t), completing-read does not allow ivy-previous-line to choose and accept an empty input. The only way to enter an empty input is the traditional C-M-j.

Here's a minimal test case, derived from a real-world issue with auctex:

;; raw emacs -q case
;; When REQUIRE-MATCH is t, default emacs completing-read allows empty string
(completing-read "prompt: " '("foo" "bar") nil t)

;; ivy case
(require 'ivy)
(ivy-mode 1) 
(setq ivy-use-selectable-prompt t)

;; When REQUIRE-MATCH is t, empty string can be selected with C-M-j but
;; cannot be selected with ivy-previous-line
(completing-read "prompt: " '("foo" "bar") nil t)

;; real-world example from auctex:
;;
;;   User does: C-c C-m parbox, and cannot choose an empty Position with ivy-previous-line
;;
;;   auctex::latex.el:
;;     (completing-read (TeX-argument-prompt optional prompt "Position")
;;                      '(("") ("t") ("b"))
;;                      nil t)
;;  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions