discussion and development of piem
 help / color / mirror / code / Atom feed
* [PATCH] Support reading directory using project.el
@ 2021-02-01 20:47 Xinglu Chen
  2021-02-02  2:59 ` Kyle Meyer
  2021-02-02 23:45 ` Kyle Meyer
  0 siblings, 2 replies; 3+ messages in thread
From: Xinglu Chen @ 2021-02-01 20:47 UTC (permalink / raw)
  To: piem

Since Emacs 28, project.el is built-in package that offers similar
functionality to projectile. It is also available on GNU ELPA.

* piem.el (piem-inbox-coderepo-maybe-read): Add support for reading
  directory using project.el.

---
 piem.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/piem.el b/piem.el
index 7b198d1..f6458f9 100644
--- a/piem.el
+++ b/piem.el
@@ -372,6 +372,9 @@ (defun piem-inbox-coderepo-maybe-read ()
                     (when-let ((current (and (fboundp 'projectile-project-root)
                                              (projectile-project-root))))
                       (abbreviate-file-name current)))))
+             (and (bound-and-true-p project--list)
+                  (expand-file-name
+                   (project-prompt-project-dir)))
              (and piem-use-magit
                   (fboundp 'magit-read-repository)
                   (magit-read-repository))

base-commit: 656625e1f9628673c285e3357329aaa6f6e48843
-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Support reading directory using project.el
  2021-02-01 20:47 [PATCH] Support reading directory using project.el Xinglu Chen
@ 2021-02-02  2:59 ` Kyle Meyer
  2021-02-02 23:45 ` Kyle Meyer
  1 sibling, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2021-02-02  2:59 UTC (permalink / raw)
  To: Xinglu Chen; +Cc: piem

Thanks for the patch.  I started using projectile before project.el
existed and haven't had any motivation to explore project.el or other
options, so this is very much appreciated.

Xinglu Chen writes:

> Since Emacs 28, project.el is built-in package that offers similar
> functionality to projectile. It is also available on GNU ELPA.

Hmm, project.el has existed longer than that, I think.
lisp/progmodes/project.el has been in the Emacs repo since 2015 and was
part of the Emacs 25 release.  However, if I recall correctly, it's a
bit of a moving target in terms of variable/function names.

> * piem.el (piem-inbox-coderepo-maybe-read): Add support for reading
>   directory using project.el.

Sorry, no changelog entries allowed in this code base :)  You could map
the gist of that onto the subject, though.  Something like

   piem-inbox-coderepo-maybe-read: Support project.el

> diff --git a/piem.el b/piem.el
> index 7b198d1..f6458f9 100644
> --- a/piem.el
> +++ b/piem.el
> @@ -372,6 +372,9 @@ (defun piem-inbox-coderepo-maybe-read ()
>                      (when-let ((current (and (fboundp 'projectile-project-root)
>                                               (projectile-project-root))))
>                        (abbreviate-file-name current)))))
> +             (and (bound-and-true-p project--list)
> +                  (expand-file-name
> +                   (project-prompt-project-dir)))

I'd prefer to avoid inspecting a -- symbol if possible.  Maybe a good
indicator that project.el should be used is if project-list-file is
bound and the file it points to exists.

Also, `make compile' gives the following warning:

  piem.el:788:1:Warning: the function ‘project-prompt-project-dir’ is not known
      to be defined.

You can squelch that with

  (fboundp 'project-prompt-project-dir)

Both project-prompt-project-dir and project-list-file won't be available
until the Emacs 28 release, but, as you mention, project.el is on ELPA
too, so I think it's fine to be forward-looking here.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Support reading directory using project.el
  2021-02-01 20:47 [PATCH] Support reading directory using project.el Xinglu Chen
  2021-02-02  2:59 ` Kyle Meyer
@ 2021-02-02 23:45 ` Kyle Meyer
  1 sibling, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2021-02-02 23:45 UTC (permalink / raw)
  To: piem

For posterity: the follow-up patch is at
<8ce1733ac0d0f63622d9060015949f31ce83d6ee.1612294275.git.public@yoctocell.xyz>.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-02 23:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 20:47 [PATCH] Support reading directory using project.el Xinglu Chen
2021-02-02  2:59 ` Kyle Meyer
2021-02-02 23:45 ` Kyle Meyer

discussion and development of piem

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.kyleam.com/piem/0 piem/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 piem piem/ https://inbox.kyleam.com/piem \
		piem@inbox.kyleam.com
	public-inbox-index piem

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.piem


code repositories for project(s) associated with this inbox:

	https://git.kyleam.com/piem/

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git