From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#69584: 29.2.50; project-find-functions should have access to maybe-prompt Date: Wed, 06 Mar 2024 09:23:24 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9183"; mail-complaints-to="usenet@ciao.gmane.io" To: 69584@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 06 15:24:53 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 1rhsCS-000294-Mi for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Mar 2024 15:24:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhsC9-0008IX-VH; Wed, 06 Mar 2024 09:24:33 -0500 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 1rhsC7-0008IE-BJ for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2024 09:24:31 -0500 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 1rhsC7-0002al-3Q for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2024 09:24:31 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rhsCb-0007ry-Or for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2024 09:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Mar 2024 14:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69584 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170973505230175 (code B ref -1); Wed, 06 Mar 2024 14:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Mar 2024 14:24:12 +0000 Original-Received: from localhost ([127.0.0.1]:50055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhsBn-0007qc-Mc for submit@debbugs.gnu.org; Wed, 06 Mar 2024 09:24:12 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:58330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhsBl-0007qT-4p for submit@debbugs.gnu.org; Wed, 06 Mar 2024 09:24:09 -0500 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 1rhsBD-0008E3-Fx for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2024 09:23:35 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhsB5-0001sx-NX for bug-gnu-emacs@gnu.org; Wed, 06 Mar 2024 09:23:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1709735004; bh=I77LpymAYoYyoSZYHQun9aNJf4NdmCJh8quYW/+u6/g=; h=From:To:Subject:Date; b=wUTrsgw/wEnpNxeEq1C5kY1RMa3nS2xf8O8jLfWXu1/EdgH5B/DtSL/dUgEhZIw0G /SsZAJLkqjHpj1/OZe5HyLrUaLGdMwk72YnNjXhkaYC2UeBy/ln9Wyy3YupjZS+E9T l79/SHPd3qaTs/sxUD2EOGpahg/0mxwymk+XMo5VUUn0iEl7mFheAysittikQBvEHj lEZLj9sJh2UgfFA7FjQIjcXRQ1m9/4xcgnLdkELs7A7TYqhC89Y5nX/gpPQmQU2ryp lJAlk5swijmMPz0l6xX1gvDtGG5ThC6u74SD1P+LEXECMXU57TVpxrFF4NAhhebQsF sjeJWrGqxJIfQ== Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:281113 Archived-At: I'd like to write a project-find-function which might prompt when called, and so to suppress that prompting I'd like to be able to check the maybe-prompt argument that project-current received. Possible new functions for project-find-functions which would benefit from this: - A local project-find-function in a version control buffer for viewing a branch log; if the branch is not currently checked out, prompt to check out that branch (or create a worktree for it) before returning the project - A local project-find-function in a buffer from a package for Git forges; if the buffer corresponds to a repository which is not currently cloned locally, prompt to clone the repository. These behaviors should of course be suppressed if maybe-prompt is nil, which is why it would be nice to be able to access maybe-prompt. Since adding a new argument to project-find-functions is hard, maybe we could do this by introducing a new dynamic variable project-find-functions-may-prompt which we let-bind? Like: diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index c7c07c3d34c..3975182b88d 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -242,8 +242,9 @@ project-current (setq pr (cons 'transient directory)))) pr)) -(defun project--find-in-directory (dir) - (run-hook-with-args-until-success 'project-find-functions dir)) +(defun project--find-in-directory (dir &optional maybe-prompt) + (let ((project-find-functions-may-prompt maybe-prompt)) + (run-hook-with-args-until-success 'project-find-functions dir))) (defvar project--within-roots-fallback nil) In GNU Emacs 29.2.50 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2024-02-28 built on igm-qws-u22796a Repository revision: 46e23709d37943a20faa735c97af520196a443e9 Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.9 (Green Obsidian) Configured using: 'configure 'CFLAGS=-O0 -g3' --with-gif=ifavailable --with-x-toolkit=lucid' Configured features: CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix