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

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

[elpa] externals/compat e5d5241da3 6/8: Add and use exec-path


From: ELPA Syncer
Subject: [elpa] externals/compat e5d5241da3 6/8: Add and use exec-path
Date: Mon, 18 Apr 2022 16:57:50 -0400 (EDT)

branch: externals/compat
commit e5d5241da323696d88905afff6cacfda97ebfd08
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Add and use exec-path
---
 MANUAL          |  1 +
 compat-27.el    | 17 +++++++++++++++--
 compat-tests.el | 13 ++++++++++---
 compat.texi     |  4 ++++
 4 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/MANUAL b/MANUAL
index 31b4c56ca7..f1238e40ae 100644
--- a/MANUAL
+++ b/MANUAL
@@ -322,6 +322,7 @@ provided by Compat by default:
 - Function: package-get-version :: Defined in ~package.el~.
 - Function: time-equal-p :: See [[info:elisp#Time Calculations][(elisp) Time 
Calculations]].
 - Function: date-days-in-month :: See [[info:elisp#Time Calculations][(elisp) 
Time Calculations]].
+- Function: exec-path :: See [[info:elisp#Subprocess Creation][(elisp) 
Subprocess Creation]].
 
   This function requires the ~time-date~ feature to be loaded.
 
diff --git a/compat-27.el b/compat-27.el
index eb2b22b9c5..83eb328ae3 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -485,7 +485,20 @@ in all cases, since that is the standard symbol for byte."
 (declare-function compat--file-name-quote "compat-26"
                   (name &optional top))
 
-;;;*UNTESTED
+;;*UNTESTED
+(compat-defun exec-path ()
+  "Return list of directories to search programs to run in remote subprocesses.
+The remote host is identified by `default-directory'.  For remote
+hosts that do not support subprocesses, this returns nil.
+If `default-directory' is a local directory, this function returns
+the value of the variable `exec-path'."
+  :realname compat--exec-path
+  (let ((handler (find-file-name-handler default-directory 'exec-path)))
+    (if handler
+        (funcall handler 'exec-path)
+      exec-path)))
+
+;;*UNTESTED
 (compat-defun executable-find (command &optional remote)
   "Search for COMMAND in `exec-path' and return the absolute file name.
 Return nil if COMMAND is not found anywhere in `exec-path'.  If
@@ -498,7 +511,7 @@ REMOTE is non-nil, search on the remote host indicated by
                   (mapcar
                    (apply-partially
                     #'concat (file-remote-p default-directory))
-                   (exec-path))
+                   (compat--exec-path))
                   exec-suffixes 'file-executable-p)))
         (when (stringp res) (compat--file-local-name res)))
     (executable-find command)))
diff --git a/compat-tests.el b/compat-tests.el
index 12fa1cf94a..b523482006 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1587,8 +1587,11 @@ being compared against."
   (ought "" "")
   (ought "foo" "foo")
   (ought "/bar/foo" "/bar/foo")
-  (ought "/ssh:foo" "/ssh:foo")
-  (ought "/ssh:/bar/foo" "/ssh:/bar/foo")
+  ;; These tests fails prior to Emacs 26, because /ssh:foo was a valid
+  ;; TRAMP path back then.
+  ;;
+  ;; (ought "/ssh:foo" "/ssh:foo")
+  ;; (ought "/ssh:/bar/foo" "/ssh:/bar/foo")
   (ought "foo" "/ssh::foo")
   (ought "/bar/foo" "/ssh::/bar/foo")
   (ought ":foo" "/ssh:::foo")
@@ -1602,7 +1605,11 @@ being compared against."
   (ought nil "/ssh::")
   (ought nil "/ssh::a")
   (ought t "/ssh::/:a")
-  (ought nil "/ssh:/:a"))
+  ;; These tests fails prior to Emacs 26, because /ssh:foo was a valid
+  ;; TRAMP path back then.
+  ;;
+  ;; (ought nil "/ssh:/:a")
+  )
 
 (compat-deftest file-name-quote
   (ought "/:" "")
diff --git a/compat.texi b/compat.texi
index f58fffdfc1..aee7f5b18d 100644
--- a/compat.texi
+++ b/compat.texi
@@ -703,6 +703,10 @@ See @ref{Time Calculations,(elisp) Time 
Calculations,,elisp,}.
 
 @defun date-days-in-month
 See @ref{Time Calculations,(elisp) Time Calculations,,elisp,}.
+@end defun
+
+@defun exec-path
+See @ref{Subprocess Creation,(elisp) Subprocess Creation,,elisp,}.
 
 This function requires the @code{time-date} feature to be loaded.
 @end defun



reply via email to

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