From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45765: [PATCH] 28.0.50; Change default-directory before prompting in project-compile Date: Wed, 13 Jan 2021 20:05:20 +0200 Organization: LINKOV.NET Message-ID: <871repko0f.fsf@mail.linkov.net> References: <87bldx2bmk.fsf@gmail.com> <87ft37bbp0.fsf@mail.linkov.net> <01a19619-e48a-825f-b459-5b04df402ad6@yandex.ru> <87zh1fyxo0.fsf@gmail.com> <87lfcywhyc.fsf@mail.linkov.net> <6e5456e4-a5ac-3e54-2ced-0116a6e7a9dc@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38152"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 45765@debbugs.gnu.org, =?UTF-8?Q?K=C3=A9vin?= Le Gouguec To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 13 19:13:08 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 1kzkdo-0009nq-Kz for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Jan 2021 19:13:08 +0100 Original-Received: from localhost ([::1]:46102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzkdn-0006DR-ME for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Jan 2021 13:13:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzkZq-0003kT-SK for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2021 13:09:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53241) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzkZq-0004o2-Iz for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2021 13:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kzkZq-0000YP-EY for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2021 13:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Jan 2021 18:09: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.16105613062062 (code B ref 45765); Wed, 13 Jan 2021 18:09:02 +0000 Original-Received: (at 45765) by debbugs.gnu.org; 13 Jan 2021 18:08:26 +0000 Original-Received: from localhost ([127.0.0.1]:36549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzkZF-0000XC-U2 for submit@debbugs.gnu.org; Wed, 13 Jan 2021 13:08:26 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:58241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzkZE-0000Wl-7J for 45765@debbugs.gnu.org; Wed, 13 Jan 2021 13:08:25 -0500 X-Originating-IP: 91.129.98.64 Original-Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id C89891BF213; Wed, 13 Jan 2021 18:08:16 +0000 (UTC) In-Reply-To: <6e5456e4-a5ac-3e54-2ced-0116a6e7a9dc@yandex.ru> (Dmitry Gutov's message of "Wed, 13 Jan 2021 03:06:37 +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:197910 Archived-At: > So you're not worried about compilation-read-command in your code being > called in the wrong directory (exhibiting what the current bug report aims > to fix)? > > I think you might as well inline the definition, it's almost as short: > > (define-key my-map "m" ;; mnemonics "make" > (lambda () > (interactive) > (let ((default-directory (project-root (project-current t)))) > (compile > ;; Use previous command from history > ;; instead of the default from compile-command > (compilation-read-command (car compile-history)) > ;; Don't use compilation-shell-minor-mode > nil)))) Indeed, this means that let-binding default-directory to (project-root (project-current t))) is unavoidable in the init file. So it's easier to just replace 'project-compile' with 'compile'. This means Kévin's first patch is the way to go.