From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id IGbpF4qjGWA6DwAA0tVLHw (envelope-from ) for ; Tue, 02 Feb 2021 19:10:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qMq1E4qjGWBxVwAAB5/wlQ (envelope-from ) for ; Tue, 02 Feb 2021 19:10:02 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5A717940275 for ; Tue, 2 Feb 2021 19:10:01 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 1430D28CE2; Tue, 2 Feb 2021 14:09:54 -0500 (EST) Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [185.185.170.37]) by mail.notmuchmail.org (Postfix) with ESMTPS id E517A28CA0 for ; Tue, 2 Feb 2021 14:09:50 -0500 (EST) Received: from guru.guru-group.fi (unknown [IPv6:2a02:2380:1:9:5054:ff:feb7:a4bc]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 85FF11B00090; Tue, 2 Feb 2021 21:09:49 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1612292989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CqsMV1AACLdU5E3k+6gXjawfMSYW8+Q/mTXRIzFKi6c=; b=oq5A5GXfwyZ1aq2s1Uphh/EORt3q6ng4dK4rcYinDhwUPNC4zsQPOyGmi5uId6FEXMICSF 0PpWoSBPeSznAuSYnrgQquHUhBwjl3BnYxmOtMtigNz/fw5VhC60tYLKDdjJWZy211PCT4 n83BnWBR2vSMnndv8ZQp/EQdmcv4Nu5mURyVCUuXewmuI9FrwU3frg66Zy5kEfGzF/8o4O is0sl3eqHz0LcWqAfqWNg9UcWEkYkUjVvXZbWs+5lvW4Vx6tmHaSUp4BFeGCnJawBOhEIP ytMUFGf54npm7f8yIwldrZBSvNI2DBiAEpBXUQ4yiGeKl4bpxuZxI7pmM1e7Uw== From: Tomi Ollila To: David Edmondson , David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: When completing tags, offer each tag once In-Reply-To: References: <20210201145402.561245-1-dme@dme.org> <87im7byei7.fsf@tethera.net> User-Agent: Notmuch/0.31.3+85~g92bd77f (https://notmuchmail.org) Emacs/27.1 X-Face: HhBM'cA~ MIME-Version: 1.0 ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1612292989; a=rsa-sha256; cv=none; b=LI5yjutTtpgSRxkg79D6y4oqD/Akl204jMvu9XMNGDK95TC7iF9vjN8OIfKdOMfnGNB91d G+Stc2CAPqnB6oDRnYyvydQFaUCyEN+ttMcgLP3Wm6BMl1nYeyp/SEF138ZkTI0V2PSV9A gArZY6HEV9OjCOKn34i35Kq4bcvT3ABR82vI4Cr+LmqUPo8rrJCw5JDzmC9Cgdrejl54IC J/Lw6CnDCdic7WTRneMI6o2bUNWtHqKjEyzuiN2u23yKCX2frI/6sozd0HIjBvgSrJGtsS xh0UIxl/PE/VNMXqdg9K3Ta7tXuTgF9jQFhK8GomjyMXqdmqn8O7I1MbgMyTEA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1612292989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CqsMV1AACLdU5E3k+6gXjawfMSYW8+Q/mTXRIzFKi6c=; b=NufjfsnA7vUuedgGQVBI75JT6u6xYu+zGtGXVKEG0HOODbfW2Pot0fDPkecjZi7tSKMNMu 36vQkxmnMCv1CWqoWWrWb+AcBB0degsGLEipRRfZ0kdhPuoFxbeodNm6/gYF7X8iZPouxz zx2EhnszOpFFSH7p/mZNlj8C5O85f9Ui940Nxlm2aCYQlj2OpJ54hKfFLr2VK3Ox/UV7Tq fU3mqt/Ukd1YjBFWwEN9qHfKlMhafwESTYfpIf9/Q4019OI9hwjph3hRQXsSgRLnQM2iZr Xlke4xJVOHU/35lIorUXNmtk3vKKUgWXnb8AbVAkVMPes3V0Csxp9X4K6LkvCQ== Message-ID-Hash: PLWLBSMI32T47EMKMQ77E5CTEA3GFUL5 X-Message-ID-Hash: PLWLBSMI32T47EMKMQ77E5CTEA3GFUL5 X-MailFrom: tomi.ollila@iki.fi X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 1.08 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=oq5A5GXf; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 5A717940275 X-Spam-Score: 1.08 X-Migadu-Scanner: scn1.migadu.com X-TUID: 6eRJDjzZribn On Mon, Feb 01 2021, David Edmondson wrote: > On Monday, 2021-02-01 at 11:49:36 -04, David Bremner wrote: > >> David Edmondson writes: >>> >>> +(defun notmuch-search-uniq-tags (tags) >>> + (let (result) >>> + (mapc (lambda (tag) >>> + (unless (member tag result) >>> + (push tag result))) >>> + tags) >>> + result)) >> >> I leave elisp style to others... > > Me too :-) > >> Is there some bound on the length of tags? Otherwise this seems like >> it's potentially a bit slow? > > No, there isn't any bound. I'd be surprised to see lists longer than low > tens of elements. > > For similar functionality the dash library provides `-distinct', which > uses a lookup table if there are more than 32 elements in the list, > claiming that this is the break-point for the hash based approach to be > faster. > > I'm a bit loath to just re-implement that. Am I allowed to depend on > dash? (I'd guess not, but figured that it's worth asking.) list-packages doesn't tell whether dash is from elpa or from melpa -- nevertheless so far notmuch hasn't even required anything from elpa, so I'd default to 'no'. Anyway, I'd guess this is fast enough for the vast majority of the specific use cases of this feature (dash is more generic(?)), and there are worse hiccups elsewhere (although such is never an excuse to make other code slow). Tomi > > dme. > -- > Why stay in college? Why go to night school?