[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult d88e064: Add consult--project-name, fix prompt
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult d88e064: Add consult--project-name, fix prompt |
Date: |
Tue, 27 Jul 2021 06:57:07 -0400 (EDT) |
branch: externals/consult
commit d88e0649cb457b5d3c9f369dbcee07d3c0728cef
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add consult--project-name, fix prompt
Thanks for the report, @iyefrat!
---
consult-imenu.el | 2 +-
consult.el | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/consult-imenu.el b/consult-imenu.el
index 1b7138c..de53752 100644
--- a/consult-imenu.el
+++ b/consult-imenu.el
@@ -218,7 +218,7 @@ same major mode as the current buffer are used. See also
:sort 'alpha)))
(consult-imenu--select
(format "Go to item (Project %s): "
- (file-name-base (directory-file-name project)))
+ (consult--project-name project))
(consult-imenu--all-items buffers))
(consult-imenu)))
diff --git a/consult.el b/consult.el
index 1b56d9a..19129f1 100644
--- a/consult.el
+++ b/consult.el
@@ -718,8 +718,7 @@ Otherwise the `default-directory' is returned."
((stringp dir) (consult--directory-prompt-1 prompt dir))
(dir (consult--directory-prompt-1 prompt (read-directory-name "Directory: "
nil nil t)))
((when-let (root (consult--project-root))
- (cons (format "%s in project %s: " prompt
- (file-name-base (directory-file-name root)))
+ (cons (format "%s in project %s: " prompt (consult--project-name root))
root)))
(t (consult--directory-prompt-1 prompt default-directory))))
@@ -728,6 +727,12 @@ Otherwise the `default-directory' is returned."
(when-let (root (and consult-project-root-function (funcall
consult-project-root-function)))
(expand-file-name root)))
+(defun consult--project-name (dir)
+ "Return the project name for DIR."
+ (if (string-match "/\\([^/]+\\)/\\'" dir)
+ (match-string 1 dir)
+ dir))
+
(defun consult--format-location (file line &optional str)
"Format location string 'FILE:LINE:STR'."
(setq line (number-to-string line)
@@ -2672,8 +2677,7 @@ non-nil, all buffers are searched. Optional INITIAL input
can be provided. See
(consult--line
(consult--line-multi-candidates :sort 'alpha :directory project)
:prompt (if project
- (format "Go to line (Project %s): "
- (file-name-base (directory-file-name project)))
+ (format "Go to line (Project %s): " (consult--project-name
project))
"Go to line (All buffers): ")
:initial initial
:group #'consult--line-group)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/consult d88e064: Add consult--project-name, fix prompt,
ELPA Syncer <=