summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-compat.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2020-12-01 13:37:03 +0100
committerMichael Albinus <michael.albinus@gmx.de>2020-12-01 13:37:03 +0100
commitba692b790da79cde98932295362a5de138991d47 (patch)
tree75cbbb9dc1deec32b85a3de475602895c21874b1 /lisp/net/tramp-compat.el
parent3d712d50d65a89d56bc937c5d001ac450c9c947f (diff)
downloademacs-ba692b790da79cde98932295362a5de138991d47.tar.gz
emacs-ba692b790da79cde98932295362a5de138991d47.tar.bz2
emacs-ba692b790da79cde98932295362a5de138991d47.zip
Allow Tramp to mirror traces to a file
* doc/misc/tramp.texi (Traces and Profiles): Add `tramp-debug-to-file'. * lisp/net/tramp-adb.el (tramp-adb-parse-device-names) (tramp-adb-get-device): * lisp/net/tramp-cmds.el (tramp-rename-files): * lisp/net/tramp-gvfs.el (tramp-gvfs-monitor-process-filter) (tramp-gvfs-handler-volumeadded-volumeremoved) (tramp-get-media-devices): * lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch) (tramp-sh-gio-monitor-process-filter) (tramp-sh-gvfs-monitor-dir-process-filter) (tramp-sh-inotifywait-process-filter, tramp-maybe-send-script) (tramp-find-inline-encoding): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl): Use `tramp-compat-string-replace'. * lisp/net/tramp-compat.el (tramp-compat-string-replace): New defalias. * lisp/net/tramp.el (tramp-debug-to-file): New defcustom. (tramp-get-debug-buffer): Simplify. (tramp-get-debug-file-name): New defun. (tramp-debug-message): Write debug file if indicated.
Diffstat (limited to 'lisp/net/tramp-compat.el')
-rw-r--r--lisp/net/tramp-compat.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 7fae9ba7e2f..b44eabcfa8b 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -341,6 +341,13 @@ A nil value for either argument stands for the current time."
(lambda ()
(if (tramp-tramp-file-p default-directory) "/dev/null" null-device))))
+;; Function `string-replace' is new in Emacs 28.1.
+(defalias 'tramp-compat-string-replace
+ (if (fboundp 'string-replace)
+ #'string-replace
+ (lambda (fromstring tostring instring)
+ (replace-regexp-in-string (regexp-quote fromstring) tostring instring))))
+
(add-hook 'tramp-unload-hook
(lambda ()
(unload-feature 'tramp-loaddefs 'force)