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#69584: 29.2.50; project-find-functions should have access to maybe-prompt Date: Wed, 3 Apr 2024 02:10:56 +0300 Message-ID: <86952e0e-3856-4370-8e0b-08788e929811@gutov.dev> References: <65b29bab-3149-49e3-a6ae-6c0c1485e6f2@gutov.dev> <875xxmjoc9.fsf@catern.com> <34e15612-77bc-4a67-b493-e00c97d1155e@gutov.dev> 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="12925"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: sbaugh@catern.com, 69584@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 03 01:12:25 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 1rrnIl-00038X-8l for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Apr 2024 01:12:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rrnIP-0006pK-M5; Tue, 02 Apr 2024 19:12:01 -0400 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 1rrnIM-0006pB-Ps for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2024 19:11:58 -0400 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 1rrnIM-00043t-Db for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2024 19:11:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rrnIQ-0006mz-2t for bug-gnu-emacs@gnu.org; Tue, 02 Apr 2024 19:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Apr 2024 23:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69584 X-GNU-PR-Package: emacs Original-Received: via spool by 69584-submit@debbugs.gnu.org id=B69584.171209947325815 (code B ref 69584); Tue, 02 Apr 2024 23:12:02 +0000 Original-Received: (at 69584) by debbugs.gnu.org; 2 Apr 2024 23:11:13 +0000 Original-Received: from localhost ([127.0.0.1]:56541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrnHc-0006iJ-TF for submit@debbugs.gnu.org; Tue, 02 Apr 2024 19:11:13 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55665) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrnHa-0006hL-Cr for 69584@debbugs.gnu.org; Tue, 02 Apr 2024 19:11:11 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id B801D5C00B6; Tue, 2 Apr 2024 19:10:59 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 02 Apr 2024 19:10:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1712099459; x=1712185859; bh=Lfs754WD/hIoo+Yyc9alC/f5EzB3tMchgFONE4A34k0=; b= KpTXJ1dyX0jHnaTPNk02DmtwFSWsxQdhwCXWKQ3hM6uEPqQDphC9EGjJbW62HS31 K+Y8R/q3GdfEXaweAlPHL8o5YKk0dSi86uINhPqcX/F4mhCUKsJ1xQiHNKKBSFUX XuTmMune+aBEcoxzyoWNJfC0K3xgDiK3xrkG7cIXrayVsDZIuCs6cedMCIJHpDFt Qs0pCIIYEK9iG8lrsIszjmlp+GQbI9FAq64mMIJ4vqWA11iVemd5UimblTH5K419 U7lsNaw2dSFox68KeUsSqQ+U6VepfHD8eeJA7x2z7gG9j23tkskCDyLxVbZSE26L e1FguTHBywQljJhTSxVuDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1712099459; x= 1712185859; bh=Lfs754WD/hIoo+Yyc9alC/f5EzB3tMchgFONE4A34k0=; b=u yzpt93zChUJFYScvDZHc6sFLl1iNKD5IN2JM8WuMk+sRjglminVvFfO+2sjCTptZ psKAT7mfWNJ0zcj0oibOjmK6AnFnnijULNE4G832+UWv9sxx8TZYChWKe8CS5N7d gIYVVwhjezYJDHd721/xMRLkLkuBBBio0o3ZQ7alGodNafu8AOTckq8xH9peQ7et vnTi1cQGYktolDOtAOmCGbT1fk2OrI9miEE9synsQjWfqZVM1v3ZVFcgdtucweGQ oNYGggTSxxyDhx5MkVNWykEyTE5mA4vEkx5yNK0cEtino3sVd5adt47DYuO6w1MV 0G8yZJbsjj+vWi91K2rSg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeffedgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepteduleejgeehtefgheegjeekueehvdevieekueeftddvtdevfefhvdevgedu jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 2 Apr 2024 19:10:58 -0400 (EDT) Content-Language: en-US In-Reply-To: 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:282551 Archived-At: On 02/04/2024 20:54, Spencer Baugh wrote: > Spencer Baugh writes: >> So when you open up a branch overview, you'll usually assume there's a >> local copy, and so your first action will probably some command which >> uses project-current. But if there's no working copy, then you'll get >> dropped to a prompt to choose a project, instead of (say) a >> project-find-file prompt, which you might not immediately notice, which >> is confusing, and you'll have to C-g out of it, and then run some other >> command to create the working copy. All that is a hassle. > > Oh, I've thought of a different resolution to this which may be better. > > When project-current fails to find a project in default-directory, if > maybe-prompt=t, project-current will run project-prompter. > > So I can just have a buffer-local project-prompter in the branch > overview buffer. And that project-prompter knows it's in a branch > overview buffer, and can prompt "Would you like to make a working copy > for [some branch]?". > > That's elegant and doesn't change the semantics of project-current at > all: project-prompter already can return an arbitrary directory. > > Except... I suppose this would make project-switch-project behave worse, > because hitting C-x p p in a branch overview buffer would now prompt to > create a working copy for that branch, when what you probably want to do > is switch to a different project entirely. > > I guess there are two use cases for project-prompter: one is "fallback > for project-current" and the other is "switch to a different project". > Maybe we could support them being different? I'm not sure how we'd do that. A new, optional, argument to project-prompter? Two different variables? Right now we have two well-defined steps: - Run a hook, where the current project can be detected, - Or call the prompter, which will let the user choose a project manually (from the history, or from the file system). That helps the prompter have a compact, focused interface. If it can also ask about other things, that makes things more complicated. But for your own system, I suppose you could implement the described workflow right now with the current tools, using add-function: your project-find-functions element would itself return nil but add an around-advice for project-prompter, which would do more work, prompt the user, and ultimately return the intended object. And remove the advice as the first step, of course. What could require further testing - is the scenario where the prompter is called twice (when you invoke project-switch-project), but it'll probably work too, since the calls are not recursive. To take a step back, I wonder if you have tried using the newly added binding for 'non-essential' yet. It seems like it should allow a simpler implementation.