From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms12 with LMTPS id uPcMLzISxmFhKwAAsNZ9tg (envelope-from ) for ; Fri, 24 Dec 2021 18:32:18 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id qI3HKjISxmF3ZAAA1q6Kng (envelope-from ) for ; Fri, 24 Dec 2021 18:32:18 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1640370738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vlq8BKgxFg+NuFsSHCa61p8ZAkJrNAFTvJHtU6cRAlM=; b=g86DTOgBhkROxznoLBtH8m8E8Y5RmwiClDBq79KAJAxY5AWOAvVIYIhG1mGswtvwSdpjEe OAevHRbdldf7W13/eIej1m+A1KFF15b/7uzh6cyySBvHOoNk9QoMGPDmQdCMT34fJzjAIl I3car6XyDHd7WgVAS8r6lsxgREZ8gxGH5UhL4FjbRhkVzTgVRMgGpBdPri4gWQmerMIULy WfBieCPuYAk2yfD3+bf9pOgyp7lXWqw50ST0lZZsGcoqhm2zOiM/OfXXuhIYLsqSkWwmvU eE0wKfAdrM0xPprwRtNz5mgwKjylF50Upis6fus8eVnxb3ObPnDGoZFjI636sQ== From: Kyle Meyer To: sourcehut@relevant-information.com Cc: piem@inbox.kyleam.com Subject: Re: [PATCH v2] Add ability to edit patches before applying them In-Reply-To: <20211221140212.30248-1-sourcehut@relevant-information.com> References: <878rwjwz52.fsf@kyleam.com> <20211221140212.30248-1-sourcehut@relevant-information.com> Date: Fri, 24 Dec 2021 13:32:16 -0500 Message-ID: <87ee61g8gf.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyleam.com X-TUID: lPgQOD9YyKte sourcehut@relevant-information.com writes: > +(defun piem-edit-patch-am () > + "Apply the patch that is currently edited." > + (interactive) > + (let ((buf (current-buffer))) > + (piem-am buf > + "mbox" > + (piem-extract-mbox-info (current-buffer)) > + piem-edit-patch--coderepo)) > + (kill-buffer buf)) This last 'buf' is outside of the let-binding: $ make compile emacs --batch -Q -L . -L tests -f batch-byte-compile piem-maildir.el emacs --batch -Q -L . -L tests -f batch-byte-compile piem.el =20=20 In piem-edit-patch-am: piem.el:1012:16:Warning: reference to free variable =E2=80=98buf=E2=80=99 [...] I've moved it inside (diff below). Tested this out a bit, and it seems to work as advertised. Pushed (a996e8d4). Thanks for proposing and implementing this feature. diff --git a/piem.el b/piem.el index eef06492..b06719b2 100644 --- a/piem.el +++ b/piem.el @@ -1005,11 +1005,11 @@ (defun piem-edit-patch-am () "Apply the patch that is currently edited." (interactive) (let ((buf (current-buffer))) - (piem-am buf - "mbox" - (piem-extract-mbox-info (current-buffer)) - piem-edit-patch--coderepo)) - (kill-buffer buf)) + (piem-am buf + "mbox" + (piem-extract-mbox-info (current-buffer)) + piem-edit-patch--coderepo) + (kill-buffer buf))) =20 (defvar piem-edit-patch-mode-map (let ((map (make-sparse-keymap)))