diff options
| author | Juanma Barranquero | 2014-04-19 01:36:51 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2014-04-19 01:36:51 +0200 |
| commit | bba633792b813249a47dde828cbf84cdb946ba60 (patch) | |
| tree | e320e5217ad3dc878e49fb86be7297a5cef60e5f /lisp/net | |
| parent | f0496348d1b9b1f2fff9e4265f51cbdc77eb40dc (diff) | |
| parent | 2a2e6726d1f7031d89fd6740e5b167476267f778 (diff) | |
| download | emacs-bba633792b813249a47dde828cbf84cdb946ba60.tar.gz emacs-bba633792b813249a47dde828cbf84cdb946ba60.zip | |
Merge from emacs-24; up to 2014-04-16T15:28:06Z!eggert@cs.ucla.edu
Diffstat (limited to 'lisp/net')
| -rw-r--r-- | lisp/net/tramp-adb.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 1 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 70 |
3 files changed, 45 insertions, 30 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 27f20dea754..53888473217 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -1183,5 +1183,9 @@ connection if a previous connection has died for some reason." | |||
| 1183 | (read (current-buffer))) | 1183 | (read (current-buffer))) |
| 1184 | ":" 'omit-nulls)))))))) | 1184 | ":" 'omit-nulls)))))))) |
| 1185 | 1185 | ||
| 1186 | (add-hook 'tramp-unload-hook | ||
| 1187 | (lambda () | ||
| 1188 | (unload-feature 'tramp-adb 'force))) | ||
| 1189 | |||
| 1186 | (provide 'tramp-adb) | 1190 | (provide 'tramp-adb) |
| 1187 | ;;; tramp-adb.el ends here | 1191 | ;;; tramp-adb.el ends here |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index bdbfbcf4c2e..cd336ec61b3 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -587,6 +587,7 @@ and replace a sub-expression, e.g. | |||
| 587 | 587 | ||
| 588 | (add-hook 'tramp-unload-hook | 588 | (add-hook 'tramp-unload-hook |
| 589 | (lambda () | 589 | (lambda () |
| 590 | (unload-feature 'tramp-loaddefs 'force) | ||
| 590 | (unload-feature 'tramp-compat 'force))) | 591 | (unload-feature 'tramp-compat 'force))) |
| 591 | 592 | ||
| 592 | (provide 'tramp-compat) | 593 | (provide 'tramp-compat) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 51cc13fed7c..6cc8275b327 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1943,8 +1943,7 @@ coding system might not be determined. This function repairs it." | |||
| 1943 | (add-to-list | 1943 | (add-to-list |
| 1944 | 'result (cons (regexp-quote tmpname) (cdr elt)) 'append))))) | 1944 | 'result (cons (regexp-quote tmpname) (cdr elt)) 'append))))) |
| 1945 | 1945 | ||
| 1946 | ;;;###autoload | 1946 | (defun tramp-run-real-handler (operation args) |
| 1947 | (progn (defun tramp-run-real-handler (operation args) | ||
| 1948 | "Invoke normal file name handler for OPERATION. | 1947 | "Invoke normal file name handler for OPERATION. |
| 1949 | First arg specifies the OPERATION, second arg is a list of arguments to | 1948 | First arg specifies the OPERATION, second arg is a list of arguments to |
| 1950 | pass to the OPERATION." | 1949 | pass to the OPERATION." |
| @@ -1958,7 +1957,7 @@ pass to the OPERATION." | |||
| 1958 | ,(and (eq inhibit-file-name-operation operation) | 1957 | ,(and (eq inhibit-file-name-operation operation) |
| 1959 | inhibit-file-name-handlers))) | 1958 | inhibit-file-name-handlers))) |
| 1960 | (inhibit-file-name-operation operation)) | 1959 | (inhibit-file-name-operation operation)) |
| 1961 | (apply operation args)))) | 1960 | (apply operation args))) |
| 1962 | 1961 | ||
| 1963 | ;;;###autoload | 1962 | ;;;###autoload |
| 1964 | (progn (defun tramp-completion-run-real-handler (operation args) | 1963 | (progn (defun tramp-completion-run-real-handler (operation args) |
| @@ -2100,22 +2099,12 @@ ARGS are the arguments OPERATION has been called with." | |||
| 2100 | (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers))) | 2099 | (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers))) |
| 2101 | 2100 | ||
| 2102 | ;; Main function. | 2101 | ;; Main function. |
| 2103 | ;;;###autoload | ||
| 2104 | (defun tramp-file-name-handler (operation &rest args) | 2102 | (defun tramp-file-name-handler (operation &rest args) |
| 2105 | "Invoke Tramp file name handler. | 2103 | "Invoke Tramp file name handler. |
| 2106 | Falls back to normal file name handler if no Tramp file name handler exists." | 2104 | Falls back to normal file name handler if no Tramp file name handler exists." |
| 2107 | (if tramp-mode | 2105 | (if tramp-mode |
| 2108 | (save-match-data | 2106 | (save-match-data |
| 2109 | (let* ((default-directory | 2107 | (let* ((filename |
| 2110 | ;; Some packages set the default directory to a | ||
| 2111 | ;; remote path, before tramp.el has been loaded. | ||
| 2112 | ;; This results in recursive loading. Therefore, we | ||
| 2113 | ;; set `default-directory' to a local path. `args' | ||
| 2114 | ;; could also be remote when loading tramp.el, but | ||
| 2115 | ;; that would be such perverse we don't care about. | ||
| 2116 | (if load-in-progress | ||
| 2117 | temporary-file-directory default-directory)) | ||
| 2118 | (filename | ||
| 2119 | (tramp-replace-environment-variables | 2108 | (tramp-replace-environment-variables |
| 2120 | (apply 'tramp-file-name-for-operation operation args))) | 2109 | (apply 'tramp-file-name-for-operation operation args))) |
| 2121 | (completion (tramp-completion-mode-p)) | 2110 | (completion (tramp-completion-mode-p)) |
| @@ -2227,11 +2216,8 @@ preventing reentrant calls of Tramp.") | |||
| 2227 | "Invoke Tramp file name completion handler. | 2216 | "Invoke Tramp file name completion handler. |
| 2228 | Falls back to normal file name handler if no Tramp file name handler exists." | 2217 | Falls back to normal file name handler if no Tramp file name handler exists." |
| 2229 | ;; We bind `directory-sep-char' here for XEmacs on Windows, which | 2218 | ;; We bind `directory-sep-char' here for XEmacs on Windows, which |
| 2230 | ;; would otherwise use backslash. For `default-directory', see | 2219 | ;; would otherwise use backslash. |
| 2231 | ;; comment in `tramp-file-name-handler'. | ||
| 2232 | (let ((directory-sep-char ?/) | 2220 | (let ((directory-sep-char ?/) |
| 2233 | (default-directory | ||
| 2234 | (if load-in-progress temporary-file-directory default-directory)) | ||
| 2235 | (fn (assoc operation tramp-completion-file-name-handler-alist))) | 2221 | (fn (assoc operation tramp-completion-file-name-handler-alist))) |
| 2236 | (if (and | 2222 | (if (and |
| 2237 | ;; When `tramp-mode' is not enabled, we don't do anything. | 2223 | ;; When `tramp-mode' is not enabled, we don't do anything. |
| @@ -2255,15 +2241,43 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2255 | (tramp-completion-run-real-handler operation args))))) | 2241 | (tramp-completion-run-real-handler operation args))))) |
| 2256 | 2242 | ||
| 2257 | ;;;###autoload | 2243 | ;;;###autoload |
| 2258 | (progn (defun tramp-register-file-name-handlers () | 2244 | (progn (defun tramp-autoload-file-name-handler (operation &rest args) |
| 2245 | "Load Tramp file name handler, and perform OPERATION." | ||
| 2246 | ;; Avoid recursive loading of tramp.el. | ||
| 2247 | (let ((default-directory temporary-file-directory)) | ||
| 2248 | (load "tramp" nil t)) | ||
| 2249 | (apply operation args))) | ||
| 2250 | |||
| 2251 | ;; `tramp-autoload-file-name-handler' must be registered before | ||
| 2252 | ;; evaluation of site-start and init files, because there might exist | ||
| 2253 | ;; remote files already, f.e. files kept via recentf-mode. We cannot | ||
| 2254 | ;; autoload `tramp-file-name-handler', because it would result in | ||
| 2255 | ;; recursive loading of tramp.el when `default-directory' is set to | ||
| 2256 | ;; remote. | ||
| 2257 | ;;;###autoload | ||
| 2258 | (progn (defun tramp-register-autoload-file-name-handlers () | ||
| 2259 | "Add Tramp file name handlers to `file-name-handler-alist' during autoload." | ||
| 2260 | (add-to-list 'file-name-handler-alist | ||
| 2261 | (cons tramp-file-name-regexp | ||
| 2262 | 'tramp-autoload-file-name-handler)) | ||
| 2263 | (put 'tramp-autoload-file-name-handler 'safe-magic t) | ||
| 2264 | (add-to-list 'file-name-handler-alist | ||
| 2265 | (cons tramp-completion-file-name-regexp | ||
| 2266 | 'tramp-completion-file-name-handler)) | ||
| 2267 | (put 'tramp-completion-file-name-handler 'safe-magic t))) | ||
| 2268 | |||
| 2269 | ;;;###autoload | ||
| 2270 | (tramp-register-autoload-file-name-handlers) | ||
| 2271 | |||
| 2272 | (defun tramp-register-file-name-handlers () | ||
| 2259 | "Add Tramp file name handlers to `file-name-handler-alist'." | 2273 | "Add Tramp file name handlers to `file-name-handler-alist'." |
| 2260 | ;; Remove autoloaded handlers from file name handler alist. Useful, | 2274 | ;; Remove autoloaded handlers from file name handler alist. Useful, |
| 2261 | ;; if `tramp-syntax' has been changed. | 2275 | ;; if `tramp-syntax' has been changed. |
| 2262 | (let ((a1 (rassq 'tramp-file-name-handler file-name-handler-alist))) | 2276 | (dolist (fnh '(tramp-file-name-handler |
| 2263 | (setq file-name-handler-alist (delq a1 file-name-handler-alist))) | 2277 | tramp-completion-file-name-handler |
| 2264 | (let ((a1 (rassq | 2278 | tramp-autoload-file-name-handler)) |
| 2265 | 'tramp-completion-file-name-handler file-name-handler-alist))) | 2279 | (let ((a1 (rassq fnh file-name-handler-alist))) |
| 2266 | (setq file-name-handler-alist (delq a1 file-name-handler-alist))) | 2280 | (setq file-name-handler-alist (delq a1 file-name-handler-alist)))) |
| 2267 | ;; Add the handlers. | 2281 | ;; Add the handlers. |
| 2268 | (add-to-list 'file-name-handler-alist | 2282 | (add-to-list 'file-name-handler-alist |
| 2269 | (cons tramp-file-name-regexp 'tramp-file-name-handler)) | 2283 | (cons tramp-file-name-regexp 'tramp-file-name-handler)) |
| @@ -2278,13 +2292,9 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2278 | (let ((entry (rassoc fnh file-name-handler-alist))) | 2292 | (let ((entry (rassoc fnh file-name-handler-alist))) |
| 2279 | (when entry | 2293 | (when entry |
| 2280 | (setq file-name-handler-alist | 2294 | (setq file-name-handler-alist |
| 2281 | (cons entry (delete entry file-name-handler-alist)))))))) | 2295 | (cons entry (delete entry file-name-handler-alist))))))) |
| 2282 | 2296 | ||
| 2283 | ;; `tramp-file-name-handler' must be registered before evaluation of | 2297 | (eval-after-load 'tramp (tramp-register-file-name-handlers)) |
| 2284 | ;; site-start and init files, because there might exist remote files | ||
| 2285 | ;; already, f.e. files kept via recentf-mode. | ||
| 2286 | ;;;###autoload | ||
| 2287 | (tramp-register-file-name-handlers) | ||
| 2288 | 2298 | ||
| 2289 | (defun tramp-exists-file-name-handler (operation &rest args) | 2299 | (defun tramp-exists-file-name-handler (operation &rest args) |
| 2290 | "Check, whether OPERATION runs a file name handler." | 2300 | "Check, whether OPERATION runs a file name handler." |