[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3d0887f 204/399: counsel.el (counsel-compile): Add counsel
From: |
Oleh Krehel |
Subject: |
[elpa] master 3d0887f 204/399: counsel.el (counsel-compile): Add counsel-compile-env |
Date: |
Sat, 20 Jul 2019 14:57:24 -0400 (EDT) |
branch: master
commit 3d0887f29fd91b30f19c81441693e8f67465f98c
Author: Alex Bennée <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-compile): Add counsel-compile-env
A lot of builds can be influenced by environment
variables. Compilation mode already has support for this by way of
compilation-environment. This adds support for passing that down from
counsel-compile. We will later add a counsel helper for manipulating
the state of counsel-compile-env.
---
counsel.el | 39 ++++++++++++++++++++++++++++++---------
1 file changed, 30 insertions(+), 9 deletions(-)
diff --git a/counsel.el b/counsel.el
index 967b030..3a6a991 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5185,6 +5185,8 @@ The properties include:
the root directory of the source code
`blddir'
the root directory of the build (in or outside the `srcdir')
+`bldenv'
+ the build environment as passed to `compilation-environment'
`recursive'
the completion should be run again in `blddir' of this result
`cmd'
@@ -5248,6 +5250,12 @@ You may, for example, want to add \"-jN\" for the number
of cores
N in your system."
:type 'string)
+(defcustom counsel-compile-env nil
+ "List of environment variables for compilation to inherit.
+Each element should be a string of the form ENVVARNAME=VALUE. This
+list is passed to `compilation-environment'."
+ :type '(repeat (string :tag "ENVVARNAME=VALUE")))
+
(defcustom counsel-compile-make-pattern "\\`\\(?:GNUm\\|[Mm]\\)akefile\\'"
"Regexp for matching the names of Makefiles."
:type 'regexp)
@@ -5300,11 +5308,16 @@ The resulting strings are tagged with properties that
(let ((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 ,blddir)))
+ (counsel-compile--pretty-propertize "in" blddir
+ 'dired-directory)))
+ (build-env (and counsel-compile-env
+ (counsel-compile--pretty-propertize
+ "with"
+ (mapconcat #'identity counsel-compile-env " ")
+ 'font-lock-variable-name-face)))
+ (props `(srcdir ,srcdir blddir ,blddir bldenv ,counsel-compile-env)))
(mapcar (lambda (target)
- (setq target (concat (format fmt target) suffix))
+ (setq target (concat (format fmt target) suffix build-env))
(add-text-properties 0 (length target) props target)
target)
(counsel-compile--probe-make-targets (or blddir srcdir)))))
@@ -5381,12 +5394,18 @@ This is determined by `counsel-compile-local-builds',
which see."
"Update `counsel-compile-history' from the compilation state."
(let* ((srcdir (counsel--compile-root))
(blddir default-directory)
+ (bldenv compilation-environment)
(cmd (concat
(propertize (car compilation-arguments) 'cmd t)
(unless (file-equal-p blddir srcdir)
- (concat (propertize " in " 'face 'font-lock-warning-face)
- (propertize blddir 'face 'dired-directory))))))
- (add-text-properties 0 (length cmd) `(srcdir ,srcdir blddir ,blddir) cmd)
+ (counsel-compile--pretty-propertize "in" blddir
+ 'dired-directory))
+ (when bldenv
+ (counsel-compile--pretty-propertize "with"
+ (mapconcat #'identity
bldenv " ")
+
'font-lock-variable-name-face)))))
+ (add-text-properties 0 (length cmd)
+ `(srcdir ,srcdir blddir ,blddir bldenv ,bldenv) cmd)
(add-to-history 'counsel-compile-history cmd)))
(defun counsel-compile--action (cmd)
@@ -5395,13 +5414,15 @@ This is determined by `counsel-compile-local-builds',
which see."
If CMD has the `recursive' property set we call `counsel-compile'
again to further refine the compile options in the directory
specified by the `blddir' property."
- (let ((blddir (get-text-property 0 'blddir cmd)))
+ (let ((blddir (get-text-property 0 'blddir cmd))
+ (bldenv (get-text-property 0 'bldenv cmd)))
(if (get-text-property 0 'recursive cmd)
(counsel-compile blddir)
(when (get-char-property 0 'cmd cmd)
(setq cmd (substring-no-properties
cmd 0 (next-single-property-change 0 'cmd cmd))))
- (let ((default-directory blddir))
+ (let ((default-directory blddir)
+ (compilation-environment bldenv))
;; No need to specify `:history' because of this hook.
(add-hook 'compilation-start-hook #'counsel-compile--update-history)
(unwind-protect
- [elpa] master 0467f5b 191/399: doc/ivy.org: Correct typo, (continued)
- [elpa] master 0467f5b 191/399: doc/ivy.org: Correct typo, Oleh Krehel, 2019/07/20
- [elpa] master e3f8908 186/399: ivy-test.el: Make friendlier, Oleh Krehel, 2019/07/20
- [elpa] master 891be1d 199/399: counsel.el (counsel-org-file): Handle ATTACH_DIR property, Oleh Krehel, 2019/07/20
- [elpa] master 4f12a59 196/399: counsel.el (counsel-find-file-mkdir-action): Add trailing "/", Oleh Krehel, 2019/07/20
- [elpa] master 62a2c7e 195/399: counsel.el (counsel-find-file): Improve copy and move actions, Oleh Krehel, 2019/07/20
- [elpa] master d8136a2 200/399: doc/ivy.org: Remove outdated magit customization, Oleh Krehel, 2019/07/20
- [elpa] master ca8d5ba 197/399: ivy.el (ivy-partial): Adjust ivy-tab-space when one candidate, Oleh Krehel, 2019/07/20
- [elpa] master f28e00c 194/399: counsel.el (counsel-find-file): Improve delete action with ivy-call, Oleh Krehel, 2019/07/20
- [elpa] master afeda97 198/399: counsel.el (counsel-company): Add :caller, Oleh Krehel, 2019/07/20
- [elpa] master 3b25d30 206/399: counsel.el (counsel-compile): Add predicate to counsel-compile-env, Oleh Krehel, 2019/07/20
- [elpa] master 3d0887f 204/399: counsel.el (counsel-compile): Add counsel-compile-env,
Oleh Krehel <=
- [elpa] master 605cee0 202/399: counsel.el (counsel-compile): Fix saving of blddir, Oleh Krehel, 2019/07/20
- [elpa] master c9f2318 203/399: counsel.el (counsel-compile): Add helper for formatting text, Oleh Krehel, 2019/07/20
- [elpa] master 276599c 201/399: doc/ivy.texi: Generate from doc/ivy.org, Oleh Krehel, 2019/07/20
- [elpa] master 3f27e25 207/399: counsel.el (counsel-compile): Don't squash default-directory, Oleh Krehel, 2019/07/20
- [elpa] master 6de6233 205/399: counsel.el (counsel-compile): New counsel-compile-env helper, Oleh Krehel, 2019/07/20
- [elpa] master f628eb3 210/399: swiper.el (swiper-isearch-symbol-at-point): Add, Oleh Krehel, 2019/07/20
- [elpa] master bed783e 217/399: ivy-test.el (swiper-isearch-case-fold): Add test, Oleh Krehel, 2019/07/20
- [elpa] master 4147453 212/399: swiper.el (swiper-isearch-thing-at-point): Add, Oleh Krehel, 2019/07/20
- [elpa] master 9a2b110 214/399: ivy.el (ivy-insert-current): Insert text without properties, Oleh Krehel, 2019/07/20
- [elpa] master f1b3fa4 209/399: swiper.el (swiper-isearch): Support swiper-goto-start-of-match, Oleh Krehel, 2019/07/20