aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2016-12-02 11:38:19 +0100
committerMichael Albinus2016-12-02 11:38:19 +0100
commite9ac4b4c82a5698e9399deea2d6450890b8baf64 (patch)
tree3b86b35dadeaa5e4c5e8732c1da7c7977ad413a2
parent05a969265cabdf361492ed471f1a8dc369840401 (diff)
downloademacs-e9ac4b4c82a5698e9399deea2d6450890b8baf64.tar.gz
emacs-e9ac4b4c82a5698e9399deea2d6450890b8baf64.zip
Handle quoted file names in Tramp
* lisp/net/tramp.el (tramp-file-name-handler): Handle also the case the file name is quoted. This is not trapped by the reassigned `tramp-file-name-regexp' anymore.
-rw-r--r--lisp/net/tramp.el102
1 files changed, 51 insertions, 51 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index af08cf7e13a..956cf152e3f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2021,20 +2021,19 @@ ARGS are the arguments OPERATION has been called with."
2021(defun tramp-file-name-handler (operation &rest args) 2021(defun tramp-file-name-handler (operation &rest args)
2022 "Invoke Tramp file name handler. 2022 "Invoke Tramp file name handler.
2023Falls back to normal file name handler if no Tramp file name handler exists." 2023Falls back to normal file name handler if no Tramp file name handler exists."
2024 (if tramp-mode 2024 (let ((filename (apply 'tramp-file-name-for-operation operation args)))
2025 (save-match-data 2025 (if (and tramp-mode (tramp-tramp-file-p filename))
2026 (let* ((filename 2026 (save-match-data
2027 (tramp-replace-environment-variables 2027 (let* ((filename (tramp-replace-environment-variables filename))
2028 (apply 'tramp-file-name-for-operation operation args))) 2028 (completion (tramp-completion-mode-p))
2029 (completion (tramp-completion-mode-p)) 2029 (foreign
2030 (foreign 2030 (tramp-find-foreign-file-name-handler
2031 (tramp-find-foreign-file-name-handler 2031 filename operation completion))
2032 filename operation completion)) 2032 result)
2033 result) 2033 (with-parsed-tramp-file-name filename nil
2034 (with-parsed-tramp-file-name filename nil 2034 ;; Call the backend function.
2035 ;; Call the backend function. 2035 (if foreign
2036 (if foreign 2036 (tramp-condition-case-unless-debug err
2037 (tramp-condition-case-unless-debug err
2038 (let ((sf (symbol-function foreign))) 2037 (let ((sf (symbol-function foreign)))
2039 ;; Some packages set the default directory to a 2038 ;; Some packages set the default directory to a
2040 ;; remote path, before respective Tramp packages 2039 ;; remote path, before respective Tramp packages
@@ -2072,43 +2071,44 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2072 (tramp-run-real-handler operation args))) 2071 (tramp-run-real-handler operation args)))
2073 (t result))) 2072 (t result)))
2074 2073
2075 ;; Trace that somebody has interrupted the operation. 2074 ;; Trace that somebody has interrupted the operation.
2076 ((debug quit) 2075 ((debug quit)
2077 (let (tramp-message-show-message) 2076 (let (tramp-message-show-message)
2078 (tramp-message 2077 (tramp-message
2079 v 1 "Interrupt received in operation %s" 2078 v 1 "Interrupt received in operation %s"
2080 (cons operation args))) 2079 (cons operation args)))
2081 ;; Propagate the quit signal. 2080 ;; Propagate the quit signal.
2082 (signal (car err) (cdr err))) 2081 (signal (car err) (cdr err)))
2083 2082
2084 ;; When we are in completion mode, some failed 2083 ;; When we are in completion mode, some failed
2085 ;; operations shall return at least a default value 2084 ;; operations shall return at least a default
2086 ;; in order to give the user a chance to correct the 2085 ;; value in order to give the user a chance to
2087 ;; file name in the minibuffer. 2086 ;; correct the file name in the minibuffer.
2088 ;; In order to get a full backtrace, one could apply 2087 ;; In order to get a full backtrace, one could apply
2089 ;; (setq tramp-debug-on-error t) 2088 ;; (setq tramp-debug-on-error t)
2090 (error 2089 (error
2091 (cond 2090 (cond
2092 ((and completion (zerop (length localname)) 2091 ((and completion (zerop (length localname))
2093 (memq operation '(file-exists-p file-directory-p))) 2092 (memq operation '(file-exists-p file-directory-p)))
2094 t) 2093 t)
2095 ((and completion (zerop (length localname)) 2094 ((and completion (zerop (length localname))
2096 (memq operation 2095 (memq operation
2097 '(expand-file-name file-name-as-directory))) 2096 '(expand-file-name file-name-as-directory)))
2098 filename) 2097 filename)
2099 ;; Propagate the error. 2098 ;; Propagate the error.
2100 (t (signal (car err) (cdr err)))))) 2099 (t (signal (car err) (cdr err))))))
2101 2100
2102 ;; Nothing to do for us. However, since we are in 2101 ;; Nothing to do for us. However, since we are in
2103 ;; `tramp-mode', we must suppress the volume letter on 2102 ;; `tramp-mode', we must suppress the volume letter on
2104 ;; MS Windows. 2103 ;; MS Windows.
2105 (setq result (tramp-run-real-handler operation args)) 2104 (setq result (tramp-run-real-handler operation args))
2106 (if (stringp result) 2105 (if (stringp result)
2107 (tramp-drop-volume-letter result) 2106 (tramp-drop-volume-letter result)
2108 result))))) 2107 result)))))
2109 2108
2110 ;; When `tramp-mode' is not enabled, we don't do anything. 2109 ;; When `tramp-mode' is not enabled, or the file name is quoted,
2111 (tramp-run-real-handler operation args))) 2110 ;; we don't do anything.
2111 (tramp-run-real-handler operation args))))
2112 2112
2113;; In Emacs, there is some concurrency due to timers. If a timer 2113;; In Emacs, there is some concurrency due to timers. If a timer
2114;; interrupts Tramp and wishes to use the same connection buffer as 2114;; interrupts Tramp and wishes to use the same connection buffer as