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

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

[elpa] master fd4fd36 011/348: ivy-hydra.el: Fix hydra self-install


From: Oleh Krehel
Subject: [elpa] master fd4fd36 011/348: ivy-hydra.el: Fix hydra self-install
Date: Sat, 8 Apr 2017 11:03:14 -0400 (EDT)

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

    ivy-hydra.el: Fix hydra self-install
    
    * Makefile: Add a target to test the self-install.
    
    Fixes #464
---
 Makefile     |  3 +++
 ivy-hydra.el | 34 +++++++++++++++++++---------------
 2 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index c362e30..009086f 100644
--- a/Makefile
+++ b/Makefile
@@ -12,5 +12,8 @@ test:
 compile:
        $(emacs) -batch --eval "(progn (add-to-list 'load-path 
default-directory) (mapc #'byte-compile-file '(\"ivy.el\" \"swiper.el\" 
\"counsel.el\")))"
 
+plain:
+       $(emacs) -Q $(LOAD) --eval "(progn (package-initialize) (ivy-mode))" -l 
ivy-hydra.el
+
 clean:
        rm -f *.elc
diff --git a/ivy-hydra.el b/ivy-hydra.el
index 44f8754..5be7fbc 100644
--- a/ivy-hydra.el
+++ b/ivy-hydra.el
@@ -26,23 +26,27 @@
 ;; shorter than usual, using mostly unprefixed keys.
 
 ;;; Code:
-(require 'hydra nil t)
 (require 'ivy)
 
-(eval-when-compile
-  (unless (or (featurep 'hydra) (package-installed-p 'hydra))
-    (defmacro defhydra (name &rest _)
-      "This is a stub for the uninstalled `hydra' package."
-      `(defun ,(intern (format "%S/body" name)) ()
-         (interactive)
-         (let ((enable-recursive-minibuffers t))
-           (if (yes-or-no-p "Package `hydra' not installed. Install?")
-               (progn
-                 (package-install 'hydra)
-                 (save-window-excursion
-                   (find-library "ivy-hydra")
-                   (byte-compile-file (buffer-file-name) t)))
-             (error "Please install `hydra' and recompile/reinstall 
`ivy-hydra'")))))))
+(unless (require 'hydra nil t)
+  (defmacro defhydra (name &rest _)
+    "This is a stub for the uninstalled `hydra' package."
+    `(defun ,(intern (format "%S/body" name)) ()
+       (interactive)
+       (let ((enable-recursive-minibuffers t))
+         (if (yes-or-no-p "Package `hydra' not installed. Install?")
+             (progn
+               (ignore-errors (package-install 'hydra))
+               (save-window-excursion
+                 (let* ((buffer (condition-case nil
+                                    (find-library "ivy-hydra")
+                                  (error (find-file
+                                          ,(expand-file-name 
"ivy-hydra.el")))))
+                        (bname (buffer-file-name buffer)))
+                   (require 'hydra)
+                   (byte-compile-file bname t)
+                   (load-file bname))))
+           (error "Please install `hydra' and recompile/reinstall 
`ivy-hydra'"))))))
 
 (defun ivy--matcher-desc ()
   (if (eq ivy--regex-function



reply via email to

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