[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra accc0fe 339/395: counsel.el (counsel-compile-
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra accc0fe 339/395: counsel.el (counsel-compile--probe-make-targets): fail more gracefully |
Date: |
Thu, 25 Feb 2021 08:32:33 -0500 (EST) |
branch: externals/ivy-hydra
commit accc0fefe2c5a1dad092aa88a84128b0c5d0dfe7
Author: Alex Bennée <alex.bennee@linaro.org>
Commit: Alex Bennée <alex.bennee@linaro.org>
counsel.el (counsel-compile--probe-make-targets): fail more gracefully
Actually handing a empty list back isn't especially helpful because
you might still get away with just calling make with the default
target. Importantly without having a list you can't construct a
command line of any sort with the build environment.
While here better handle a potential failure from call-process
returning a non-numeric code.
---
counsel.el | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/counsel.el b/counsel.el
index 687de60..fb5a06c 100644
--- a/counsel.el
+++ b/counsel.el
@@ -6326,26 +6326,26 @@ list is passed to `compilation-environment'."
(defvar counsel-compile-phony-pattern "^\\.PHONY:[\t ]+\\(.+\\)$"
"Regexp for extracting phony targets from Makefiles.")
-;; This is loosely based on the Bash Make completion code
+;; This is loosely based on the Bash Make completion code which
+;; relies on GNUMake having the following return codes:
+;; 0 = no-rebuild, -q & 1 needs rebuild, 2 error
(defun counsel-compile--probe-make-targets (dir)
"Return a list of Make targets for DIR.
-Return an empty list is Make exits with an error. This might
-happen because some sort of configuration needs to be done first
-or the source tree is pristine and being used for multiple build
-trees."
- (let ((default-directory dir)
- (targets nil))
- (with-temp-buffer
- ;; 0 = no-rebuild, -q & 1 needs rebuild, 2 error (for GNUMake at
- ;; least)
- (when (< (call-process "make" nil t nil "-nqp") 2)
+Return a single blank target (so we invoke the default target)
+if Make exits with an error. This might happen because some sort
+of configuration needs to be done first or the source tree is
+pristine and being used for multiple build trees."
+ (with-temp-buffer
+ (let* ((default-directory dir)
+ (res (call-process "make" nil t nil "-nqp"))
+ targets)
+ (if (or (not (numberp res)) (> res 1))
+ (list "")
(goto-char (point-min))
(while (re-search-forward counsel-compile-phony-pattern nil t)
- (setq targets
- (nconc targets (split-string
- (match-string-no-properties 1)))))))
- (sort targets #'string-lessp)))
+ (push (split-string (match-string-no-properties 1)) targets))
+ (sort (apply #'nconc targets) #'string-lessp)))))
(defun counsel-compile--pretty-propertize (leader text face)
"Return a pretty string of the form \" LEADER TEXT\".
@@ -6516,7 +6516,7 @@ handling for the counsel-compile metadata."
(if (get-char-property 0 'cmd cmd)
(insert (substring-no-properties
cmd 0 (next-single-property-change 0 'cmd cmd)))
- (substring-no-properties last 0 end))))
+ (insert (substring-no-properties cmd)))))
;; Currently the only thing we do is override ivy's default insert
;; operation which doesn't include the metadata we want.
- [elpa] externals/ivy-hydra 05d892d 282/395: counsel-grep/ag/rg/pt: use subprocess instead of shell command, (continued)
- [elpa] externals/ivy-hydra 05d892d 282/395: counsel-grep/ag/rg/pt: use subprocess instead of shell command, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b173441 326/395: Fix for ivy-immediate-done with counsel-M-x, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d539306 307/395: Revert "ivy.el (ivy-display-style): Remove", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1095e42 298/395: ivy.el (ivy-alt-done-functions-alist): Add, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7774867 335/395: Guard against null Org heading, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7b9391f 320/395: ivy-avy.el: Fix typo, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6bfada5 359/395: ivy.el: Use ivy--completing-fname-p more, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7e4c567 350/395: Makefile: Make plain.el load counsel instead of here, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5db2513 341/395: Recognize remote executables in Emacs >= 27.1., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 92c91ca 342/395: counsel.el (counsel-org-capture): Display descriptions from prefix keys, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra accc0fe 339/395: counsel.el (counsel-compile--probe-make-targets): fail more gracefully,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 215bb22 348/395: ivy.el (ivy-configure): Only change a value if it was not modified by the user, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4894b65 329/395: ivy-avy.el: Don't overwrite existing ivy-minibuffer-map binding, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8783d92 321/395: ivy.el: Remove most minibuffer-only commands from the counsel-M-x list, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 40634b7 349/395: ivy.el (ivy--alist-set): Don't touch values set by customize, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 721a3b7 371/395: Make ivy-mode more careful when setting globals, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5de2662 372/395: counsel.el (counsel-linux-app): Clean up env part of the cmd, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d2891aa 376/395: Percent-encode counsel-search query, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f90c018 389/395: counsel.el (counsel-grep-like-occur): Use ivy-text as backup, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3c53de1 390/395: * .elpaignore: New file., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 496a5e2 105/395: counsel.el: Fix ivy-occur ivy--regex-function bug, Basil L. Contovounesios, 2021/02/25