From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id gC+fGuX9sWFgdgAAsNZ9tg (envelope-from ) for ; Thu, 09 Dec 2021 13:00:21 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uCRdFuX9sWHcOwAAbx9fmQ (envelope-from ) for ; Thu, 09 Dec 2021 13:00:21 +0000 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050::465:202]) (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 247CC35BEC for ; Thu, 9 Dec 2021 14:00:20 +0100 (CET) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4J8vJw5xdVzQjgk for ; Thu, 9 Dec 2021 14:00:16 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de From: Leo To: piem@inbox.kyleam.com Subject: Re: [PATCH 1/1] piem-notmuch-am-ready-mbox: Add option to edit patches before applying them In-Reply-To: <87v8zynkhy.fsf@relevant-information.com> References: <20211208160142.84085-1-sourcehut@relevant-information.com> <20211208160142.84085-2-sourcehut@relevant-information.com> <87r1amfnoa.fsf@kyleam.com> <87v8zynkhy.fsf@relevant-information.com> Date: Thu, 09 Dec 2021 14:00:11 +0100 Message-ID: <87zgpaylus.fsf@hako.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1639054821; 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=+f8v+YNMrWHJrv/7XV1Wt8bya/Vg9u/U5L5XJFddGdg=; b=pOqzdFZWSAb1nOjFtytOFhXn4RxBg0plu06hGz+Dv/T5i0pjhpskx7JCiFA47ryGrVsBm3 2xV8YOO/0Bzvr8IoQr+Czw1frH+kfhXHZ19MUkgECiVZu157MlEE+P7uHngnlUFQ6MoPcs 7C/w0yDjoUFcEVB7G/qerj3Xk+yoQH/CgT5m36cEel1qSeLieO6FVFe05KU57w7YbPDxjZ 4gEn3gsW8RJ7LNJwx62t22k3m9LtRZ8ysFVV0nThz/w4ymnT8BZRq4P0ArDWX/THGlNfv0 7NN9QTauver6YyfK/U2JJ/Y0aWa6c8PG8bQwE/UepqEFOMu9+0iaOLfdvGuTnw== ARC-Seal: i=1; s=key1; d=kyleam.com; t=1639054821; a=rsa-sha256; cv=none; b=yOdOHVF2zahhauRrAgNUCDT4+16AMBDWKMWGdteNZtMDntATHxlpjk9WTnfnAivgXUThrN ULp/0wUDWfag7gORMulXC/gZhe0GyFcpHnBoRZRxZdGE6DSr2aKviZH2VQ9uRcsd0rWcOp sZzxD7/mFQ5vdnTe2Fa0Gj+4K8rWWmyV5MfxewiqSDXV9jHiPtJhbDoj0AvJlktfq6Rvft C7LgejOoU9FmzE7G2RZ5CZk/DC7yjgdza0hyjd+KLlLBTV4SljNkp49VMEoj13opbv92aI 4lS7OlGtJspLR2giSYOyi2SckPI0QBxQcjhs/pSqjXKrvEgb2EOg1tDSEzaivQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of sourcehut@relevant-information.com designates 2001:67c:2050::465:202 as permitted sender) smtp.mailfrom=sourcehut@relevant-information.com X-Migadu-Spam-Score: -2.49 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of sourcehut@relevant-information.com designates 2001:67c:2050::465:202 as permitted sender) smtp.mailfrom=sourcehut@relevant-information.com X-Migadu-Queue-Id: 247CC35BEC X-Spam-Score: -2.49 X-Migadu-Scanner: scn1.migadu.com X-TUID: Khqwp/qWLJd0 Leo writes: > I actually thought something similar a while after I sent the patch. > Instead of editing the buffer generated by notmuch we could use the > buffer returned by `piem-am-ready-mbox'. That way we get all the > libraries for free. Perhaps a new command `piem-am-edit' could be added > that calls `piem-am-ready-mbox' with your suggested dedicated piem mode > for editing. Would it be a good idea to filter out email headers that > `git am' doesn't care about here? Otherwise it can be a bit overwhelming. > > > Here is a sketch based on the sketch you sent. The workflow being: 1) call `piem-edit' 2) edit the mbox buffer 3) call `piem-edit-patch-am'. --- piem.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/piem.el b/piem.el index afe6b7a..807de65 100644 --- a/piem.el +++ b/piem.el @@ -900,6 +900,35 @@ (defun piem-am-read-worktree (coderepo branch) (concat (file-name-nondirectory fname) "-" (replace-regexp-in-string "/" "-" branch)))))) +(defvar-local piem-edit-patch--coderepo nil) +(defvar-local piem-edit-patch--format nil) +(defvar-local piem-edit-patch--mid nil) + +(defun piem-edit-patch-am () + (interactive) + (piem-am (current-buffer) + "mbox" + (piem-extract-mbox-info (current-buffer)) + piem-edit-patch--coderepo)) + +(define-derived-mode piem-edit-patch-mode nil "piem-edit-patch" + "TODO" + :group 'piem) + +(defvar piem-edit-patch-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-c") #'piem-edit-patch-am) + map) + "TODO") + +(defun piem-edit () + (interactive) + (piem-am-ready-mbox) + (let ((coderepo (piem-inbox-coderepo))) + (switch-to-buffer " *piem am-ready mbox*") + (piem-edit-patch-mode) + (setq piem-edit-patch--coderepo coderepo))) + ;;;###autoload (defun piem-am (mbox &optional format info coderepo toggle-worktree) "Feed an am-ready mbox to `git am'. -- 2.31.0