From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id iBdSDjWh+GaDOwEA62LTzQ:P1 (envelope-from ) for ; Sun, 29 Sep 2024 00:37:09 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id iBdSDjWh+GaDOwEA62LTzQ (envelope-from ) for ; Sun, 29 Sep 2024 02:37:09 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727570229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=Tihq2EJCN1hUJiyGdAxlhdty1GYUbdZWCxOvsWKOu10=; b=bRn5rudqhXw0YAJHs30S1my+O7xq46tDAIjazdm3sta2bVwB0Q/mcICGmaLBLFkgXbPNfx tQdd0RTUlKHHKc+WxfMuQZeUrhbcar/eSkEAUmFUEnMC83iaLGNVt0YOXBif+l4NHiTBeD oAJKQLuxVVxmv4KXhCxCbb5D7Ojc0o9XiBevkxE4b/90Qk1DsQxTPWqA2kGxtDfw2wBb5t LsMlLRfEMLWld4EVw+iNuUa1QFIRkB3AhZ19b9u5DTzoC2GsUBO0daGUHJAgWmswpf2ZNc pbSPp36TEL3gL54RnPUOOeWt+8OE6OrKBl4MwzRpGQZ5U2N4c/D9r6m8aXQQsQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727570229; a=rsa-sha256; cv=none; b=uhA+0f9UJbDz9IZovv1+hMrPEK8S+HM7Fy9jdGDPYDvWwFIjkNcRhEY97bnqi2cow0jHEg Ct16CTsJuzq3bzIOtxQELrVRimm8mK0Wffcc5/CjhIv3jtlTU3N2WIe03bmv7rqZPfP6kk lxmDShu7yfGuXi9Pwe4RvDiJyF1aSJbNQuaYVcZhAmZfR+31t+VNL4678Iy9fGSKRvd1S1 mBGWkYzZT8GgBumAjADr+nt4Uk34a9P57i8qH11X6Y2MAqcWtrdrw7/kCSRnjWMkXeh4+3 nspTbOLB+tkOk16qw102Rr9nB/MhxlSwlM0MUn+oG47+/ksGVjIXe/wuulyFIw== Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (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 7EDB83739F for ; Sun, 29 Sep 2024 02:37:08 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id BD3BF5F82F; Sun, 29 Sep 2024 00:36:54 +0000 (UTC) Received: from smtp.umanwizard.com (smtp.umanwizard.com [54.203.248.109]) by mail.notmuchmail.org (Postfix) with ESMTP id DD7735E28E for ; Sun, 29 Sep 2024 00:36:50 +0000 (UTC) Received: from localhost ([108.6.22.48]) by smtp.umanwizard.com ; 29 Sep 2024 00:36:47 +0000 X-Fes-Received-For: notmuch@notmuchmail.org X-Fes-Received-From: From: "Brennan Vincent" To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] emacs: Introduce notmuch-draftify-buffer command. In-Reply-To: <87msjvl71g.fsf@tethera.net> References: <87plpbtfj2.fsf@taipei.mail-host-address-is-not-set> <87r09qtbn6.fsf@taipei.mail-host-address-is-not-set> <87msjvl71g.fsf@tethera.net> Date: Sat, 28 Sep 2024 20:36:45 -0400 Message-ID: <875xqfi9cy.fsf@denver.mail-host-address-is-not-set> MIME-Version: 1.0 X-Fes-Encrypted: true X-Fes-Ehlo-Domain: localhost Message-ID-Hash: 2K3BCGFOW6LYFYCNG4C7NYVYZUNJ3J6E X-Message-ID-Hash: 2K3BCGFOW6LYFYCNG4C7NYVYZUNJ3J6E X-MailFrom: brennan@umanwizard.com 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; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE X-Migadu-Queue-Id: 7EDB83739F X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -3.42 X-Spam-Score: -3.42 X-TUID: EJn9vQUiI7XB David Bremner writes: > Brennan Vincent writes: > >> This command inserts the current buffer as a draft. It optionally >> begins editing the draft. > > [nice commit message snipped] > > Here again, if possible we would like a test. For emacs tests it is a > bit more laborious, but there are several options outlined in > test/ Done, will be in the next revision of the patch series. > >> will appear in a buffer named \"*Notmuch errors*\" and an error >> -will be signaled." >> +will be signaled. >> + >> +Otherwise, returns the output from the process as a string." >> (with-temp-buffer >> - (let ((status (notmuch-call-notmuch--helper t args))) >> - (notmuch-check-exit-status status (cons notmuch-command args) >> - (buffer-string))))) >> + (let ((status (notmuch-call-notmuch--helper t args)) >> + (output (buffer-string))) >> + (and (notmuch-check-exit-status status (cons notmuch-command args) >> + output) >> + output)))) > > Is it clear / documented what the return value of > notmuch-check-exit-status is? If all you mean is that it completes > without error, I think "progn" is clearer than "and" Done, will be in the next revision of the patch series. > >> +Returns the message ID of the inserted message." >> + (let ((output (apply 'notmuch-call-notmuch-process >> + :stdin-string (buffer-string) "insert" >> + (append (and create (list "--create-folder")) >> + (list (concat "--folder=" folder) >> + "--emit-message-id") >> + tags)))) >> + (string-trim output))) > > One problem we have is that people merrily upgrade the emacs front end > without updating the CLI. Recently (see devel/schemata) we have started > bumping the output version for new command arguments, so at least the > error reporting is clear. That won't work here, since `notmuch insert` doesn't accept --format-version at all, so people using older versions of the CLI would just get an obscure error about --format-version being an unrecognized arg. What we can do is in notmuch-check-exit-status, search the error output for "Unrecognized option: --emit-message-id" and translate it to something friendlier. Searching for specific strings in error message is a bit unsatisfying to me, but at least it works (and correct me if I'm wrong, but I don't think notmuch has been localized to languages other than English which would break it). What do you think? (Btw, I think in the future it would be good to make all commands accept --format-version, even those whose output doesn't change today, to avoid this sort of issue). > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org