discussion and development of piem
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: piem@inbox.kyleam.com
Subject: [PATCH] piem-inbox-coderepo-maybe-read: Include current projectile project
Date: Sun, 16 Aug 2020 12:54:31 -0400	[thread overview]
Message-ID: <20200816165431.18195-1-kyle@kyleam.com> (raw)

When piem-inbox-coderepo-maybe-read is called from within a project,
the current project isn't included in the collection because
projectile-relevant-known-projects excludes it when
projectile-current-project-on-switch is at its default value.  That's
undesirable in this context; if there's a current project, it's likely
the one of interest (e.g., calling piem-b4-am-ready-from-mbox from a
project's directory).

Add the current project to the collection and make it the default.
Also, don't bother going down the projectile branch if there are no
known projects.
---
 piem.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/piem.el b/piem.el
index 6a3c2b3..941b7d7 100644
--- a/piem.el
+++ b/piem.el
@@ -293,10 +293,13 @@ (defun piem-inbox-url ()
 (defun piem-inbox-coderepo-maybe-read ()
   "Like `piem-inbox-coderepo', but fall back to reading the repo."
   (or (piem-inbox-coderepo)
-      (and (fboundp 'projectile-relevant-known-projects)
+      (and (bound-and-true-p projectile-known-projects)
            (completing-read
             "Project: "
-            (projectile-relevant-known-projects)))
+            projectile-known-projects nil t nil nil
+            (when-let ((current (and (fboundp 'projectile-project-root)
+                                     (projectile-project-root))))
+              (abbreviate-file-name current))))
       (and piem-use-magit
            (fboundp 'magit-read-repository)
            (magit-read-repository))

base-commit: ff3b7724a75427c8d73a9b80f9ee5057250479cd
-- 
2.28.0


             reply	other threads:[~2020-08-16 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16 16:54 Kyle Meyer [this message]
2020-08-16 18:42 ` Kyle Meyer
2020-08-16 18:51   ` [PATCH v2 1/4] piem-inbox-coderepo-maybe-read: Reject invalid empty-string inbox Kyle Meyer
2020-08-16 18:51   ` [PATCH v2 2/4] piem-inbox-coderepo-maybe-read: Require projectile project match Kyle Meyer
2020-08-16 18:51   ` [PATCH v2 3/4] piem-inbox-coderepo-maybe-read: Include current projectile project Kyle Meyer
2020-08-16 18:51   ` [PATCH v2 4/4] piem-inbox-coderepo-maybe-read: Expand paths from projectile Kyle Meyer

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://git.kyleam.com/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200816165431.18195-1-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=piem@inbox.kyleam.com \
    --subject='Re: [PATCH] piem-inbox-coderepo-maybe-read: Include current projectile project' \
    /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

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

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

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).