From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#45765: [PATCH] 28.0.50; Change default-directory before prompting in project-compile Date: Mon, 11 Jan 2021 22:24:31 +0100 Message-ID: <87zh1fyxo0.fsf@gmail.com> References: <87bldx2bmk.fsf@gmail.com> <87ft37bbp0.fsf@mail.linkov.net> <01a19619-e48a-825f-b459-5b04df402ad6@yandex.ru> 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="11521"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 45765@debbugs.gnu.org, Juri Linkov To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 11 22:25:39 2021 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 1kz4h0-0002r3-Br for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 22:25:38 +0100 Original-Received: from localhost ([::1]:48528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz4gz-0000dt-3d for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 16:25:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz4gR-0000Wn-BT for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 16:25:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kz4gQ-0000Gs-FL for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 16:25:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kz4gQ-000661-Ao for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 16:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jan 2021 21:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45765 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45765-submit@debbugs.gnu.org id=B45765.161040028323398 (code B ref 45765); Mon, 11 Jan 2021 21:25:02 +0000 Original-Received: (at 45765) by debbugs.gnu.org; 11 Jan 2021 21:24:43 +0000 Original-Received: from localhost ([127.0.0.1]:58480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kz4g6-00065K-Te for submit@debbugs.gnu.org; Mon, 11 Jan 2021 16:24:43 -0500 Original-Received: from mail-wr1-f41.google.com ([209.85.221.41]:33049) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kz4g3-000653-RE for 45765@debbugs.gnu.org; Mon, 11 Jan 2021 16:24:40 -0500 Original-Received: by mail-wr1-f41.google.com with SMTP id t30so281494wrb.0 for <45765@debbugs.gnu.org>; Mon, 11 Jan 2021 13:24:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=gS0VZLshH8jJJjC0I9qW2f/EMGBUxtjy9oEnk4xg3TI=; b=uUMATJSBWF7yE+fhuNJCDL61n/r4ANuUdBuXmbkxSporzTq+c7boU0AqhTHQHqDrcM 39UUGdV3QqrfKJIX5lUFsw47nfEqKDWfQOviJsqdgZNLzlGFfAgnfVGUkfn/J4Z5MHIy +mfAYbk57z/xxMoITVacJCekFxAvHc60RMQDWfqUcEW+n5MGCcgOhDyHTgvFP7IQps4g 83g/MrfdDz9u+sFbtcInb1DllaTacE/DLDsoKXhygKjKUysRliymgjf/SOHfcIcOs2iL oKB7vpOIXSfaaUpmKMW/LK8SFR5P5ok/wC7z8c9K+fO8kfB23ZmBFVC5SxKcKWESW+YK DdRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=gS0VZLshH8jJJjC0I9qW2f/EMGBUxtjy9oEnk4xg3TI=; b=LhpjXor3D5BmjaM/7jeTUnwR0RTCH9p3eL/RP+QAOgi8aFeQ5rGnfh6uw0g7Y2mMO8 qBOyIRopcI3bAsaWvDdIXFyoCQQD6gJPWAEgb4YUHPje4/4S3LO30CFP2p1XqpMJHwoi VWFLIqEDLrrL8Af6Fgqce4o30WggM4zq32Rz78ba9zTWbAK8sTvcAEuF170zxSch33H4 eZ/5MRFrN510hUvDkcVXQPCrvU07cFR+wGDBafd5Z69foQdfX/I0HD78eEaNJpQvb2yQ AYBxC0xns//CEsXCO+e+YbIUM4EgHlrRXb/rNe8CCUa2O3IOMxVPaDtCCJRUEOP63yYS IG9g== X-Gm-Message-State: AOAM530nUIMnolKZwBEbnuCyjuVPRxQM/q8biDIfjZKqfKDWwYvwJDR0 S3rpGUYNSEvPvJKAIPvTv8fTTHS+no5Giw== X-Google-Smtp-Source: ABdhPJwga8KUqbmxfoUEP0hR7r5Sg255XZMzsdeKpHTEjFuEWxuEh3xcxVWJEJrVXd5HlZLWRa6p2w== X-Received: by 2002:adf:fc48:: with SMTP id e8mr942665wrs.11.1610400273469; Mon, 11 Jan 2021 13:24:33 -0800 (PST) Original-Received: from my-little-tumbleweed ([2a01:e0a:20e:d340:922b:34ff:fe95:9aed]) by smtp.gmail.com with ESMTPSA id r2sm1190864wrn.83.2021.01.11.13.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 13:24:32 -0800 (PST) In-Reply-To: <01a19619-e48a-825f-b459-5b04df402ad6@yandex.ru> (Dmitry Gutov's message of "Mon, 11 Jan 2021 21:13:23 +0200") 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" Xref: news.gmane.io gmane.emacs.bugs:197756 Archived-At: --=-=-= Content-Type: text/plain Dmitry Gutov writes: > On 11.01.2021 20:35, Juri Linkov wrote: >> But before rewriting with call-interactively, >> we need to find a way to use project-compile in the init files, i.e. >> to find a replacement for such configurations: >> > > Is it really possible to solve this without making project-compile a > macro of some sort? Something like this maybe? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Change-default-directory-before-prompting-in-project.patch >From 7d3ffd7f33276949669414ed4908ad8fee35dd93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= Date: Sun, 10 Jan 2021 10:43:41 +0100 Subject: [PATCH] Change default-directory before prompting in project-compile This causes command completion to work from the project root, letting users complete top-level folders, make targets, etc. * lisp/progmodes/project.el (project-compile): Simplify using call-interactively, as done with project(-aysnc)-shell-command. --- lisp/progmodes/project.el | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 62c3cf44cb..dade8b4f1c 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -970,20 +970,16 @@ compilation-read-command (declare-function compilation-read-command "compile") ;;;###autoload -(defun project-compile (command &optional comint) +(defun project-compile (command &optional comint interactive) "Run `compile' in the project root. -Arguments the same as in `compile'." - (interactive - (list - (let ((command (eval compile-command))) - (require 'compile) - (if (or compilation-read-command current-prefix-arg) - (compilation-read-command command) - command)) - (consp current-prefix-arg))) - (let* ((pr (project-current t)) - (default-directory (project-root pr))) - (compile command comint))) +COMMAND and COMINT work as with `compile'. When calling this +function from Lisp, you can pretend that it was called +interactively by passing a non-nil INTERACTIVE argument." + (interactive (list nil nil t)) + (let ((default-directory (project-root (project-current t)))) + (if interactive + (call-interactively #'compile) + (compile command comint)))) (defun project--read-project-buffer () (let* ((pr (project-current t)) -- 2.29.2 --=-=-= Content-Type: text/plain (Apologies if I misunderstood what Juri asked, or if my suggestion is buggy) We can also stick a "\(fn COMMAND &optional COMINT)" in the docstring if we don't want to advertise the INTERACTIVE argument. --=-=-=--