diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el index 6bd763d2ea2..a1c7175fc66 100644 --- a/lisp/emacs-lisp/crm.el +++ b/lisp/emacs-lisp/crm.el @@ -255,14 +255,11 @@ with empty strings removed." crm-local-must-match-map crm-local-completion-map)) (map (minibuffer-visible-completions--maybe-compose-map map)) - (buffer (current-buffer)) input) (minibuffer-with-setup-hook (lambda () (add-hook 'choose-completion-string-functions 'crm--choose-completion-string nil 'local) - (setq-local minibuffer-completion-table #'crm--collection-fn) - (setq-local minibuffer-completion-predicate predicate) (setq-local completion-list-insert-choice-function (lambda (_start _end choice) (let* ((beg (save-excursion @@ -276,14 +273,9 @@ with empty strings removed." (1- (point)) (point-max))))) (completion--replace beg end choice)))) - ;; see completing_read in src/minibuf.c - (setq-local minibuffer-completion-confirm - (unless (eq require-match t) require-match)) - (setq-local minibuffer--require-match require-match) - (setq-local minibuffer--original-buffer buffer) (setq-local crm-completion-table table) - (completions--start-eager-display)) - (setq input (read-from-minibuffer + (use-local-map map)) + (setq input (completing-read (format-spec crm-prompt (let* ((sep (or (get-text-property 0 'separator crm-separator) @@ -291,11 +283,8 @@ with empty strings removed." (desc (or (get-text-property 0 'description crm-separator) (concat "list separated by " sep)))) `((?s . ,sep) (?d . ,desc) (?p . ,prompt)))) - initial-input map nil hist def inherit-input-method))) - ;; If the user enters empty input, `read-from-minibuffer' - ;; returns the empty string, not DEF. - (when (and def (string-equal input "")) - (setq input (if (consp def) (car def) def))) + #'crm--collection-fn predicate + require-match initial-input hist def inherit-input-method))) ;; Remove empty strings in the list of read strings. (split-string input crm-separator t)))