summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2016-12-02 11:38:19 +0100
committerMichael Albinus <michael.albinus@gmx.de>2016-12-02 11:38:19 +0100
commite9ac4b4c82a5698e9399deea2d6450890b8baf64 (patch)
tree3b86b35dadeaa5e4c5e8732c1da7c7977ad413a2 /lisp/net
parent05a969265cabdf361492ed471f1a8dc369840401 (diff)
downloademacs-e9ac4b4c82a5698e9399deea2d6450890b8baf64.tar.gz
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.
Diffstat (limited to 'lisp/net')
-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."
(defun tramp-file-name-handler (operation &rest args)
"Invoke Tramp file name handler.
Falls back to normal file name handler if no Tramp file name handler exists."
- (if tramp-mode
- (save-match-data
- (let* ((filename
- (tramp-replace-environment-variables
- (apply 'tramp-file-name-for-operation operation args)))
- (completion (tramp-completion-mode-p))
- (foreign
- (tramp-find-foreign-file-name-handler
- filename operation completion))
- result)
- (with-parsed-tramp-file-name filename nil
- ;; Call the backend function.
- (if foreign
- (tramp-condition-case-unless-debug err
+ (let ((filename (apply 'tramp-file-name-for-operation operation args)))
+ (if (and tramp-mode (tramp-tramp-file-p filename))
+ (save-match-data
+ (let* ((filename (tramp-replace-environment-variables filename))
+ (completion (tramp-completion-mode-p))
+ (foreign
+ (tramp-find-foreign-file-name-handler
+ filename operation completion))
+ result)
+ (with-parsed-tramp-file-name filename nil
+ ;; Call the backend function.
+ (if foreign
+ (tramp-condition-case-unless-debug err
(let ((sf (symbol-function foreign)))
;; Some packages set the default directory to a
;; remote path, before respective Tramp packages
@@ -2072,43 +2071,44 @@ Falls back to normal file name handler if no Tramp file name handler exists."
(tramp-run-real-handler operation args)))
(t result)))
- ;; Trace that somebody has interrupted the operation.
- ((debug quit)
- (let (tramp-message-show-message)
- (tramp-message
- v 1 "Interrupt received in operation %s"
- (cons operation args)))
- ;; Propagate the quit signal.
- (signal (car err) (cdr err)))
-
- ;; When we are in completion mode, some failed
- ;; operations shall return at least a default value
- ;; in order to give the user a chance to correct the
- ;; file name in the minibuffer.
- ;; In order to get a full backtrace, one could apply
- ;; (setq tramp-debug-on-error t)
- (error
- (cond
- ((and completion (zerop (length localname))
- (memq operation '(file-exists-p file-directory-p)))
- t)
- ((and completion (zerop (length localname))
- (memq operation
- '(expand-file-name file-name-as-directory)))
- filename)
- ;; Propagate the error.
- (t (signal (car err) (cdr err))))))
-
- ;; Nothing to do for us. However, since we are in
- ;; `tramp-mode', we must suppress the volume letter on
- ;; MS Windows.
- (setq result (tramp-run-real-handler operation args))
- (if (stringp result)
- (tramp-drop-volume-letter result)
- result)))))
-
- ;; When `tramp-mode' is not enabled, we don't do anything.
- (tramp-run-real-handler operation args)))
+ ;; Trace that somebody has interrupted the operation.
+ ((debug quit)
+ (let (tramp-message-show-message)
+ (tramp-message
+ v 1 "Interrupt received in operation %s"
+ (cons operation args)))
+ ;; Propagate the quit signal.
+ (signal (car err) (cdr err)))
+
+ ;; When we are in completion mode, some failed
+ ;; operations shall return at least a default
+ ;; value in order to give the user a chance to
+ ;; correct the file name in the minibuffer.
+ ;; In order to get a full backtrace, one could apply
+ ;; (setq tramp-debug-on-error t)
+ (error
+ (cond
+ ((and completion (zerop (length localname))
+ (memq operation '(file-exists-p file-directory-p)))
+ t)
+ ((and completion (zerop (length localname))
+ (memq operation
+ '(expand-file-name file-name-as-directory)))
+ filename)
+ ;; Propagate the error.
+ (t (signal (car err) (cdr err))))))
+
+ ;; Nothing to do for us. However, since we are in
+ ;; `tramp-mode', we must suppress the volume letter on
+ ;; MS Windows.
+ (setq result (tramp-run-real-handler operation args))
+ (if (stringp result)
+ (tramp-drop-volume-letter result)
+ result)))))
+
+ ;; When `tramp-mode' is not enabled, or the file name is quoted,
+ ;; we don't do anything.
+ (tramp-run-real-handler operation args))))
;; In Emacs, there is some concurrency due to timers. If a timer
;; interrupts Tramp and wishes to use the same connection buffer as