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 INiZNqymGWDsJAAA0tVLHw (envelope-from ) for ; Tue, 02 Feb 2021 19:23:24 +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 MANeMqymGWD9XwAAB5/wlQ (envelope-from ) for ; Tue, 02 Feb 2021 19:23:24 +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 B6F8C940355 for ; Tue, 2 Feb 2021 19:23:21 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 85B0E28CD9; Tue, 2 Feb 2021 14:23:15 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id B5DEC28CA0 for ; Tue, 2 Feb 2021 14:23:13 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id AA143607F9; Tue, 2 Feb 2021 14:23:11 -0500 (EST) Received: (nullmailer pid 586690 invoked by uid 1000); Tue, 02 Feb 2021 19:23:10 -0000 From: David Bremner To: Tomi Ollila , David Edmondson , 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> Date: Tue, 02 Feb 2021 15:23:10 -0400 Message-ID: <871rdyxoip.fsf@tethera.net> MIME-Version: 1.0 Message-ID-Hash: FH2P43LXV35SHJ6XLY6HNBFXT22MZ47R X-Message-ID-Hash: FH2P43LXV35SHJ6XLY6HNBFXT22MZ47R X-MailFrom: david@tethera.net 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.85 Authentication-Results: aspmx1.migadu.com; dkim=none; 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: B6F8C940355 X-Spam-Score: -1.85 X-Migadu-Scanner: scn1.migadu.com X-TUID: Bzb2KqUCdPG6 Tomi Ollila writes: > 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. Maybe delete-dups (subr.el) would be useful here? It is destructive, but even with a copy (if needed), it should still be faster. d