From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74631: 30.0.92; [PATCH] autoload project-recompile and set default-directory Date: Sun, 01 Dec 2024 11:46:30 +0100 Message-ID: <87zflffzp5.fsf@daniel-mendler.de> Reply-To: Daniel Mendler Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27642"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Dmitry Gutov To: 74631@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 01 11:49:28 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tHhW4-0006zy-8Q for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 11:49:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHhVh-0007hx-HV; Sun, 01 Dec 2024 05:49:05 -0500 Original-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 ) id 1tHhVf-0007hU-6S for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 05:49:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHhVe-0007Vx-SA for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 05:49:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=+hMgZif1pQ4QFMfSjPzToDq5hRdFyuLyTiUSfzo/T/0=; b=lKZv+crxFyWbYo+LgklygnVrplrK5dF/ACjIu06wxxdxhIRHNoLtpZMI/kAml08dOw4bLLHW2wBsLvxTRcs2rdJYIDFZvqyeUrntB3AOvh/XEO1TvpS06e7ph+4MpoiesRQOkAuBe2om7txU77Ac7v34hPAKApR3TRItmnOG3oc8sZW5PrSjd8iAcugRqZ8JNKIxGY4cQ3Aemz4yYbeFBI/sGeHrK1oggJlLBAIgOMC7NLTc6E4T66xhKQAopHBeDuAmwzmQ3ScA4wNTvqCWxLmWRhq0HFacHwlX0pnl0EhjHXBiWFL6rvR2CPYXPtEqQwYToivCn8WBifrOjdzHiA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHhVe-0001EC-MH; Sun, 01 Dec 2024 05:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: dmitry@gutov.dev, bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2024 10:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74631 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Dmitry Gutov Original-Received: via spool by submit@debbugs.gnu.org id=B.17330501294682 (code B ref -1); Sun, 01 Dec 2024 10:49:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Dec 2024 10:48:49 +0000 Original-Received: from localhost ([127.0.0.1]:50393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHhVR-0001DS-5t for submit@debbugs.gnu.org; Sun, 01 Dec 2024 05:48:49 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:37080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHhVP-0001DI-NN for submit@debbugs.gnu.org; Sun, 01 Dec 2024 05:48:48 -0500 Original-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 ) id 1tHhTJ-0007bX-DV for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 05:46:37 -0500 Original-Received: from server.qxqx.de ([2a01:4f8:c012:9177::1] helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHhTH-00076s-DE for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 05:46:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+hMgZif1pQ4QFMfSjPzToDq5hRdFyuLyTiUSfzo/T/0=; b=y3Ce8psLNxxZMYPYb8XJbVCOez 1tKq0iGgEU3JWWwFqA9kf4z4iIzP3Mif09/xjuDlNEsTBqYe2GCqSbavZgEF1DoFt1nzRx4yMec8c ImVHx1itL+UQZaQ1p1FXQpEeHK74UPrlLuIiQOwlhSAQOSzDIuCrnnb43bW7iTFP7Dro=; Received-SPF: pass client-ip=2a01:4f8:c012:9177::1; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296235 Archived-At: --=-=-= Content-Type: text/plain In order to make `project-recompile' symmetric to `recompile' it should be autoloaded and it should run in the project root. This makes it possible to call `project-recompile' directly without calling `compile' first. ;;;###autoload (defun project-recompile (&optional edit-command) "Run `recompile' with appropriate buffer." (declare (interactive-only recompile)) (interactive "P") (let ((default-directory (project-root (project-current t))) (compilation-buffer-name-function (or project-compilation-buffer-name-function compilation-buffer-name-function))) (recompile edit-command))) This change also resolves the comment in project-recompile: ;; Should we error instead? When there's no ;; project-specific naming, there is no point in using ;; this command. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-project-recompile-Autoload-and-run-in-project-root.patch >From a330baaaf7a50f3bdf665b32efadb27283453f7f Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 1 Dec 2024 11:43:48 +0100 Subject: [PATCH] project-recompile: Autoload and run in project root * lisp/progmodes/project.el (project-recompile): Autoload and use project root as `default-directory'. --- lisp/progmodes/project.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ba5a6b6f056..d47b732712f 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1455,15 +1455,14 @@ project-compile compilation-buffer-name-function))) (call-interactively #'compile))) +;;;###autoload (defun project-recompile (&optional edit-command) "Run `recompile' with appropriate buffer." (declare (interactive-only recompile)) (interactive "P") - (let ((compilation-buffer-name-function + (let ((default-directory (project-root (project-current t))) + (compilation-buffer-name-function (or project-compilation-buffer-name-function - ;; Should we error instead? When there's no - ;; project-specific naming, there is no point in using - ;; this command. compilation-buffer-name-function))) (recompile edit-command))) -- 2.45.2 --=-=-=--