emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 3954bfe 081/399: counsel.el (counsel-compile): Don't modif


From: Oleh Krehel
Subject: [elpa] master 3954bfe 081/399: counsel.el (counsel-compile): Don't modify compilation-start-hook permanently
Date: Sat, 20 Jul 2019 14:56:53 -0400 (EDT)

branch: master
commit 3954bfed72908998a472e5c8ebe8c0739f89a3f9
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-compile): Don't modify compilation-start-hook 
permanently
---
 counsel.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/counsel.el b/counsel.el
index 5ff3fcf..55bebb3 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5120,9 +5120,9 @@ This variable is suitable for addition to
 `savehist-additional-variables'.")
 
 (defvar counsel-compile-root-functions
-  (list #'counsel--project-current
+  (list 'counsel--project-current
         (apply-partially #'counsel--dominating-file "configure")
-        #'counsel--git-root
+        'counsel--git-root
         (apply-partially #'counsel--dominating-file dir-locals-file))
   "Special hook to find the project root for compile commands.
 Each function on this hook is called in turn with no arguments
@@ -5293,14 +5293,16 @@ specified by the `blddir' property."
         (setq cmd (substring-no-properties
                    cmd 0 (next-single-property-change 0 'cmd cmd))))
       (let ((default-directory blddir))
-        (compile cmd)))))
+        ;; No need to specify `:history' because of this hook.
+        (add-hook 'compilation-start-hook #'counsel-compile--update-history)
+        (unwind-protect
+             (compile cmd)
+          (remove-hook 'compilation-start-hook 
#'counsel-compile--update-history))))))
 
 ;;;###autoload
 (defun counsel-compile (&optional dir)
   "Call `compile' completing with smart suggestions, optionally for DIR."
   (interactive)
-  ;; No need to specify `:history' because of this hook.
-  (add-hook 'compilation-start-hook #'counsel-compile--update-history)
   (ivy-read "Compile command: "
             (counsel--get-compile-candidates dir)
             :action #'counsel-compile--action



reply via email to

[Prev in Thread] Current Thread [Next in Thread]