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.devel Subject: Re: master 9904376c797: Support calling 'project-current' with custom prompt Date: Wed, 23 Oct 2024 22:51:13 +0300 Message-ID: <98b80b2d-816f-4762-be8a-617b1b6380f4@gutov.dev> References: <172834239339.3048552.12080367051270999761@vcs3.savannah.gnu.org> <20241007230633.CC7E91EAF92@vcs3.savannah.gnu.org> 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="3500"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Eshel Yaron , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 23 21:51:58 2024 Return-path: Envelope-to: ged-emacs-devel@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 1t3hOg-0000ei-2E for ged-emacs-devel@m.gmane-mx.org; Wed, 23 Oct 2024 21:51:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3hO6-0002tq-73; Wed, 23 Oct 2024 15:51:22 -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 1t3hO4-0002tS-Ew for emacs-devel@gnu.org; Wed, 23 Oct 2024 15:51:20 -0400 Original-Received: from flow-a8-smtp.messagingengine.com ([103.168.172.143]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3hO2-00036f-Dv for emacs-devel@gnu.org; Wed, 23 Oct 2024 15:51:20 -0400 Original-Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailflow.phl.internal (Postfix) with ESMTP id 2E8D12007EF; Wed, 23 Oct 2024 15:51:16 -0400 (EDT) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Wed, 23 Oct 2024 15:51:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=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=1729713076; x=1729720276; bh=xrTWh++xx5kFLI91jgBloLL7DSgTH3mRYJaqVRt4+Wo=; b= QKS7ht8xYuFBvJsPr8baUGwa3Lo6LrDbAvO8b02ODamqqEQ6cSrvxXOVMU9Q6wtt RlQxcUMfaKDvQsjs0qaZAlU7J03FkkcmzihuYA4VRbviod04PEMmB/TPd6Gvg5jS hq6sWcqsy4XcyELicuoPhfjvDS5sLC0OrACXYkMaDnd8W/2PwzWcR7bUbzrCy/L4 SjLG/oj4pb/91/Vg2MhdwQ6FEEf8DIigXL5wH1z47GcyApN86/IpA8ehnAwp+uwc DEm/4d3IUjUMUOVE0XcJzttwhJBE/zqbACCq9bN8V4AByFSgokWF6kGLyJkqx7SL xfBVJ26rXZHYGpsXK8IXHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=i07de48aa.fm3; t= 1729713076; x=1729720276; bh=xrTWh++xx5kFLI91jgBloLL7DSgTH3mRYJa qVRt4+Wo=; b=nhnn/+JON1th7dADbcwvVWZircjAqIBeBqMtNUY7tONp1MR7IWd lpQj1ZsJ4FRRqHul2R0JtqWZx0paxmGLhicRU1JaqZu7XI4xZ7VaL5HuVoHoBWxF pS9gY2huD5cyU9Mjl4az1Ho6Gt/vt1vED9doU45U9dJvWksskTCsocWnyoJEilux b4bHWSWXMaUs2Z0c+uv8PV9RalcsRryooFMveW0QaExl0PBHdswUmLN20wOiIvcl lCgxNLvzom/EdUpmOCFmVMers8fYTE+CftsD2nYO/6DIsbHKBc+X6LMQNIUgMK0g ONPSfOoMiEVuTA1evh0mmV/ez07xHcMi0Lg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeijedgudegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgg gfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhv uceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtthgvrhhnpedthfeuvd dtveelgeeuleevvdejveehffevveehvdeuffdtfefhvdeugefgtefgtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuth hovhdruggvvhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghp thhtohepmhgvsegvshhhvghlhigrrhhonhdrtghomhdprhgtphhtthhopegvmhgrtghsqd guvghvvghlsehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Oct 2024 15:51:14 -0400 (EDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=103.168.172.143; envelope-from=dmitry@gutov.dev; helo=flow-a8-smtp.messagingengine.com 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324804 Archived-At: Hi Eshel, On 23/10/2024 09:54, Eshel Yaron wrote: > Hi Dmitry, > > Dmitry Gutov writes: > >> branch: master >> commit 9904376c797665de47ff760bcf8c2fe33d7ae625 >> Author: Dmitry Gutov >> Commit: Dmitry Gutov >> >> Support calling 'project-current' with custom prompt >> > > [...] > >> - (setq directory (funcall project-prompter) >> + (setq directory (if (stringp maybe-prompt) >> + (funcall project-prompter maybe-prompt) >> + (funcall project-prompter)) > > JFYI, I'm using a custom project-prompter, which was not prepared to be > called with an argument, so I got some unexpected errors until I > realized what changed. A quick lookup online shows that although this > option is quite new, a few others already set it to a custom function, > so it might be worth catching the "Wrong number of arguments" error. It's good of you to bring this up, but under what conditions do you encounter the breakage? Are there 3rd-party callers of 'project-current' already as well, that pass a string as MAYBE-PROMPT? If so, that's a little quicker than I expected. :) Catching an error might be a fine approach, but then a lot of people would miss out on the reason why the provided prompt is not used. > Also, I'd like to update the docstring of project-prompter along the > following lines, if it looks right to you: > > diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el > index 3cdaa7c2a76..6383bdc95d2 100644 > --- a/lisp/progmodes/project.el > +++ b/lisp/progmodes/project.el > @@ -199,7 +199,9 @@ project-current-directory-override > > (defcustom project-prompter #'project-prompt-project-dir > "Function to call to prompt for a project. > -Called with no arguments and should return a project root dir." > +The function is either called with no arguments or with one argument, > +which is the prompt string to use when prompting. It should return a > +project root directory." > :type '(choice (const :tag "Prompt for a project directory" > project-prompt-project-dir) > (const :tag "Prompt for a project name" Thanks, I've pushed a slight edit of that (sorry it went out without attribution). Also updated the corresponding NEWS entry.