From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id Kq3IIMWtGWD9ZQAA0tVLHw (envelope-from ) for ; Tue, 02 Feb 2021 19:53:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4IbwG8WtGWBPDwAAbx9fmQ (envelope-from ) for ; Tue, 02 Feb 2021 19:53:41 +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 581F59402BD for ; Tue, 2 Feb 2021 19:53:40 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 5601D28CE2; Tue, 2 Feb 2021 14:53:34 -0500 (EST) Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [185.185.170.37]) by mail.notmuchmail.org (Postfix) with ESMTPS id C708D28CC6 for ; Tue, 2 Feb 2021 14:53:31 -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 9EE7D1B0011D; Tue, 2 Feb 2021 21:53:30 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1612295610; 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=hHS6bClNwcFWhhKnaHqUXHb+E5VR1UpywNTxVZdP7zI=; b=g22yrVntipVzO6xPUeXuIdDO7MtJXTfaKYAu7o8UlnmDM5n8maB554sKs3jLpxrZxFlt8b X2kG+6Jvb3y4CRwis27J+VqvNMEQhLK/qKq6Mx8zysJg60JGZngXMJTMKD/hQp8SaEX1ZZ plsG1ESNGVbL8DBcMv3MashHt4t5xOouDfTFnL5TEjA9OVyRstysZPm2ZPv7n026AnccwF BWqwJ+GlRC3f7nSJE2rNcJ7752zpOSKMVmQXuklLfdpHEBIEzHD4nDlRBe4unPPCed6D8B d1CI0FCRaj0vojMEuea2te+vGMGSRS8mEm95m4aLxK4CYH4FKO/0I985qCNqCA== From: Tomi Ollila To: David Bremner , David Edmondson , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: When completing tags, offer each tag once In-Reply-To: <871rdyxoip.fsf@tethera.net> References: <20210201145402.561245-1-dme@dme.org> <87im7byei7.fsf@tethera.net> <871rdyxoip.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=1612295610; a=rsa-sha256; cv=none; b=AUZXl48GlBMjCAtQ+bLVi4to7XuJO7sDFyOphp3cRwQeyvmWnRfKd9ut0Gi++CuSHyyBhj ohRMcw+y8AYXRvChxT01xE+tuxOrSJitwf2Tc6XHO947N70qgKE4JsW/utuvomnD3pnlX6 I+ai8e5L6i6h886Y3UHUWeG1mwtFCPc3MqHRxk6nD0O4igzGzqmiaoKhfpomqfMhH5pMKz zOYNQh6jf8sCc29chBr5HhlL5sdsDkmdvnMglk0aA/Y7kW+ID064YSsqpgOWU3R8Gx5C2J RcyZdi10q1PQ64c1zikGAmWVdgaDtS3856XN21lT9N3gaG2eTGqXOoCoBl58dw== 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=1612295610; 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=hHS6bClNwcFWhhKnaHqUXHb+E5VR1UpywNTxVZdP7zI=; b=EGArEQVZYe27hR1lYkgUbp4KOf8Y3ujy7N91A2GpMbdM1I+vyY+P4gB6bdaru811gStSDH xpgGfxbRt8X4smEfNQxTxpgqih4lzcYy4pcS0GdrympuB8ZIivQwwErXf+c9I9SixeFc0+ O/P1MpSYubUhJIBlCI0A9K+gwt9HlKL/DqPi/NV4dOPr+YUbmCiTeaJ3DYI9NqoTV5F3I/ 0F/mjS7+TfuffvPuN3LPZwWlOeTiXDvz+cTYqhh/yrja+b4viU6MICvc5CddsMRsww2HAR oCbya+AZM6oRxw8Jra0l6AduiKmaUlYR84CYHgWXDg0VLBxdiLVkfO1i28hFEA== Message-ID-Hash: 2SYGRETIXXJW43ZDQTQCB7BI54PQIRV3 X-Message-ID-Hash: 2SYGRETIXXJW43ZDQTQCB7BI54PQIRV3 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.15 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=g22yrVnt; 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: 581F59402BD X-Spam-Score: 1.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6bYBui5j5rsX On Tue, Feb 02 2021, David Bremner wrote: > > Maybe delete-dups (subr.el) would be useful here? It is destructive, but > even with a copy (if needed), it should still be faster. I looked the implementation of delete-dups. In case of >100 elements, it uses hash table for checking duplicates. less than 101 elements and the code is (let ((tail list)) (while tail (setcdr tail (delete (car tail) (cdr tail))) (setq tail (cdr tail)))))) It took me a bit of time to understand, but then I got it: * delete all elements that match car of tail in the list of (cdr tail) * set tail to cdr of tail * redo until tail exhausted setcdr and delete are built-in functions implemented in c code (and copy-sequence, unsurprisingly, is implemented in c (if needed)) > > d Tomi