diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 261fbc1139d..be13afebeba 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -927,6 +927,7 @@ Customize. See also `tramp-change-syntax'." (const :tag "Ange-FTP" simplified) (const :tag "XEmacs" separate)) :require 'tramp + ;; Starting with Emacs 31.1, we can use `custom-initialize-after-file' instead. :initialize #'custom-initialize-default :set #'tramp-set-syntax :link '(info-link :tag "Tramp manual" "(tramp) Change file name syntax")) @@ -970,6 +971,7 @@ to be set, depending on VALUE." ;; Initialize the Tramp syntax variables. We want to override initial ;; value of `tramp-file-name-regexp'. We do not call ;; `custom-set-variable', this would load Tramp via custom.el. +;; Starting with Emacs 31.1, we can use `custom-initialize-after-file' instead. (tramp--with-startup (tramp-set-syntax 'tramp-syntax tramp-syntax)) @@ -2556,7 +2558,9 @@ packages like `tramp-sh' (except `tramp-ftp')." `(lambda (orig-fun &rest args) (if-let* ((handler (find-file-name-handler - (or (car args) default-directory) #',operation))) + (if (and (car args) (file-name-absolute-p (car args))) + (car args) default-directory) + #',operation))) (apply handler #',operation args) (apply orig-fun args))) `((name . ,(concat "tramp-advice-" (symbol-name operation))))))))