diff options
| author | Michael Albinus | 2016-11-08 20:45:59 +0100 |
|---|---|---|
| committer | Michael Albinus | 2016-11-08 20:45:59 +0100 |
| commit | 39c0b8b6b189cef3cd7118ac7c213a09fa8be398 (patch) | |
| tree | 4623a2d5f6d7bcf0db95208b451f7709d4fe99a3 | |
| parent | 3b5e6774ed9743fb726ac8c15341eaa09375cfbf (diff) | |
| download | emacs-39c0b8b6b189cef3cd7118ac7c213a09fa8be398.tar.gz emacs-39c0b8b6b189cef3cd7118ac7c213a09fa8be398.zip | |
Fix Bug#24889
* lisp/net/tramp.el (tramp-file-name-regexp): Make it a
defvar. Fix docstring.
(tramp-completion-file-name-handler-alist): Fix docstring.
(tramp-register-file-name-handlers): Reassign
`tramp-file-name-regexp' to the car of
`tramp-file-name-structure'. (Bug#24889)
| -rw-r--r-- | lisp/net/tramp.el | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e03b614b3f4..8a81311508f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -867,24 +867,14 @@ On W32 systems, the volume letter must be ignored.") | |||
| 867 | See `tramp-file-name-structure' for more explanations.") | 867 | See `tramp-file-name-structure' for more explanations.") |
| 868 | 868 | ||
| 869 | ;;;###autoload | 869 | ;;;###autoload |
| 870 | (defconst tramp-file-name-regexp | 870 | (defvar tramp-file-name-regexp |
| 871 | (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified) | 871 | (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified) |
| 872 | ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate) | 872 | ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate) |
| 873 | (t (error "Wrong `tramp-syntax' defined"))) | 873 | (t (error "Wrong `tramp-syntax' defined"))) |
| 874 | "Regular expression matching file names handled by Tramp. | 874 | "Regular expression matching file names handled by Tramp. |
| 875 | This regexp should match Tramp file names but no other file names. | 875 | This regexp should match Tramp file names but no other file |
| 876 | When tramp.el is loaded, this regular expression is prepended to | 876 | names. When calling `tramp-register-file-name-handlers', the |
| 877 | `file-name-handler-alist', and that is searched sequentially. Thus, | 877 | initial value is overwritten by the car of `tramp-file-name-structure'.") |
| 878 | if the Tramp entry appears rather early in the `file-name-handler-alist' | ||
| 879 | and is a bit too general, then some files might be considered Tramp | ||
| 880 | files which are not really Tramp files. | ||
| 881 | |||
| 882 | Please note that the entry in `file-name-handler-alist' is made when | ||
| 883 | this file \(tramp.el) is loaded. This means that this variable must be set | ||
| 884 | before loading tramp.el. Alternatively, `file-name-handler-alist' can be | ||
| 885 | updated after changing this variable. | ||
| 886 | |||
| 887 | Also see `tramp-file-name-structure'.") | ||
| 888 | 878 | ||
| 889 | ;;;###autoload | 879 | ;;;###autoload |
| 890 | (defconst tramp-completion-file-name-regexp-unified | 880 | (defconst tramp-completion-file-name-regexp-unified |
| @@ -1055,9 +1045,9 @@ means to use always cached values for the directory contents." | |||
| 1055 | . tramp-completion-handle-file-name-all-completions) | 1045 | . tramp-completion-handle-file-name-all-completions) |
| 1056 | (file-name-completion . tramp-completion-handle-file-name-completion)) | 1046 | (file-name-completion . tramp-completion-handle-file-name-completion)) |
| 1057 | "Alist of completion handler functions. | 1047 | "Alist of completion handler functions. |
| 1058 | Used for file names matching `tramp-file-name-regexp'. Operations | 1048 | Used for file names matching `tramp-completion-file-name-regexp'. |
| 1059 | not mentioned here will be handled by Tramp's file name handler | 1049 | Operations not mentioned here will be handled by Tramp's file |
| 1060 | functions, or the normal Emacs functions.") | 1050 | name handler functions, or the normal Emacs functions.") |
| 1061 | 1051 | ||
| 1062 | ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. | 1052 | ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here. |
| 1063 | ;;;###tramp-autoload | 1053 | ;;;###tramp-autoload |
| @@ -2192,6 +2182,10 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2192 | tramp-autoload-file-name-handler)) | 2182 | tramp-autoload-file-name-handler)) |
| 2193 | (let ((a1 (rassq fnh file-name-handler-alist))) | 2183 | (let ((a1 (rassq fnh file-name-handler-alist))) |
| 2194 | (setq file-name-handler-alist (delq a1 file-name-handler-alist)))) | 2184 | (setq file-name-handler-alist (delq a1 file-name-handler-alist)))) |
| 2185 | ;; The initial value of `tramp-file-name-regexp' is too simple | ||
| 2186 | ;; minded, but we cannot give it the real value in the autoload | ||
| 2187 | ;; pattern. See Bug#24889. | ||
| 2188 | (setq tramp-file-name-regexp (car tramp-file-name-structure)) | ||
| 2195 | ;; Add the handlers. | 2189 | ;; Add the handlers. |
| 2196 | (add-to-list 'file-name-handler-alist | 2190 | (add-to-list 'file-name-handler-alist |
| 2197 | (cons tramp-file-name-regexp 'tramp-file-name-handler)) | 2191 | (cons tramp-file-name-regexp 'tramp-file-name-handler)) |