From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#44016: 28.0.50; Add new "gnus-search" search interface to Gnus Date: Mon, 02 Nov 2020 08:16:48 -0800 Message-ID: <87blgfbuof.fsf@ericabrahamsen.net> References: <877drrigg6.fsf@ericabrahamsen.net> <87k0vqsqol.fsf@gnus.org> <87tuuu5fyf.fsf@ericabrahamsen.net> <874km9d4mc.fsf@ericabrahamsen.net> <87o8kgbvv6.fsf@ericabrahamsen.net> <87k0v4bezb.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6042"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 44016@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 02 17:17:14 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZcWA-0001RW-8G for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Nov 2020 17:17:14 +0100 Original-Received: from localhost ([::1]:42894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZcW8-0005rZ-UQ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Nov 2020 11:17:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZcVy-0005r8-S4 for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2020 11:17:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59032) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZcVy-0007Ih-Ie for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2020 11:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kZcVy-00006k-Ey for bug-gnu-emacs@gnu.org; Mon, 02 Nov 2020 11:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Nov 2020 16:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44016 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 44016-submit@debbugs.gnu.org id=B44016.1604333819400 (code B ref 44016); Mon, 02 Nov 2020 16:17:02 +0000 Original-Received: (at 44016) by debbugs.gnu.org; 2 Nov 2020 16:16:59 +0000 Original-Received: from localhost ([127.0.0.1]:42345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZcVv-00006O-IH for submit@debbugs.gnu.org; Mon, 02 Nov 2020 11:16:59 -0500 Original-Received: from ericabrahamsen.net ([52.70.2.18]:53004 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kZcVu-00006B-6M for 44016@debbugs.gnu.org; Mon, 02 Nov 2020 11:16:58 -0500 Original-Received: from localhost (c-73-254-86-141.hsd1.wa.comcast.net [73.254.86.141]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 81CB0FA086; Mon, 2 Nov 2020 16:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericabrahamsen.net; s=mail; t=1604333810; bh=lc8M/HSP8sHaUrQT3lWRza8FWBqORw7EOusYu6tHpAU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=GaE5VMzxJUccrVlRkC/yLDXk+JUqByg5o5yv4uT3d3Nd5aZ2a91yJ9kmVuVotfXGR g9ngB4fiVzoPaFgbhXfSn9qPlQ1KKUiM+56z5GLx5dOvPUD/2HUfHIk6mepLe0Ci0p 0cubviBJd9iIHEm8fDCEiAiDbm5qUpscdyXs+A7U= In-Reply-To: (Stefan Monnier's message of "Mon, 02 Nov 2020 09:24:23 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:192546 Archived-At: Stefan Monnier writes: >> (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. The return value for multiple matches is not a proper list (looks like ("subject" "since" . 0)), so I couldn't use `length' on it. That and the fact that the strings have a face property made it seem like the function wasn't really meant for what I was doing with it >> 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. I'll wait and see if that's a problem. If I'm expecting a completion style that completes hyphenated strings ("con-f" -> "contact-from") and the user has removed that style it could be an issue. I wonder how many users even know about this configuration, though. >>> (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. Yes, I was confusing with `completing-read'. >> 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). Right, it would be much easier just to have a variable where contact-management packages can register a completion table. Now I'm thinking there's no real need for a "contact" key at all, just offer completion on to/from/recipient/etc. Anyway, I've already got the code working, thanks again for the pointers. Eric