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 ZGyeNbsoGGCycgAA0tVLHw (envelope-from ) for ; Mon, 01 Feb 2021 16:13:47 +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 MD7yMLsoGGBwfgAAB5/wlQ (envelope-from ) for ; Mon, 01 Feb 2021 16:13:47 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (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 1943C940276 for ; Mon, 1 Feb 2021 16:13:47 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6F02A28CF0; Mon, 1 Feb 2021 11:13:41 -0500 (EST) Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by mail.notmuchmail.org (Postfix) with ESMTPS id 00B6928CAD for ; Mon, 1 Feb 2021 11:13:38 -0500 (EST) Received: by mail-ej1-x62b.google.com with SMTP id a9so6863548ejr.2 for ; Mon, 01 Feb 2021 08:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dme-org.20150623.gappssmtp.com; s=20150623; h=to:subject:in-reply-to:references:from:date:message-id:mime-version; bh=GU34U5yhvwzSt2Eg1IJ4nMbhURccjkGa3WH6TTHIjA4=; b=xXaYzExpl/rfIXyVlGVJN6sO066jvWKVjwi96J2X3ZU5qBPDUa3MByAWo+qWy+yNQ3 jjCUb0TZBa40YnMiFWso4X0gFDTX3FaTDd+BY355JxRCrMPNn7DTUMMJIbwoTT2VOHoz G8vENSqGSitkQN4lSN5DUYSZBFxGZPX4fcewGbFWx3cYbTXqEltT6Azz7R4K+x+Njzvl TJ/bijYSjJDZI3HEiLbBLYvBGNRBphn+fhOd29Hieb8ibzHwkL7DWuAmsVx8b0kHM+Qz 58UBga0pNCTR+3oL+T/qSiIoRMul6ePh1Sy+eTys1Utzz5K9zU+oMsksu52m4WKzko9E p6Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:in-reply-to:references:from:date :message-id:mime-version; bh=GU34U5yhvwzSt2Eg1IJ4nMbhURccjkGa3WH6TTHIjA4=; b=h5VE5nQIPWSyNLDuKarK1yF77nXXt5gEURHcugsHHUCY3fD+tj5mW0cjNze7Vo4V6h ojYtyweykn6r3AigtYzbeu3Srz+ljiL5e0G79CqwYdDGcMqJst8LLhdDWmye6mfdukAj F9cMDLHkQEB/Y05flkdh49i+8n96h5AvXUlbrkY0U0ne/1ehe7rAGnVyiKhOYVBMghLI 9I+ZOep0+bQ2fmOb4831NFC75WiAQgDEeR+2yyjW9H3d5DkpqQz8H5sngzMtz3yRdvYQ fX6E4nZci6L+dnXij2227N0KXLaYwY2SbxKjXL5VuzBcFcD1WJqG2VitOesIt2Tt87tT rXzw== X-Gm-Message-State: AOAM531CAV/kUd3USqLkFrnNRx9CJoMAid3h5csg4Nm6IlzFX0NlKuUg p9WRXwOlSsl+KQrbZyNLEuAptecyRXc7FVVY X-Google-Smtp-Source: ABdhPJyUh0GVw+zOXKcLAEbEnaXz6+/Porwq6BHi5GkuUzLHRamCp/5qWZXBKY1+JV5XX93QTh3TMw== X-Received: by 2002:a17:907:961b:: with SMTP id gb27mr16818712ejc.413.1612196014448; Mon, 01 Feb 2021 08:13:34 -0800 (PST) Received: from disaster-area.hh.sledj.net (disaster-area.hh.sledj.net. [2001:8b0:bb71:7140:64::1]) by smtp.gmail.com with ESMTPSA id r10sm8782869edw.24.2021.02.01.08.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 08:13:34 -0800 (PST) Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 495c5731; Mon, 1 Feb 2021 16:13:33 +0000 (UTC) To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: When completing tags, offer each tag once In-Reply-To: <87im7byei7.fsf@tethera.net> References: <20210201145402.561245-1-dme@dme.org> <87im7byei7.fsf@tethera.net> X-HGTTG: zarquon From: David Edmondson Date: Mon, 01 Feb 2021 16:13:33 +0000 Message-ID: MIME-Version: 1.0 Message-ID-Hash: 52Y4FVJ5T7OPWNB4ND5INJCNV4J7Z7FO X-Message-ID-Hash: 52Y4FVJ5T7OPWNB4ND5INJCNV4J7Z7FO X-MailFrom: dme@dme.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 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.00 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=dme-org.20150623.gappssmtp.com header.s=20150623 header.b=xXaYzExp; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 1943C940276 X-Spam-Score: -1.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: Iygyvx99+yxL 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.) dme. -- Why stay in college? Why go to night school?