From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#45765: [PATCH] 28.0.50; Change default-directory before prompting in project-compile Date: Wed, 13 Jan 2021 03:06:37 +0200 Message-ID: <6e5456e4-a5ac-3e54-2ced-0116a6e7a9dc@yandex.ru> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12191"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: 45765@debbugs.gnu.org To: Juri Linkov , =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 13 02:07:20 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 1kzUd5-00032d-Qs for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Jan 2021 02:07:19 +0100 Original-Received: from localhost ([::1]:60946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzUd4-0007tm-So for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Jan 2021 20:07:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzUcp-0007sG-4L for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 20:07:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50472) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzUco-0001jy-Gb for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 20:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kzUco-0007cT-AR for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 20:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Jan 2021 01:07: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.161050000929263 (code B ref 45765); Wed, 13 Jan 2021 01:07:02 +0000 Original-Received: (at 45765) by debbugs.gnu.org; 13 Jan 2021 01:06:49 +0000 Original-Received: from localhost ([127.0.0.1]:33785 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzUcb-0007bu-GC for submit@debbugs.gnu.org; Tue, 12 Jan 2021 20:06:49 -0500 Original-Received: from mail-ed1-f43.google.com ([209.85.208.43]:45889) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzUcZ-0007bc-Bs for 45765@debbugs.gnu.org; Tue, 12 Jan 2021 20:06:48 -0500 Original-Received: by mail-ed1-f43.google.com with SMTP id r5so78010eda.12 for <45765@debbugs.gnu.org>; Tue, 12 Jan 2021 17:06:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VrJONZx7ilfb/XZpm3C+2h+paz66vjTR/X6fcIhLW0g=; b=Q3oJhNhCRgbygbuAC4go9Kf2Qf/oDBrrEqSS+ubRxEIXEMlZzLV+uytyb+kiTZyKlZ PQ0nB/ggZF3nXsTc056K4CYIUvqvOTPygpkDHhYavGRf+u1wM0GOl1njiWMxa8FYrxM7 jwz0wVT7DYnPqK6gBjQnhrhgsHKupu3gCUqzsLLQ9sVjy53YKUc0ze6u4pBc6Z34xkTn 3TIUH3R/FiCmQK+7xIZ6/ZAeVK5pG9QGlzui1fitYHT9dmbn3n6lYzbZI4+PxloR/fAS jcbfyZ87PNmPLNkc7V9L72GQZRXAVYPFLmtc7WI2kZrsEJJaZCJrSTWOYfLxrNk0N0MF Fm+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VrJONZx7ilfb/XZpm3C+2h+paz66vjTR/X6fcIhLW0g=; b=bbM5bqPR4kQzr97kO2mOLQFM2TblwsC8FQAGnICt2eD7S24TRI+aO1dQHnwwVCd7D/ RSkmpAe8ksb1iktmWMEinQy+n1CMdmPBhA1OepZimVfPJTXGhAZo/9QvbuTkbrbcf9q/ WMh5Tyrfd4ZSo7S8skuECrZLpkpbslkQHbTTmN1xhYK2M/x4tRV9qaEbRcv/eTczWTEu 6L5zVVYHKhFeBkZSuSwRoV/n+WpJGSCIpwXvhCeVGtz0+Y89TWcviHc5BJtxEgIjiLGL 2CWenCL8yxrM7VEwo14rXkzwmXtEhw+r96oQQmXDnGELudtHD5cvFAeHgnk8P/lY+Fiw bFmA== X-Gm-Message-State: AOAM533knEb6pl9fDwSNWwghB7+VPYaLUuNkSdxMyWYdt7JX4ypDQ4TV lkQE0hI5Ks6rShM3HL0XYsDfOSNdeAfNNg== X-Google-Smtp-Source: ABdhPJzHoFeLBspoLwrwoP2KJ1tcn8xFv9zf6FHirT0G7awBg9k6D+YODhTWG3eIbtUSdGmbPST3PQ== X-Received: by 2002:a50:fc0d:: with SMTP id i13mr1403319edr.171.1610500001215; Tue, 12 Jan 2021 17:06:41 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id f17sm147237edv.5.2021.01.12.17.06.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Jan 2021 17:06:40 -0800 (PST) In-Reply-To: <87lfcywhyc.fsf@mail.linkov.net> Content-Language: en-US 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:197871 Archived-At: Hi Juri, On 12.01.2021 20:46, Juri Linkov wrote: >> Something like this maybe? >> >> +(defun project-compile (command &optional comint interactive) >> +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)))) >> >> (Apologies if I misunderstood what Juri asked, or if my suggestion is >> buggy) > Perfect, thank you for finding the middle ground for different needs. 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)))) But if you really like the new version of project-compile, OK. I'm not a big fan of the 'interactive' argument. It could be replaced by using (called-interactively-p 'interactive), though I'm not sure how idiomatic that is.