From: Spencer Baugh <sbaugh@janestreet.com>
To: 69584@debbugs.gnu.org
Subject: bug#69584: 29.2.50; project-find-functions should have access to maybe-prompt
Date: Wed, 06 Mar 2024 09:23:24 -0500 [thread overview]
Message-ID: <iero7brxwv7.fsf@janestreet.com> (raw)
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
next reply other threads:[~2024-03-06 14:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 14:23 Spencer Baugh [this message]
2024-03-15 1:41 ` bug#69584: 29.2.50; project-find-functions should have access to maybe-prompt Dmitry Gutov
2024-03-16 13:31 ` sbaugh
2024-03-18 21:59 ` Dmitry Gutov
2024-03-22 13:05 ` Spencer Baugh
2024-03-28 3:44 ` Dmitry Gutov
2024-04-04 14:29 ` Spencer Baugh
2024-04-05 0:33 ` Dmitry Gutov
2024-04-02 17:54 ` Spencer Baugh
2024-04-02 23:10 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=iero7brxwv7.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=69584@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).