summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-compat.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net/tramp-compat.el')
-rw-r--r--lisp/net/tramp-compat.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 1286255c898..bc32044451c 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -294,6 +294,15 @@ CONDITION can also be a list of error conditions."
(setq secret (funcall secret)))
secret))))
+;; Function `take' is new in Emacs 29.1.
+(defalias 'tramp-compat-take
+ (if (fboundp 'take)
+ #'take
+ (lambda (n list)
+ (when (and (natnump n) (> n 0))
+ (if (>= n (length list))
+ list (butlast list (- (length list) n)))))))
+
;; Function `ntake' is new in Emacs 29.1.
(defalias 'tramp-compat-ntake
(if (fboundp 'ntake)
@@ -303,6 +312,13 @@ CONDITION can also be a list of error conditions."
(if (>= n (length list))
list (nbutlast list (- (length list) n)))))))
+;; Function `string-equal-ignore-case' is new in Emacs 29.1.
+(defalias 'tramp-compat-string-equal-ignore-case
+ (if (fboundp 'string-equal-ignore-case)
+ #'string-equal-ignore-case
+ (lambda (string1 string2)
+ (eq t (compare-strings string1 nil nil string2 nil nil t)))))
+
(dolist (elt (all-completions "tramp-compat-" obarray 'functionp))
(put (intern elt) 'tramp-suppress-trace t))
@@ -319,6 +335,6 @@ CONDITION can also be a list of error conditions."
;; parentheses with a backslash in docstrings anymore.
;;
;; * Starting with Emacs 27.1, there's `make-empty-file'. Could be
-;; used instead of `write-region'.
+;; used instead of `(write-region "" ...)'.
;;; tramp-compat.el ends here