From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gGAXF1R1SGE0aAAAgWs5BA (envelope-from ) for ; Mon, 20 Sep 2021 13:49:40 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8NC4ElR1SGHLLgAAB5/wlQ (envelope-from ) for ; Mon, 20 Sep 2021 11:49:40 +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) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 730C41FE96 for ; Mon, 20 Sep 2021 13:49:39 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 634E02030A; Mon, 20 Sep 2021 07:49:33 -0400 (EDT) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by mail.notmuchmail.org (Postfix) with ESMTPS id AB8E7202E1 for ; Mon, 20 Sep 2021 07:26:24 -0400 (EDT) Received: by mail-pj1-x102a.google.com with SMTP id k23-20020a17090a591700b001976d2db364so12406612pji.2 for ; Mon, 20 Sep 2021 04:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=uoNWy4MvZ1SOO/GRDxmB2BOZpB608zLPpQ0T8WPCkRA=; b=jGKOJ5PvLJpARvCsnJP0JOPH1TSB4ZwnKBCmi+R1vAY0NdbYyY/vSc2olcENsEE4la gDS9KmuB363tEt0MpGyNZOLLjnh4GbigxA4p8kXeHCONo1yE8QrYHgLWDDXYzO2W8/Wb G/SdFYucbxf64IJ9fiDG3aypwiWLwe1lvtW6joeuUUKGIg05iwdqLAEPxTrbjiWu+RxS DVuHlKiTqsVWJEzFc0sy7t3SmHGaBf7ESFBYWGxE4F7DyTQ+3HXiPdzNe5r/yxxqQSWb xctST4J0gxEZBUQy+Fn/5rSAfzRo7HaDliMDt050NKeO+nOeSHNTrEORnWPfsQUrLCT7 w8HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=uoNWy4MvZ1SOO/GRDxmB2BOZpB608zLPpQ0T8WPCkRA=; b=EeaDQTFSMVBoK/ZV2knEXhsFkUOWi4awMl8DzRF2QYH80xvbFqVNn/ybCel+9/Ez66 IFFkfEKxlle9r+Sr/YXH4s6tmWrSmNAYbSePGLj3kyJ8CDTca3b+h87Gg6z/dr+xCq0L auw+6ByO7nK41FOYo4EAwNJgaSasM0m14lzylbUwYkVdQJaCE1PPauzi+/ksdmllaOvL Gw6CJEyVmWt4bX7Ww8ss3iuGMKQZkncYqoU5J28Y7JRDQhDzVfNBQ6HoL9yhy5l1eF7q KBH8BKUa9X6CJXK6SgHtZSZErVlSyz9bkgHzU8ZY+AiY7J6BKIUXFD7BA+OGh/J9hOqm MIIw== X-Gm-Message-State: AOAM530jDmE1IEqT/ump2WEIVgVH1OGSIlpJrzVFkMMgfJOaZ/qvifXI n9W6zQt3GeiXlb76isnDq8xubhvSnpY= X-Google-Smtp-Source: ABdhPJzgewkze/CoNrM5oVqJkwI2aPYhTipshiko63RRpC0IAQ/hruInkEhrTvBJTvEVicXH4uMRtg== X-Received: by 2002:a17:90b:1c10:: with SMTP id oc16mr36838225pjb.245.1632137182998; Mon, 20 Sep 2021 04:26:22 -0700 (PDT) Received: from localhost (c-24-56-227-241.customer.broadstripe.net. [24.56.227.241]) by smtp.gmail.com with ESMTPSA id y8sm14842761pfe.162.2021.09.20.04.26.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 04:26:22 -0700 (PDT) From: Natnael Kahssay To: notmuch@notmuchmail.org Subject: [bug] notmuch-read-tag-changes, incompatability with consult, non-standard usage of completing-read-multiple Date: Mon, 20 Sep 2021 01:20:44 -0700 Message-ID: <86a6k7hd43.fsf@gmail.com> MIME-Version: 1.0 X-MailFrom: thisnkk@gmail.com 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 Message-ID-Hash: GSQ3C5NTMI5KDWQNPN36KV5CWI7ZGE4P X-Message-ID-Hash: GSQ3C5NTMI5KDWQNPN36KV5CWI7ZGE4P X-Mailman-Approved-At: Mon, 20 Sep 2021 11:49:31 -0400 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: multipart/mixed; boundary="===============6450861760965164630==" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632138579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type:list-id: list-help:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=LTYRAS6RtmK0JtnnTG1glV9GX4ODnvRcBNlQmLFnLDc=; b=O7S5i32VyeZsNkg7Tv5ap8OBdYi0XA7ihVQM5dPVXGseqNwpXffgoKbkeJOs3PsggGM8S4 XvlEBqglACseFhVsJet4YNmuw0C2l8qxw00Q7ykKYR4q64Xz/y3R/IRsZioTUXQ583wYwB voiooCWEME5VpqHBIeHw/gDmA7ktajLsWxVvbGkIv80YZhSb0GDmfuRZPKwQaFSfBKmUgT 9lIeHnWWAASd0GpTvm9SH5/sWx800XSMIlmufYhPp1B1mXMyBcC6B82Lm2L9W/NWmIkwMX uo0w9qrQSRDNDybDTzTOHdZ7UYcZ7pR6ipxGsRI7E0RdutCC5MMJTQMfbe67cw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632138579; a=rsa-sha256; cv=none; b=H/fYM2Y4AXqFDf0RVmmuRpucm2W79Kb/QyQfDcgtpeJ+I1MplXFD+PL34JAdlsss3LhxiC svl9fDxZSjsz9xmwfPI+jqvyfIhEZ1LsAuqNUYnGByAVPZZSAG0X9CM2U8JRYFwfvo4jgv MKEf4p09o3Jqwts9XvOQyJkD+qBhUYmCvqQmjpNZuyOY2lEHp2S+3OTtH0WMA06Ua5ZSig xWDsqZ39oZoVCzr+NEOJMWnQOyC/tsdwsYD1hzP3fO4WKjZvFqt8yuN2tqAfXmD1rHEmm5 0nAk3qgjJpGk7WXNnhGIiaJb98pqaQmbPmgvhe9rgKfE1QRVcE/z1BEHzxC65Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=jGKOJ5Pv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Spam-Score: -3.11 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=jGKOJ5Pv; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: 730C41FE96 X-Spam-Score: -3.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: JkqAX9LKiF0h --===============6450861760965164630== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain notmuch-read-tag-changes throws error, "Tag must be in the form of +'this_tag' or '-that_tag'" when used with consult. notmuch-read-tag-changes expects completing-read-multiple to strip crm-separator out of results. Consult's implementation of competing-read-multiple doesn't strip results. I discussed with the author of the package here. https://github.com/minad/consult/issues/410 He states notmuch is using a non-standard and possibly tentative property of completing-read-multiple. I agree. Below I have a version of notmuch-read-tag-changes that removes suffix crm-separator of returned candidates explicitly. #+begin_src emacs-lisp (defun notmuch-read-tag-changes (current-tags &optional prompt initial-input) "Prompt for tag changes in the minibuffer. CURRENT-TAGS is a list of tags that are present on the message or messages to be changed. These are offered as tag removal completions. CURRENT-TAGS may contain duplicates. PROMPT, if non-nil, is the query string to present in the minibuffer. It defaults to \"Tags\". INITIAL-INPUT, if non-nil, will be the initial input in the minibuffer." (let* ((all-tag-list (notmuch-tag-completions)) (add-tag-list (mapcar (apply-partially 'concat "+") all-tag-list)) (remove-tag-list (mapcar (apply-partially 'concat "-") current-tags)) (tag-list (append add-tag-list remove-tag-list)) (prompt (concat (or prompt "Tags") " (+add -drop): ")) (crm-separator " ") ;; By default, space is bound to "complete word" function. ;; Re-bind it to insert a space instead. Note that ;; still does the completion. (crm-local-completion-map (let ((map (make-sparse-keymap))) (set-keymap-parent map crm-local-completion-map) (define-key map " " 'self-insert-command) map))) (mapcar (lambda (entry) (substring entry 0 (- (length crm-separator)))) (delete "" (completing-read-multiple prompt ;; Append the separator to each completion so when the ;; user completes a tag they can immediately begin ;; entering another. `completing-read-multiple' ;; ultimately splits the input on crm-separator, so we ;; don't need to strip this back off (we just need to ;; delete "empty" entries caused by trailing spaces). (mapcar (lambda (tag-op) (concat tag-op crm-separator)) tag-list) nil nil initial-input 'notmuch-read-tag-changes-history))))) #+end_src --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFGBAEBCAAwFiEEO/M99lSJ/E1opP+ldO60b6d7v6wFAmFIb54SHHRoaXNua2tA Z21haWwuY29tAAoJEHTutG+ne7+sgHsIALbqo99rlhiYzzhbe2J8SSru8Dvgfupz qLgMn0Wrv+J3TwFkSy/oFkyc0+z/00250qbfadcZWSJFxYkAAI4qrU41HL86yiCd EeSkWzxXGc8NJ0JQnk8OxB8A/Rft+IfaGtENUg/xp/R8qqAuQpk5O/BLIlKNC7r2 U5xAbrAIGwbiEU8XmduMs4mxelHEMbcW3mChH66tVeP9Qm03bIoAcorU79mO3fb1 eVauwLxS+i4FT+LSQk2mBuBIALWuFwWFPoPJLFxy+rju2t+ZTFeCuU1eZwRFIjfm d43L/ZGCVcKb1bIUBFq3c7GRiZYUZUwrDY2Gh5b+xWCoKrbRY0bGNyw= =B489 -----END PGP SIGNATURE----- --=-=-=-- --===============6450861760965164630== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============6450861760965164630==--