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

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

[elpa] externals/ivy-hydra dd43ab1 346/395: Add Emacs 27 executable-find


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra dd43ab1 346/395: Add Emacs 27 executable-find compatibility shim
Date: Thu, 25 Feb 2021 08:32:35 -0500 (EST)

branch: externals/ivy-hydra
commit dd43ab1217f72948dc5cd669467e33b8b568db44
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Add Emacs 27 executable-find compatibility shim
    
    * counsel.el (counsel--executable-find): New function wrapping 2-arg
    executable-find in Emacs 27.
    (counsel-require-program): Use it to move version check from runtime
    to load time, and pacify byte-compiler.
    
    Re: #2618.
---
 counsel.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index 6cfb652..8c8434e 100644
--- a/counsel.el
+++ b/counsel.el
@@ -114,6 +114,14 @@ complex regexes."
      str)
     str))
 
+(defalias 'counsel--executable-find
+  ;; Gained optional argument in 27.1.
+  (if (>= emacs-major-version 27)
+      #'executable-find
+    (lambda (command &optional _remote)
+      (executable-find command)))
+  "Compatibility shim for `executable-find'.")
+
 (defun counsel-require-program (cmd)
   "Check system for program used in CMD, printing error if not found.
 CMD is either a string or a list of strings.
@@ -124,9 +132,7 @@ To skip the `executable-find' check, start the string with 
a space."
                      (car (split-string cmd)))))
       (or (and (stringp program)
                (not (string= program ""))
-               (if (<= 27 emacs-major-version)
-                   (executable-find program t)
-                 (executable-find program)))
+               (counsel--executable-find program t))
           (user-error "Required program \"%s\" not found in your path" 
program)))))
 
 (declare-function eshell-split-path "esh-util")



reply via email to

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