mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-27 08:43:40 -07:00
Make Tramp backward compatible
* lisp/net/tramp-cmds.el (tramp-change-syntax): Set tramp-autoload cookie. * lisp/net/tramp-compat.el: Run `tramp-change-syntax' at startup, if necessary. * lisp/net/tramp.el (tramp-syntax): Use `tramp-compat-user-error'. (tramp-register-autoload-file-name-handlers): Do not mark `operations' for `tramp-file-name-handler'. (tramp-register-file-name-handlers): Remove also `tramp-autoload-file-name-handler' for backward compatibility. (tramp-register-foreign-file-name-handler): Use `delete-dups'. * test/lisp/net/tramp-tests.el (tramp-change-syntax): Declare.
This commit is contained in:
parent
e5c71dcaf7
commit
afd8c762b7
4 changed files with 13 additions and 7 deletions
|
|
@ -37,7 +37,7 @@
|
|||
(defvar reporter-eval-buffer)
|
||||
(defvar reporter-prompt-for-summary-p)
|
||||
|
||||
;;;###autoload
|
||||
;;;###tramp-autoload
|
||||
(defun tramp-change-syntax (&optional syntax)
|
||||
"Change Tramp syntax.
|
||||
SYNTAX can be one of the symbols `default' (default),
|
||||
|
|
|
|||
|
|
@ -384,6 +384,12 @@ If NAME is a remote file name, the local part of NAME is unquoted."
|
|||
((eq tramp-syntax 'sep) 'separate)
|
||||
(t tramp-syntax)))
|
||||
|
||||
;; Older Emacsen keep incompatible autoloaded values of `tramp-syntax'.
|
||||
(eval-after-load 'tramp
|
||||
'(unless
|
||||
(memq tramp-syntax (tramp-compat-funcall (quote tramp-syntax-values)))
|
||||
(tramp-change-syntax (tramp-compat-tramp-syntax))))
|
||||
|
||||
(provide 'tramp-compat)
|
||||
|
||||
;;; TODO:
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ Do not change the value by `setq', it must be changed only by
|
|||
:set (lambda (symbol value)
|
||||
;; Check allowed values.
|
||||
(unless (memq value (tramp-syntax-values))
|
||||
(user-error "Wrong `tramp-syntax' %s" tramp-syntax))
|
||||
(tramp-compat-user-error "Wrong `tramp-syntax' %s" tramp-syntax))
|
||||
;; Cleanup existing buffers.
|
||||
(unless (eq (symbol-value symbol) value)
|
||||
(tramp-cleanup-all-buffers))
|
||||
|
|
@ -2196,9 +2196,6 @@ Falls back to normal file name handler if no Tramp file name handler exists."
|
|||
(add-to-list 'file-name-handler-alist
|
||||
(cons tramp-initial-file-name-regexp 'tramp-file-name-handler))
|
||||
(put 'tramp-file-name-handler 'safe-magic t)
|
||||
;; Mark `operations' the handler is responsible for. It's a short list ...
|
||||
(put 'tramp-file-name-handler 'operations
|
||||
'(file-name-all-completions file-name-completion file-remote-p))
|
||||
|
||||
(add-to-list 'file-name-handler-alist
|
||||
(cons tramp-initial-completion-file-name-regexp
|
||||
|
|
@ -2216,7 +2213,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
|
|||
;; Remove autoloaded handlers from file name handler alist. Useful,
|
||||
;; if `tramp-syntax' has been changed.
|
||||
(dolist (fnh '(tramp-file-name-handler
|
||||
tramp-completion-file-name-handler))
|
||||
tramp-completion-file-name-handler
|
||||
;; This is autoloaded in Emacs 24 & 25.
|
||||
tramp-autoload-file-name-handler))
|
||||
(let ((a1 (rassq fnh file-name-handler-alist)))
|
||||
(setq file-name-handler-alist (delq a1 file-name-handler-alist))))
|
||||
|
||||
|
|
@ -2256,7 +2255,7 @@ Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'."
|
|||
;; Mark `operations' the handler is responsible for.
|
||||
(put 'tramp-file-name-handler
|
||||
'operations
|
||||
(cl-delete-duplicates
|
||||
(delete-dups
|
||||
(append
|
||||
(get 'tramp-file-name-handler 'operations)
|
||||
(mapcar
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
(require 'vc-git)
|
||||
(require 'vc-hg)
|
||||
|
||||
(declare-function tramp-change-syntax "tramp-cmds")
|
||||
(declare-function tramp-find-executable "tramp-sh")
|
||||
(declare-function tramp-get-remote-path "tramp-sh")
|
||||
(declare-function tramp-get-remote-stat "tramp-sh")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue