* Re: master d879c40f68c: * etc/NEWS: Mention it.
[not found] ` <20240906161755.0CEECC2BC7A@vcs2.savannah.gnu.org>
@ 2024-09-09 8:42 ` Eshel Yaron
2024-09-09 11:40 ` Dmitry Gutov
0 siblings, 1 reply; 4+ messages in thread
From: Eshel Yaron @ 2024-09-09 8:42 UTC (permalink / raw)
To: emacs-devel; +Cc: Spencer Baugh, Dmitry Gutov
Hi,
Dmitry Gutov <dgutov@yandex.ru> writes:
> branch: master
> commit d879c40f68c078bdba15122e4e886a2052fbddf4
[...]
> +;;;###autoload
> +(defun project-find-file-in-root ()
> + "..."
> + (interactive)
> + (let* ((pr (project-current t))
> + (default-directory (project-root pr)))
> + (call-interactively #'find-file)))
Nice addition, thanks!
Nitpick: I find the use of call-interactively with a constant argument
slightly awkward. What do y'all think about a revision along the
following lines?
--8<---------------cut here---------------start------------->8---
;;;###autoload
(defun project-find-file-in-root (filename)
"Edit file FILENAME.
Interactively, prompt for FILENAME, defaulting to the root directory of
the current project."
(declare (interactive-only find-file))
(interactive
(list (read-file-name "Find project file: "
(project-root (project-current t)) nil
(confirm-nonexistent-file-or-buffer))))
(find-file filename t))
--8<---------------cut here---------------end--------------->8---
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: master d879c40f68c: * etc/NEWS: Mention it.
2024-09-09 8:42 ` master d879c40f68c: * etc/NEWS: Mention it Eshel Yaron
@ 2024-09-09 11:40 ` Dmitry Gutov
2024-09-09 16:03 ` Spencer Baugh
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2024-09-09 11:40 UTC (permalink / raw)
To: Eshel Yaron, emacs-devel; +Cc: Spencer Baugh
On 09/09/2024 11:42, Eshel Yaron wrote:
> Nitpick: I find the use of call-interactively with a constant argument
> slightly awkward. What do y'all think about a revision along the
> following lines?
Yeah, I think that works too (the only real duplication is the call to
confirm-nonexistent-file-or-buffer, that's minor).
> --8<---------------cut here---------------start------------->8---
> ;;;###autoload
> (defun project-find-file-in-root (filename)
> "Edit file FILENAME.
> Interactively, prompt for FILENAME, defaulting to the root directory of
> the current project."
> (declare (interactive-only find-file))
> (interactive
> (list (read-file-name "Find project file: "
Maybe "Find in root: "? The command variant doesn't necessarily show all
project files, or only project files.
> (project-root (project-current t)) nil
> (confirm-nonexistent-file-or-buffer))))
> (find-file filename t))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: master d879c40f68c: * etc/NEWS: Mention it.
2024-09-09 11:40 ` Dmitry Gutov
@ 2024-09-09 16:03 ` Spencer Baugh
2024-09-09 17:52 ` Eshel Yaron
0 siblings, 1 reply; 4+ messages in thread
From: Spencer Baugh @ 2024-09-09 16:03 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: Eshel Yaron, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1211 bytes --]
I'm fine with this change. "Find file in root: " seems like it would be a
decent prompt.
On Mon, Sep 9, 2024 at 7:40 AM Dmitry Gutov <dmitry@gutov.dev> wrote:
> On 09/09/2024 11:42, Eshel Yaron wrote:
> > Nitpick: I find the use of call-interactively with a constant argument
> > slightly awkward. What do y'all think about a revision along the
> > following lines?
>
> Yeah, I think that works too (the only real duplication is the call to
> confirm-nonexistent-file-or-buffer, that's minor).
>
> > --8<---------------cut here---------------start------------->8---
> > ;;;###autoload
> > (defun project-find-file-in-root (filename)
> > "Edit file FILENAME.
> > Interactively, prompt for FILENAME, defaulting to the root directory of
> > the current project."
> > (declare (interactive-only find-file))
> > (interactive
> > (list (read-file-name "Find project file: "
>
> Maybe "Find in root: "? The command variant doesn't necessarily show all
> project files, or only project files.
>
> > (project-root (project-current t)) nil
> > (confirm-nonexistent-file-or-buffer))))
> > (find-file filename t))
>
>
[-- Attachment #2: Type: text/html, Size: 1684 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: master d879c40f68c: * etc/NEWS: Mention it.
2024-09-09 16:03 ` Spencer Baugh
@ 2024-09-09 17:52 ` Eshel Yaron
0 siblings, 0 replies; 4+ messages in thread
From: Eshel Yaron @ 2024-09-09 17:52 UTC (permalink / raw)
To: Spencer Baugh; +Cc: Dmitry Gutov, emacs-devel
Spencer Baugh <sbaugh@janestreet.com> writes:
> I'm fine with this change. "Find file in root: " seems like it would be a decent prompt.
>
> On Mon, Sep 9, 2024 at 7:40 AM Dmitry Gutov <dmitry@gutov.dev> wrote:
>
> On 09/09/2024 11:42, Eshel Yaron wrote:
> > Nitpick: I find the use of call-interactively with a constant argument
> > slightly awkward. What do y'all think about a revision along the
> > following lines?
>
> Yeah, I think that works too (the only real duplication is the call to
> confirm-nonexistent-file-or-buffer, that's minor).
>
> > --8<---------------cut here---------------start------------->8---
> > ;;;###autoload
> > (defun project-find-file-in-root (filename)
> > "Edit file FILENAME.
> > Interactively, prompt for FILENAME, defaulting to the root directory of
> > the current project."
> > (declare (interactive-only find-file))
> > (interactive
> > (list (read-file-name "Find project file: "
>
> Maybe "Find in root: "? The command variant doesn't necessarily show all
> project files, or only project files.
>
> > (project-root (project-current t)) nil
> > (confirm-nonexistent-file-or-buffer))))
> > (find-file filename t))
Great, now done in 466db358772.
Thanks,
Eshel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-09 17:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <172563947472.4957.18260024928108489506@vcs2.savannah.gnu.org>
[not found] ` <20240906161755.0CEECC2BC7A@vcs2.savannah.gnu.org>
2024-09-09 8:42 ` master d879c40f68c: * etc/NEWS: Mention it Eshel Yaron
2024-09-09 11:40 ` Dmitry Gutov
2024-09-09 16:03 ` Spencer Baugh
2024-09-09 17:52 ` Eshel Yaron
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.