From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron Newsgroups: gmane.emacs.devel Subject: Re: master 9904376c797: Support calling 'project-current' with custom prompt Date: Thu, 24 Oct 2024 09:30:07 +0200 Message-ID: References: <172834239339.3048552.12080367051270999761@vcs3.savannah.gnu.org> <20241007230633.CC7E91EAF92@vcs3.savannah.gnu.org> <98b80b2d-816f-4762-be8a-617b1b6380f4@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32171"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 24 09:31:11 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 1t3sJK-00089w-WF for ged-emacs-devel@m.gmane-mx.org; Thu, 24 Oct 2024 09:31:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3sIS-0003mt-67; Thu, 24 Oct 2024 03:30:16 -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 1t3sIP-0003mN-L0 for emacs-devel@gnu.org; Thu, 24 Oct 2024 03:30:14 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3sIN-0001l4-DA for emacs-devel@gnu.org; Thu, 24 Oct 2024 03:30:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1729755010; bh=gQAeQGn4lYKU/9TnzV7cpEsId2G+5F2k3Bbm6ro4T7c=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jhoKJ31bydHrxd+njmB5si9Hu+mm4I0ET96ECTdZW7vFThy5Ut/WABlpykUqBSVGz OsAWzew1VkzRYYwZAm/xM8rxv+w+GhPpDbiFdaY79UNAXNmmt2yaiBH/Jp0HzP8VQ1 mF2UaWBcc2WanX0CjJra7weZHv1fX5dq+eaK7cdxt58NjOCRrFERur5L8QxV7pRGp5 SoZhd9ois65UGk5fOoHR7GaJu1ZiQz1VoNXPMEHtXljvwjgBSdu5NuFkWPL11g3C3G M036JtN5OUeBW5Ph5z30IqK1OnPyzV+62HKxN/Mod3NppZa66fZBY8VYokhlDVoxpj JW9FfgLiSrnJA== In-Reply-To: <98b80b2d-816f-4762-be8a-617b1b6380f4@gutov.dev> (Dmitry Gutov's message of "Wed, 23 Oct 2024 22:51:13 +0300") X-Hashcash: 1:20:241024:emacs-devel@gnu.org::d3vIWhtANHCcFpVW:1YTd X-Hashcash: 1:20:241024:dmitry@gutov.dev::WRLSzen0FcD60sf9:2Q2R Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@eshelyaron.com; helo=eshelyaron.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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:324813 Archived-At: Dmitry Gutov writes: >> 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. :) Ah, no, you're right, I got the error through custom code of mine. I adapted some code to call project-current with a string, without adapting my project-prompter function accordingly. > 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. Yeah, that's a reasonable consideration too. >> 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. Great, thank you. Eshel