Skip to content

Commit

Permalink
Allow overriding REQUIRE-MATCH completing-read arg for a specific
Browse files Browse the repository at this point in the history
function.

In Emacs-29+ describe-function completing-read uses 'confirm as value
for its require-match arg for allowing user to describe a function not
already defined i.e. an advice defined before the function is defined.
As a result we end up with an unknow candidate on top and user needs
to go to next line to avoid pressing RET on such annoying candidate.
Anyway describe-function is matching this unknown function even with
require-match = t and allow pressing RET on it to have the
description.

We use now a new var helm-comp-read-require-match-overrides to allow
overriding require-match arg if needed.

See Emacs bug#64902.
  • Loading branch information
thierryvolpiatto committed Jul 29, 2023
1 parent 2b7632a commit 4cfa25d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions helm-mode.el
Expand Up @@ -1298,7 +1298,10 @@ ARG-LIST is a list of arguments to pass to HANDLER."
;; minibuffer-complete one time for all [1].
(cl-letf (((symbol-function 'minibuffer-complete) #'ignore))
(apply handler arg-list)))


(defvar helm-comp-read-require-match-overrides '((describe-function . t))
"Allow overriding REQUIRE-MATCH completing-read arg for a specific function.")

(cl-defun helm--completing-read-default
(prompt collection &optional
predicate require-match
Expand All @@ -1319,7 +1322,10 @@ See documentation of `completing-read' and `all-completions' for details."
helm-completing-read-handlers-alist))
(def-com (helm-mode--get-default-handler-for 'comp entry))
(str-defcom (and def-com (helm-symbol-name def-com)))
(def-args (list prompt collection predicate require-match
(def-args (list prompt collection predicate
(helm-aif (assq current-command
helm-comp-read-require-match-overrides)
(cdr it) require-match)
initial-input hist def inherit-input-method))
;; Append the two extra args needed to set the buffer and source name
;; in helm specialized functions.
Expand Down

0 comments on commit 4cfa25d

Please sign in to comment.