;; `file-name-quoted-p', `file-name-quote' and `file-name-unquote' are
;; introduced in Emacs 26.
-(if (fboundp 'file-name-quoted-p)
- (defalias 'tramp-compat-file-name-quoted-p 'file-name-quoted-p)
- (defsubst tramp-compat-file-name-quoted-p (name)
- "Whether NAME is quoted with prefix \"/:\".
+(eval-and-compile
+ (if (fboundp 'file-name-quoted-p)
+ (defalias 'tramp-compat-file-name-quoted-p 'file-name-quoted-p)
+ (defsubst tramp-compat-file-name-quoted-p (name)
+ "Whether NAME is quoted with prefix \"/:\".
If NAME is a remote file name, check the local part of NAME."
- (string-match "^/:" (or (file-remote-p name 'localname) name))))
+ (string-match "^/:" (or (file-remote-p name 'localname) name))))
-(if (fboundp 'file-name-quote)
- (defalias 'tramp-compat-file-name-quote 'file-name-quote)
- (defsubst tramp-compat-file-name-quote (name)
- "Add the quotation prefix \"/:\" to file NAME.
+ (if (fboundp 'file-name-quote)
+ (defalias 'tramp-compat-file-name-quote 'file-name-quote)
+ (defsubst tramp-compat-file-name-quote (name)
+ "Add the quotation prefix \"/:\" to file NAME.
If NAME is a remote file name, the local part of NAME is quoted."
- (concat
- (file-remote-p name) "/:" (or (file-remote-p name 'localname) name))))
+ (concat
+ (file-remote-p name) "/:" (or (file-remote-p name 'localname) name))))
-(if (fboundp 'file-name-unquote)
- (defalias 'tramp-compat-file-name-unquote 'file-name-unquote)
- (defsubst tramp-compat-file-name-unquote (name)
- "Remove quotation prefix \"/:\" from file NAME.
+ (if (fboundp 'file-name-unquote)
+ (defalias 'tramp-compat-file-name-unquote 'file-name-unquote)
+ (defsubst tramp-compat-file-name-unquote (name)
+ "Remove quotation prefix \"/:\" from file NAME.
If NAME is a remote file name, the local part of NAME is unquoted."
- (save-match-data
- (let ((localname (or (file-remote-p name 'localname) name)))
- (when (tramp-compat-file-name-quoted-p localname)
- (setq
- localname
- (replace-match
- (if (= (length localname) 2) "/" "") nil t localname)))
- (concat (file-remote-p name) localname)))))
+ (save-match-data
+ (let ((localname (or (file-remote-p name 'localname) name)))
+ (when (tramp-compat-file-name-quoted-p localname)
+ (setq
+ localname
+ (replace-match
+ (if (= (length localname) 2) "/" "") nil t localname)))
+ (concat (file-remote-p name) localname))))))
(provide 'tramp-compat)
(eval-after-load "esh-util"
'(progn
- (add-hook 'eshell-first-time-mode-hook
+ (add-hook 'eshell-mode-hook
'tramp-eshell-directory-change)
(add-hook 'eshell-directory-change-hook
'tramp-eshell-directory-change)
(add-hook 'tramp-unload-hook
(lambda ()
- (remove-hook 'eshell-first-time-mode-hook
+ (remove-hook 'eshell-mode-hook
'tramp-eshell-directory-change)
(remove-hook 'eshell-directory-change-hook
'tramp-eshell-directory-change)))))
;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
;; Keywords: comm, processes
;; Package: tramp
-;; Version: 2.3.1-pre
+;; Version: 2.3.1
;; This file is part of GNU Emacs.
;; should be changed only there.
;;;###tramp-autoload
-(defconst tramp-version "2.3.1-pre"
+(defconst tramp-version "2.3.1"
"This version of Tramp.")
;;;###tramp-autoload
;; Check for Emacs version.
(let ((x (if (>= emacs-major-version 23)
"ok"
- (format "Tramp 2.3.1-pre is not fit for %s"
+ (format "Tramp 2.3.1 is not fit for %s"
(when (string-match "^.*$" (emacs-version))
(match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))