[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra d18ec97 338/395: counsel.el (compile-command)
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra d18ec97 338/395: counsel.el (compile-command): better handle our metadata |
Date: |
Thu, 25 Feb 2021 08:32:33 -0500 (EST) |
branch: externals/ivy-hydra
commit d18ec97cbdceacda84c30ba7cbda39d594cd79bd
Author: Alex Bennée <alex.bennee@linaro.org>
Commit: Alex Bennée <alex.bennee@linaro.org>
counsel.el (compile-command): better handle our metadata
Editing compile commands (for example to add env variables) is a bit
fiddly, especially for one offs. Override the default ivy behaviour
for M-i with a counsel-compile aware version of ivy-insert-current
that knows how to handle the metadata in the properties.
---
counsel.el | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index 0b23abc..687de60 100644
--- a/counsel.el
+++ b/counsel.el
@@ -6502,9 +6502,35 @@ specified by the `blddir' property."
(compile cmd)
(remove-hook 'compilation-start-hook
#'counsel-compile--update-history))))))
+(defun counsel-compile-edit-command ()
+ "Insert current compile command into mini-buffer for editing.
+
+This mirrors the behaviour of `ivy-insert-current' but with specific
+handling for the counsel-compile metadata."
+ (interactive)
+ (delete-minibuffer-contents)
+ (let* ((cmd (ivy-state-current ivy-last))
+ (blddir (get-text-property 0 'blddir cmd)))
+ (when blddir
+ (setq counsel-compile--current-build-dir blddir))
+ (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))))
+
+;; Currently the only thing we do is override ivy's default insert
+;; operation which doesn't include the metadata we want.
+(defvar counsel-compile-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "M-i") #'counsel-compile-edit-command)
+ map)
+ "Additional ivy keybindings during command selection")
+
;;;###autoload
(defun counsel-compile (&optional dir)
- "Call `compile' completing with smart suggestions, optionally for DIR."
+ "Call `compile' completing with smart suggestions, optionally for DIR.
+
+Additional actions:\\<ivy-minibuffer-map>"
(interactive)
(setq counsel-compile--current-build-dir (or dir
(counsel--compile-root)
@@ -6512,6 +6538,7 @@ specified by the `blddir' property."
(ivy-read "Compile command: "
(delete-dups (counsel--get-compile-candidates dir))
:action #'counsel-compile--action
+ :keymap counsel-compile-map
:caller 'counsel-compile))
(ivy-add-actions
- [elpa] externals/ivy-hydra 1723799 368/395: Fix M-o 'Wrong type argument: characterp' error, (continued)
- [elpa] externals/ivy-hydra 1723799 368/395: Fix M-o 'Wrong type argument: characterp' error, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra fc2801f 367/395: `counsel-find-file': open file in foreground, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ae9b121 366/395: Avoid face blending errors when loading swiper.el, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 796220b 357/395: ivy.el (ivy-alt-done): Extend to programmed completion, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 911a360 365/395: Consistently use modern face spec syntax, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 74f411d 355/395: Remove Emacs 28 workaround in counsel-descbinds, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 778d8bf 363/395: * counsel.el (counsel-org-files): Simplify regexp., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ab36ccb 364/395: * counsel.el (counsel-org-files): Fix regexp., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b65e401 351/395: counsel.el (counsel-file-jump-from-find): Add and bind to "`", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c6b60d3 337/395: counsel.el (counsel-ag): Prompt for args on a double universal-argument, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d18ec97 338/395: counsel.el (compile-command): better handle our metadata,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra d321048 358/395: ivy.el (ivy-add-prompt-count): Simplify, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 96b433d 369/395: Handle Windows directory separator in ivy-occur, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra e43141d 373/395: ivy.el: Make sure swiper-isearch works with "M-r", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b7cb680 375/395: Remove unnecessary variable declarations, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra cbce9ce 380/395: * ivy.el (ivy-rotate-sort): Also look up t., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 25439e2 381/395: Don't modify user options without ivy-configure, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8f2abd3 379/395: Switch between counsel-file-jump/counsel-find-file, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8fb825d 382/395: Fix counsel-read-setq-expression, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0965e23 386/395: Mention ignore alongside ivy-on-del-error-function, Basil L. Contovounesios, 2021/02/25