bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44016: 28.0.50; Add new "gnus-search" search interface to Gnus


From: Stefan Monnier
Subject: bug#44016: 28.0.50; Add new "gnus-search" search interface to Gnus
Date: Mon, 02 Nov 2020 09:24:23 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> (the "(consp (cdr (completion-all-completions" bit above definitely
> felt like I was holding the tool upside down),

It's just another way (more efficient) way to write

   (< 1 (length (completion-all-completions ...)))

so it looks fine from where I stand.

> but they're absolutely useful in a programmatic setting.  I wonder if
> there could be some version of these functions that could be "blessed"
> for use in Elisp programs.

They're definitely allowed to be used for ELisp programs.  They're not
100% pure functions, but not too far off.  The main issue I can see for
use "internal use" is that their behavior is influenced by the
`completion-styles` user-config, which may or may not be what you want.

>>     (defvar gnus-search-minibuffer-map
>>       (let ((km (make-sparse-keymap)))
>>         (set-keymap-parent km minibuffer-local-map)
>>         (define-key km (kbd "SPC") #'self-insert-command) ;; Isn't this 
>> redundant?
>
> Somewhere I'd gotten the idea that SPC was bound to
> `minibuffer-complete-word', I don't know how.

I presume you earlier inherited from `minibuffer-local-completion-map`
or something like that.

> Ah, of course! And if `gnus-search--complete-key-data' is conservative
> about when it fires, it leaves the door open for other completion
> functions.

If by "fires" you mean "returns non-nil", then yes, indeed.

> This function could complete "cont" to "contact:", at which
> point (for example) an EBDB-specific capf function could take over and
> complete names or email addresses to search for.

Right.  Or it could itself recognize "contact:" and return the bounds of
the contact info along with EBDB's completion table (since EBDB's
capf presumably doesn't know about the "contact:" syntax).


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]