[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7e8a362 068/399: counsel.el (counsel--get-make-targets): C
From: |
Oleh Krehel |
Subject: |
[elpa] master 7e8a362 068/399: counsel.el (counsel--get-make-targets): Clean up |
Date: |
Sat, 20 Jul 2019 14:56:50 -0400 (EDT) |
branch: master
commit 7e8a3624fdce86e5b4951d2dc75bfd0cd48a7348
Author: Basil L. Contovounesios <address@hidden>
Commit: Basil L. Contovounesios <address@hidden>
counsel.el (counsel--get-make-targets): Clean up
Refill docstring. Reduce amount of string consing.
---
counsel.el | 53 +++++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 28 deletions(-)
diff --git a/counsel.el b/counsel.el
index 3cc7140..8d3c677 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5156,35 +5156,32 @@ You may for example want to add -jN for the number of
cores you have."
"Patterns for matching build directories."
:type 'list)
-;; This is loosely based on the bash make completion code
+;; This is loosely based on the Bash Make completion code
(defun counsel--get-make-targets (srcdir &optional blddir)
- "Return a list of make targets for a given SRCDIR/BLDDIR combination.
-
-We search the Makefile for a list of PHONY targets which are generally
-the top-level targets a make system provides. The resulting strings
-are tagged with properties that `counsel-compile-history' can use for
-filtering results."
- (let ((default-directory (or blddir srcdir)))
- (mapcar
- (lambda (target)
- (propertize
- (concat
- (propertize
- (format "make %s %s" counsel-compile-make-args target)
- 'cmd 't)
- (if blddir
- (concat (propertize " in " 'face 'font-lock-warning-face)
- (propertize blddir 'face 'dired-directory))))
- 'srcdir srcdir
- 'blddir default-directory))
- (split-string
- (shell-command-to-string
- (concat "make -nqp |"
- "grep -B 1 PHONY |"
- "grep ':' |"
- "cut -d ':' -f 1 |"
- "sort"))
- "\n"))))
+ "Return a list of Make targets for a given SRCDIR/BLDDIR combination.
+
+We search the Makefile for a list of phony targets which are
+generally the top-level targets a Make system provides.
+The resulting strings are tagged with properties that
+`counsel-compile-history' can use for filtering results."
+ (let* ((default-directory (or blddir srcdir))
+ (fmt (format (propertize "make %s %%s" 'cmd t)
+ counsel-compile-make-args))
+ (suffix (and blddir
+ (concat (propertize " in " 'face 'font-lock-warning-face)
+ (propertize blddir 'face 'dired-directory))))
+ (props `(srcdir ,srcdir blddir ,default-directory)))
+ (mapcar (lambda (target)
+ (setq target (concat (format fmt target) suffix))
+ (add-text-properties 0 (length target) props target)
+ target)
+ (split-string (shell-command-to-string "\
+make -nqp |\
+ grep -B 1 PHONY |\
+ grep ':' |\
+ cut -d ':' -f 1 |\
+ sort")
+ "\n"))))
(defun counsel-compile-get-make-invocation (&optional blddir)
"Have a look in the root directory for any build control files.
- [elpa] master 4e0d403 066/399: counsel.el (counsel--find-build-subdir): Simplify, (continued)
- [elpa] master 4e0d403 066/399: counsel.el (counsel--find-build-subdir): Simplify, Oleh Krehel, 2019/07/20
- [elpa] master 144e7d9 069/399: counsel.el: Clean up recent compile variables, Oleh Krehel, 2019/07/20
- [elpa] master 82e6c54 067/399: counsel.el: Clean up compile make invocation, Oleh Krehel, 2019/07/20
- [elpa] master bb58a29 071/399: counsel.el (counsel-ag): Fix error in non-Git directory, Oleh Krehel, 2019/07/20
- [elpa] master f0d93cf 073/399: counsel.el (counsel-compile): counsel-compile-get-filtered-history, Oleh Krehel, 2019/07/20
- [elpa] master ce0c39e 076/399: counsel.el (counsel--git-root): Rename, Oleh Krehel, 2019/07/20
- [elpa] master a37d4e3 072/399: counsel.el (counsel-compile): fix breakage to subdir recursion, Oleh Krehel, 2019/07/20
- [elpa] master 86c904f 077/399: counsel.el (counsel-compile-root-functions): Change priority, Oleh Krehel, 2019/07/20
- [elpa] master c2788de 082/399: counsel.el (counsel--switch-buffer-update-fn): if to cond, Oleh Krehel, 2019/07/20
- [elpa] master 1439e8d 064/399: counsel.el: Simplify compile build dir collection, Oleh Krehel, 2019/07/20
- [elpa] master 7e8a362 068/399: counsel.el (counsel--get-make-targets): Clean up,
Oleh Krehel <=
- [elpa] master d64b268 074/399: counsel.el (counsel-compile): counsel--get-build-subdirs, Oleh Krehel, 2019/07/20
- [elpa] master 6f0f32f 084/399: counsel.el (counsel-git-grep-count-function): Promote to defcustom, Oleh Krehel, 2019/07/20
- [elpa] master 25336fd 075/399: counsel.el (counsel-compile): counsel-compile-local-builds, Oleh Krehel, 2019/07/20
- [elpa] master db905cc 088/399: counsel.el (counsel-compile-phony-pattern): Use plain regex, Oleh Krehel, 2019/07/20
- [elpa] master 4e07e6f 048/399: ivy.el (ivy-make-magic-action): Add docstring to the generated lambda, Oleh Krehel, 2019/07/20
- [elpa] master 8a40934 062/399: counsel.el: Clean up compile candidates list, Oleh Krehel, 2019/07/20
- [elpa] master 0c30e3f 063/399: counsel.el: Minor compile history cleanup, Oleh Krehel, 2019/07/20
- [elpa] master 114ae96 070/399: counsel.el: Find project root more flexibly, Oleh Krehel, 2019/07/20
- [elpa] master 5aa263c 079/399: counsel.el (counsel-compile-make-pattern): Fix regex, Oleh Krehel, 2019/07/20
- [elpa] master cc50da2 080/399: counsel.el (counsel-dired-jump-args): Fix -type d, Oleh Krehel, 2019/07/20