Received: (at 80611) by debbugs.gnu.org; 14 Mar 2026 11:16:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 14 07:16:34 2026
Received: from localhost ([127.0.0.1]:53559 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1w1Myu-0008Me-GA
for submit <at> debbugs.gnu.org; Sat, 14 Mar 2026 07:16:34 -0400
Received: from mta-08-4.privateemail.com ([198.54.122.147]:56701)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <basil@HIDDEN>)
id 1w1Myq-0008Kg-GX
for 80611 <at> debbugs.gnu.org; Sat, 14 Mar 2026 07:16:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net;
s=default; t=1773486981;
bh=jnp7LgprnGI1igx1FmOoqw6TzRVuB/t3+lVkkGHdPmo=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
b=U0RJcn1z6rKPhBrRat8QofrWQqCz0olPDYHJ54EG59XlIJDplgcY7qoRX7+8uzBQg
r6b51ze1YyqMjxmosbGP0Y8ZHOQqC5m7YNY6/brRjwN93R3mPeiHqk9Se0M0R8iuan
SOQoPtm7D6zmw+DCtrsnbgjysEu+U2fGS2v4z5VsyZ0odvGwzB/lcbGd0vVs92EKA5
X2E/nIZ8BwV23MncC8H8vB3bYv3tbXQLHeWz9Fe22qFyrbEgW24snDWqL0+SxnRKHh
lb7e3V3f6cSNL+Go4F+ZLn+9Ym3PIGMvM1hoa3A5by/AY3BEhiyBFf4naUaoYN5zLG
pa75SyoEAtpBg==
Received: from mta-08.privateemail.com (localhost [127.0.0.1])
by mta-08.privateemail.com (Postfix) with ESMTP id 4fXzLs4b6Wz3hhVF;
Sat, 14 Mar 2026 07:16:21 -0400 (EDT)
Received: from localhost (unknown [146.70.196.246])
by mta-08.privateemail.com (Postfix) with ESMTPA;
Sat, 14 Mar 2026 07:16:19 -0400 (EDT)
From: "Basil L. Contovounesios" <basil@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#80611: [PATCH 1/1] Add new user option
'recompile-reuse-last-command'
In-Reply-To: <87y0jvjmgm.fsf@HIDDEN>
References: <87y0jvjmgm.fsf@HIDDEN>
Date: Sat, 14 Mar 2026 12:16:16 +0100
Message-ID: <877brewtj3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Philip Kaludercic [2026-03-14 00:15 +0000] wrote: > @@ -1894,
8 +1901,
11 @@ recompile > (interactive "P") > (save-some-buffers (not
compilation-ask-about-save)
> compilation-save-buffers-predicate) > - (let ((default-directory (or
compilation-director [...]
Content analysis details: (1.7 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.9 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The
query to Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243
for more information.
[198.54.122.147 listed in sa-trusted.bondedsender.org]
0.8 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
query to Validity was blocked. See
https://knowledge.validity.com/hc/en-us/articles/20961730681243
for more information.
[198.54.122.147 listed in bl.score.senderscore.com]
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/,
no trust [198.54.122.147 listed in list.dnswl.org]
0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3)
[198.54.122.147 listed in wl.mailspike.net]
-0.0 SPF_PASS SPF: sender matches SPF record
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
0.0 RCVD_IN_MSPIKE_WL Mailspike good senders
X-Debbugs-Envelope-To: 80611
Cc: 80611 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)
Philip Kaludercic [2026-03-14 00:15 +0000] wrote:
> @@ -1894,8 +1901,11 @@ recompile
> (interactive "P")
> (save-some-buffers (not compilation-ask-about-save)
> compilation-save-buffers-predicate)
> - (let ((default-directory (or compilation-directory default-directory))
> - (command (eval compile-command)))
> + (let* ((default-directory (or compilation-directory default-directory))
> + (buffer (compilation-buffer-name "compilation" nil nil))
> + (command (or (and recompile-reuse-last-command (get-buffer buffer)
> + (buffer-local-value 'compile-command buffer))
^^^^^^
Isn't this a string?
--
Basil
bug-gnu-emacs@HIDDEN:bug#80611; Package emacs.
Full text available.Received: (at 80611) by debbugs.gnu.org; 14 Mar 2026 10:00:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 14 06:00:14 2026 Received: from localhost ([127.0.0.1]:52702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w1Ln0-0004ac-1s for submit <at> debbugs.gnu.org; Sat, 14 Mar 2026 06:00:13 -0400 Received: from mout02.posteo.de ([185.67.36.66]:58827) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <philipk@HIDDEN>) id 1w1Lmr-0004Ww-Kv for 80611 <at> debbugs.gnu.org; Sat, 14 Mar 2026 06:00:06 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E3632240101 for <80611 <at> debbugs.gnu.org>; Sat, 14 Mar 2026 10:59:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017; t=1773482394; bh=HqNOKMHvn9L88RX5MNXvtj9Ft1nG2p9ZXHx2wZMyeOc=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=nU/zFc66s2DbvyC3A2PEwZU4Gnjzr52ULa3H/EG7CGXp2HzfcMWDRbfMPvoknSAes 4TQv170ojLkv3X09FMMP6Ws6AZOipcNGLNS79MZFYqKQ0fPNXFdhk3AZaYrK0tyNxp ANqUgtb4ptDCM9hCnZ9irVZ/CSRyT40nNCVUhb7W1vh9jA+6SVyNeahutSRJT/+7m/ X6oK1bx3Yf4gyuK9wX9Pm4/KEnhYfgKfK8xbT/VvWowsSR1B2cPLLJeIk5NzDguIsm 9JtBSrZitBla4FJ1mJwR7sq95VvifUFzMOpWH5NQYI6U0yLnGenrvEhSfe3Yco4qEW EvHVU7KYxGl4g== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4fXxff39S9z6tsf; Sat, 14 Mar 2026 10:59:54 +0100 (CET) From: Philip Kaludercic <philipk@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#80611: [PATCH 1/1] Add new user option 'recompile-reuse-last-command' In-Reply-To: <86cy16bvjf.fsf@HIDDEN> References: <87y0jvjmgm.fsf@HIDDEN> <86ms0abxwa.fsf@HIDDEN> <87bjgqkcuy.fsf@HIDDEN> <86cy16bvjf.fsf@HIDDEN> OpenPGP: id=philipk@HIDDEN; url="https://keys.openpgp.org/vks/v1/by-email/philipk@HIDDEN"; preference=signencrypt Date: Sat, 14 Mar 2026 09:59:54 +0000 Message-ID: <87sea2ivdx.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 80611 Cc: 80611 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.6 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Philip Kaludercic <philipk@HIDDEN> >> Cc: 80611 <at> debbugs.gnu.org >> Date: Sat, 14 Mar 2026 08:57:10 +0000 >> >> Eli Zaretskii <eliz@HIDDEN> writes: >> >> >> From: Philip Kaludercic <philipk@HIDDEN> >> >> Date: Sat, 14 Mar 2026 00:15:06 +0000 >> >> >> >> I stumbled upon a thread that `rust-mode' will not set `compile-command' >> >> to the value you'd expect for the major mode, because it can override >> >> the previous command when calling `recompile'[0]. I think I've run into >> >> an issue like this before, but never further thought about it. >> > >> > Are we talking about the scenario where the user visits a new file or >> > turns on a major mode between "M-x compile" and "M-x recompile"? Or >> > are we talking about other situations? >> >> We are talking about the first scenario. In the rust example, someone >> called compile with "cargo check", then opened some other file with >> `rust-mode' as the major mode. When executing `recompile', Emacs would >> use the buffer local value, which at that point in time was set to >> "cargo build", instead of re-using the previous "cargo check" command. >> >> > In any case, I don't think I understand the problem here. Modes are >> > not supposed to set compile-command, but files can specify their local >> > values for it. A file-local value overrides the value from the last >> > "M-x compile", and I think it's a feature. >> >> Why shouldn't a major mode be able to set `compile-command'? > > So we are talking specifically about a mode that wants to set > compile-command? Is the problem limited to that case? Not necessarily, now that I think about it. The intuitive expectation for some (including me TBH) is that `recompile' will just re-execute the last command I started with M-x compile, and not change just because I am calling it from a buffer where `compile-command' has a buffer local value. >> If you are dealing with a language FOO where building a project >> doesn't involve calling "make", but executing some command >> "FOO-toolchain build", why not set Emacs up to suggest that by >> default when calling `compile'? > > OK, but then why would a user expect "M-x recompile" to repeat the > same command in another buffer of that mode? > > Or maybe we should add some feature to "M-x compile" whereby its > initial setting of compile-command, which is also shown as default in > the prompt to the user, could be affected by some new variable which > modes could set? Having a variable for that could be useful, but if the issue remains that `compile-command' (which could also have a file-local value) can change the behavior of `recompile', then at least part of the issue remains. Also, introducing this new feature would take a while to propagate, while `compile-command' already exists and is being used. > IOW, why is this deemed to be a problem with "M-x recompile"? See above.
bug-gnu-emacs@HIDDEN:bug#80611; Package emacs.
Full text available.Received: (at 80611) by debbugs.gnu.org; 14 Mar 2026 09:38:48 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 14 05:38:47 2026 Received: from localhost ([127.0.0.1]:52506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w1LSI-0006fB-B0 for submit <at> debbugs.gnu.org; Sat, 14 Mar 2026 05:38:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52708) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1w1LSE-0006dk-IU for 80611 <at> debbugs.gnu.org; Sat, 14 Mar 2026 05:38:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1w1LS8-0003eV-6Z; Sat, 14 Mar 2026 05:38:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=97r2guePSJyLgPaqsxS3Ae2RhgyuTL4MYFjjvKlKMzo=; b=dZM40xjESyAK NyrG5UmMs8OWCA96NpJuyiAEBdqeKgjSGNYdYlcr59vHn6p73M2wYqBL7ns4khu9sZ7Tsj+Sno9UM kphtk7dIV1IzIqJjb4bemeYjPcvQYMSEaF5oKIsvcEkd4057JGpmwDyM0QBWj2eRhkXeE6iQa8HdG Ve8uJHjZURRn4LiQ+QePZkNgSAt7gPERawtoxFvIRvwJfSvVKygE9eaIx/Rgvdm0hvpQlaaj5e4cl Gz9sPDkOcjfhnn2gVYHR9mITn/nFHYUbMg3PTwaAnVs5Vug0v6lGEl9r/Gk3ubUOkoJBmC1sv6Dun 5aPYLi2QvJCAeOpAJ9pItw==; Date: Sat, 14 Mar 2026 11:38:28 +0200 Message-Id: <86cy16bvjf.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Philip Kaludercic <philipk@HIDDEN> In-Reply-To: <87bjgqkcuy.fsf@HIDDEN> (message from Philip Kaludercic on Sat, 14 Mar 2026 08:57:10 +0000) Subject: Re: bug#80611: [PATCH 1/1] Add new user option 'recompile-reuse-last-command' References: <87y0jvjmgm.fsf@HIDDEN> <86ms0abxwa.fsf@HIDDEN> <87bjgqkcuy.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80611 Cc: 80611 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Philip Kaludercic <philipk@HIDDEN> > Cc: 80611 <at> debbugs.gnu.org > Date: Sat, 14 Mar 2026 08:57:10 +0000 > > Eli Zaretskii <eliz@HIDDEN> writes: > > >> From: Philip Kaludercic <philipk@HIDDEN> > >> Date: Sat, 14 Mar 2026 00:15:06 +0000 > >> > >> I stumbled upon a thread that `rust-mode' will not set `compile-command' > >> to the value you'd expect for the major mode, because it can override > >> the previous command when calling `recompile'[0]. I think I've run into > >> an issue like this before, but never further thought about it. > > > > Are we talking about the scenario where the user visits a new file or > > turns on a major mode between "M-x compile" and "M-x recompile"? Or > > are we talking about other situations? > > We are talking about the first scenario. In the rust example, someone > called compile with "cargo check", then opened some other file with > `rust-mode' as the major mode. When executing `recompile', Emacs would > use the buffer local value, which at that point in time was set to > "cargo build", instead of re-using the previous "cargo check" command. > > > In any case, I don't think I understand the problem here. Modes are > > not supposed to set compile-command, but files can specify their local > > values for it. A file-local value overrides the value from the last > > "M-x compile", and I think it's a feature. > > Why shouldn't a major mode be able to set `compile-command'? So we are talking specifically about a mode that wants to set compile-command? Is the problem limited to that case? > If you are dealing with a language FOO where building a project > doesn't involve calling "make", but executing some command > "FOO-toolchain build", why not set Emacs up to suggest that by > default when calling `compile'? OK, but then why would a user expect "M-x recompile" to repeat the same command in another buffer of that mode? Or maybe we should add some feature to "M-x compile" whereby its initial setting of compile-command, which is also shown as default in the prompt to the user, could be affected by some new variable which modes could set? IOW, why is this deemed to be a problem with "M-x recompile"?
bug-gnu-emacs@HIDDEN:bug#80611; Package emacs.
Full text available.Received: (at 80611) by debbugs.gnu.org; 14 Mar 2026 08:57:21 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 14 04:57:21 2026 Received: from localhost ([127.0.0.1]:52152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w1KoC-0008K3-96 for submit <at> debbugs.gnu.org; Sat, 14 Mar 2026 04:57:21 -0400 Received: from mout01.posteo.de ([185.67.36.65]:41877) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <philipk@HIDDEN>) id 1w1Ko9-0008Iw-Kz for 80611 <at> debbugs.gnu.org; Sat, 14 Mar 2026 04:57:18 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 55EE0240027 for <80611 <at> debbugs.gnu.org>; Sat, 14 Mar 2026 09:57:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017; t=1773478631; bh=hwKUb+0b6lbjdPVniij8XW3ypYmQ/m3GyT2OMPhi3go=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=LVq/wey7uiRW3MyX20fn7RVFsHsm4WLJ+r7HE5AkO20LAOJLjNZk2axjuoEq0qyZr OpyW8JgEVCG3rIjB5O9L06hh6qAG0ylnGLlDabdkhtOqkZSaf3igdtvDYPkeF0hOpm LrdTDM218G8huDZiXCFNwFX9bx+SX8oNUY4tzdfS4LRuPPKt03jYWeZYHOW36aiHNI dYAUIh9dY+Z8o2oG3iS7w+GIwaJSE9PmhNaaTR/lymJ4Apnq1rDepj1TwJfQQcwKHP 7bqsrPwc2ij/go72Mwcc+rJuIOjt+/7pi0eEVMgX5yiWnEMA5ONmj1kM2LS7iQ6lLa wOCFzd3hx2cfA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4fXwGG26TQz9rxF; Sat, 14 Mar 2026 09:57:10 +0100 (CET) From: Philip Kaludercic <philipk@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#80611: [PATCH 1/1] Add new user option 'recompile-reuse-last-command' In-Reply-To: <86ms0abxwa.fsf@HIDDEN> References: <87y0jvjmgm.fsf@HIDDEN> <86ms0abxwa.fsf@HIDDEN> OpenPGP: id=philipk@HIDDEN; url="https://keys.openpgp.org/vks/v1/by-email/philipk@HIDDEN"; preference=signencrypt Date: Sat, 14 Mar 2026 08:57:10 +0000 Message-ID: <87bjgqkcuy.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 80611 Cc: 80611 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.6 (-) Eli Zaretskii <eliz@HIDDEN> writes: >> From: Philip Kaludercic <philipk@HIDDEN> >> Date: Sat, 14 Mar 2026 00:15:06 +0000 >> >> I stumbled upon a thread that `rust-mode' will not set `compile-command' >> to the value you'd expect for the major mode, because it can override >> the previous command when calling `recompile'[0]. I think I've run into >> an issue like this before, but never further thought about it. > > Are we talking about the scenario where the user visits a new file or > turns on a major mode between "M-x compile" and "M-x recompile"? Or > are we talking about other situations? We are talking about the first scenario. In the rust example, someone called compile with "cargo check", then opened some other file with `rust-mode' as the major mode. When executing `recompile', Emacs would use the buffer local value, which at that point in time was set to "cargo build", instead of re-using the previous "cargo check" command. > In any case, I don't think I understand the problem here. Modes are > not supposed to set compile-command, but files can specify their local > values for it. A file-local value overrides the value from the last > "M-x compile", and I think it's a feature. Why shouldn't a major mode be able to set `compile-command'? If you are dealing with a language FOO where building a project doesn't involve calling "make", but executing some command "FOO-toolchain build", why not set Emacs up to suggest that by default when calling `compile'? >> Unless we were to decide that the current behavior of `recompile' is >> false, I'd suggest adding a user option that makes `recompile' try to >> re-execute the command in the current *compilation*, regardless of what >> the buffer local value of `compile-command' is: > > Let's first define the behavior we want to see, and then discuss how > best to obtain it.
bug-gnu-emacs@HIDDEN:bug#80611; Package emacs.
Full text available.Received: (at 80611) by debbugs.gnu.org; 14 Mar 2026 08:47:52 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 14 04:47:51 2026 Received: from localhost ([127.0.0.1]:52121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w1Kf0-0006mv-AM for submit <at> debbugs.gnu.org; Sat, 14 Mar 2026 04:47:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52110) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1w1Keu-0006lD-UU for 80611 <at> debbugs.gnu.org; Sat, 14 Mar 2026 04:47:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1w1Keo-0005JF-5E; Sat, 14 Mar 2026 04:47:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jq4I04VxISn8by9y6Dr7g/CfZ2vUd+oeI852MVWZ2jE=; b=OaMuvcFQfJ4Q DzqScoRuqzzHeN+pClz+g+YaR1v9/0vQ4tYn/gQMwt8ZrMcqEFAsEyFssSXAQ/de2H3REk9aaZ/1f v4THy1DLLQIxyjO1dHIQGgos/axGM29zif49C1rWlBMBBdo4aWPTlv99YSSAmB4QDRnATJlzs9ybM FTzjrMYdFAOlLVNv7m7+ON/ZP8NvxtHAlqpxLKZ7puJaC+6Qswgq1x6pAXpbq/kQM7x/6GKT0EYDs x+MUlJuhCRG4FvhYWAzsm68fb1/DsXmCI/bQaB+Gp7BqsHdoMLpZhQzBFum08iU+0TzDBCmIT+B5R LHb7zDJQtjEdqHW3ZYz9NQ==; Date: Sat, 14 Mar 2026 10:47:33 +0200 Message-Id: <86ms0abxwa.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Philip Kaludercic <philipk@HIDDEN> In-Reply-To: <87y0jvjmgm.fsf@HIDDEN> (message from Philip Kaludercic on Sat, 14 Mar 2026 00:15:06 +0000) Subject: Re: bug#80611: [PATCH 1/1] Add new user option 'recompile-reuse-last-command' References: <87y0jvjmgm.fsf@HIDDEN> X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 80611 Cc: 80611 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Philip Kaludercic <philipk@HIDDEN> > Date: Sat, 14 Mar 2026 00:15:06 +0000 > > I stumbled upon a thread that `rust-mode' will not set `compile-command' > to the value you'd expect for the major mode, because it can override > the previous command when calling `recompile'[0]. I think I've run into > an issue like this before, but never further thought about it. Are we talking about the scenario where the user visits a new file or turns on a major mode between "M-x compile" and "M-x recompile"? Or are we talking about other situations? In any case, I don't think I understand the problem here. Modes are not supposed to set compile-command, but files can specify their local values for it. A file-local value overrides the value from the last "M-x compile", and I think it's a feature. > Unless we were to decide that the current behavior of `recompile' is > false, I'd suggest adding a user option that makes `recompile' try to > re-execute the command in the current *compilation*, regardless of what > the buffer local value of `compile-command' is: Let's first define the behavior we want to see, and then discuss how best to obtain it.
bug-gnu-emacs@HIDDEN:bug#80611; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 14 Mar 2026 00:15:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 13 20:15:26 2026
Received: from localhost ([127.0.0.1]:49260 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1w1Cf6-0006VC-Md
for submit <at> debbugs.gnu.org; Fri, 13 Mar 2026 20:15:26 -0400
Received: from lists.gnu.org ([2001:470:142::17]:47672)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <philipk@HIDDEN>)
id 1w1Cf3-0006Tu-A2
for submit <at> debbugs.gnu.org; Fri, 13 Mar 2026 20:15:22 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <philipk@HIDDEN>)
id 1w1Cex-0008Qa-NN
for bug-gnu-emacs@HIDDEN; Fri, 13 Mar 2026 20:15:15 -0400
Received: from mout01.posteo.de ([185.67.36.65])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <philipk@HIDDEN>)
id 1w1Cev-0004qZ-Ff
for bug-gnu-emacs@HIDDEN; Fri, 13 Mar 2026 20:15:15 -0400
Received: from submission (posteo.de [185.67.36.169])
by mout01.posteo.de (Postfix) with ESMTPS id CFD27240027
for <bug-gnu-emacs@HIDDEN>; Sat, 14 Mar 2026 01:15:06 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017;
t=1773447306; bh=juMWvIjhK8SVDmPS7QkZE/Fjjp4nSCqQ+AIxPeYzWAc=;
h=From:To:Subject:OpenPGP:Date:Message-ID:MIME-Version:Content-Type:
From;
b=AOvwVvM3fbMaswdx0t1QbGQe1e2qG2cOtyy5F1y0dXyFvLZ0oSlqCZgdh1qGirKu4
EoCf/Mx1tHmwb+TwzpVEVbgbNQ74MPXkejgydtJoDcZpr9dh6P/3r2ngwbhdYQ1Pb2
3HIeR67tCKs0VbtXSOP+fhrMctHDx4RRDl4Itwl/KtSSmaE57EEIa+t65VwAH80KeC
R/nsxTxy3m0BarLKtVD3Yaa7u5p1QqQitoVEL2MOTC1mL8omHeK0RTNsGjQQtGuFOx
AJe1ze9KgALARsgi4eR4wN53vp1gGoWiJ6KKxijD7MlAP42e3VrZJrH3cEJtIwzT8F
SHoU/Wwskhwow==
Received: from customer (localhost [127.0.0.1])
by submission (posteo.de) with ESMTPSA id 4fXhgt0ds8z6twZ
for <bug-gnu-emacs@HIDDEN>; Sat, 14 Mar 2026 01:15:05 +0100 (CET)
From: Philip Kaludercic <philipk@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH 1/1] Add new user option 'recompile-reuse-last-command'
OpenPGP: id=philipk@HIDDEN;
url="https://keys.openpgp.org/vks/v1/by-email/philipk@HIDDEN";
preference=signencrypt
Date: Sat, 14 Mar 2026 00:15:06 +0000
Message-ID: <87y0jvjmgm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@HIDDEN;
helo=mout01.posteo.de
X-Spam_score_int: -26
X-Spam_score: -2.7
X-Spam_bar: --
X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=0.001,
RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903,
SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
--=-=-=
Content-Type: text/plain
I stumbled upon a thread that `rust-mode' will not set `compile-command'
to the value you'd expect for the major mode, because it can override
the previous command when calling `recompile'[0]. I think I've run into
an issue like this before, but never further thought about it.
Unless we were to decide that the current behavior of `recompile' is
false, I'd suggest adding a user option that makes `recompile' try to
re-execute the command in the current *compilation*, regardless of what
the buffer local value of `compile-command' is:
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=0001-Add-new-user-option-'recompile-reuse-last-command'.patch
Content-Description: [PATCH 1/1] Add new user option 'recompile-reuse-last-command'
From eea8ce6b9fdba592cba79ae99ee209fcf129a0d3 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@HIDDEN>
Date: Sat, 14 Mar 2026 01:10:29 +0100
Subject: [PATCH 1/1] Add new user option 'recompile-reuse-last-command'
* etc/NEWS: Mention it.
* lisp/progmodes/compile.el (recompile-reuse-last-command): Add it.
(recompile): Respect it.
---
etc/NEWS | 6 ++++++
lisp/progmodes/compile.el | 14 ++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 44b285eafb9..37e8e9d913c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -767,6 +767,12 @@ mode in most cases in which Emacs would by default enter that mode.
This can make things work better for some cases of X forwarding; see the
docstring for the new option.
+---
+** New user option 'recompile-reuse-last-command'.
+When enabled, 'recompile' will try to use the last command from a
+"*compilation*" buffer, instead of the (possibly buffer-local) value in
+'compile-command'.
+
* Editing Changes in Emacs 31.1
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 27b2e59409d..1e8b97c5b58 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1884,6 +1884,13 @@ compile
(setq-default compilation-directory default-directory)
(compilation-start command comint))
+(defcustom recompile-reuse-last-command nil
+ "Non-nil means that `recompile' should reuse the command from a compile buffer.
+If no buffer exists, it will fall back to using `compile-command', which
+could have a buffer local value."
+ :type 'boolean
+ :version "31.1")
+
;; run compile with the default command line
;;;###autoload
(defun recompile (&optional edit-command)
@@ -1894,8 +1901,11 @@ recompile
(interactive "P")
(save-some-buffers (not compilation-ask-about-save)
compilation-save-buffers-predicate)
- (let ((default-directory (or compilation-directory default-directory))
- (command (eval compile-command)))
+ (let* ((default-directory (or compilation-directory default-directory))
+ (buffer (compilation-buffer-name "compilation" nil nil))
+ (command (or (and recompile-reuse-last-command (get-buffer buffer)
+ (buffer-local-value 'compile-command buffer))
+ (eval compile-command))))
(when edit-command
(setq command (compilation-read-command (or (car compilation-arguments)
command)))
--
2.47.3
--=-=-=
Content-Type: text/plain
[0] https://github.com/rust-lang/rust-mode/issues/226
--=-=-=--
Philip Kaludercic <philipk@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#80611; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.