summaryrefslogtreecommitdiff
path: root/lisp/url/url-handlers.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/url/url-handlers.el')
-rw-r--r--lisp/url/url-handlers.el42
1 files changed, 26 insertions, 16 deletions
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index b0f01123bbb..c86acb680d0 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -112,7 +112,7 @@ the mode if ARG is omitted or nil."
(push (cons url-handler-regexp 'url-file-handler)
file-name-handler-alist)))
-(defcustom url-handler-regexp "\\`\\(https?\\|ftp\\|file\\|nfs\\)://"
+(defcustom url-handler-regexp "\\`\\(https?\\|ftp\\|file\\|nfs\\|ssh\\|scp\\|rsync\\|telnet\\)://"
"Regular expression for URLs handled by `url-handler-mode'.
When URL Handler mode is enabled, this regular expression is
added to `file-name-handler-alist'.
@@ -123,6 +123,7 @@ regular expression avoids conflicts with local files that look
like URLs \(Gnus is particularly bad at this\)."
:group 'url
:type 'regexp
+ :version "24.5"
:set (lambda (symbol value)
(let ((enable url-handler-mode))
(url-handler-mode 0)
@@ -148,21 +149,30 @@ the arguments that would have been passed to OPERATION."
;; Avoid recursive load.
(if (and load-in-progress url-file-handler-load-in-progress)
(url-run-real-handler operation args)
- (let ((url-file-handler-load-in-progress load-in-progress)
- (fn (get operation 'url-file-handlers))
- (val nil)
- (hooked nil))
- (if (and (not fn) (intern-soft (format "url-%s" operation))
- (fboundp (intern-soft (format "url-%s" operation))))
- (error "Missing URL handler mapping for %s" operation))
- (if fn
- (setq hooked t
- val (save-match-data (apply fn args)))
- (setq hooked nil
- val (url-run-real-handler operation args)))
- (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real")
- operation args val)
- val)))
+ (let ((url-file-handler-load-in-progress load-in-progress))
+ ;; Check, whether there are arguments we want pass to Tramp.
+ (if (catch :do
+ (dolist (url (cons default-directory args))
+ (and (member
+ (url-type (url-generic-parse-url (and (stringp url) url)))
+ url-tramp-protocols)
+ (throw :do t))))
+ (apply 'url-tramp-file-handler operation args)
+ ;; Otherwise, let's do the job.
+ (let ((fn (get operation 'url-file-handlers))
+ (val nil)
+ (hooked nil))
+ (if (and (not fn) (intern-soft (format "url-%s" operation))
+ (fboundp (intern-soft (format "url-%s" operation))))
+ (error "Missing URL handler mapping for %s" operation))
+ (if fn
+ (setq hooked t
+ val (save-match-data (apply fn args)))
+ (setq hooked nil
+ val (url-run-real-handler operation args)))
+ (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real")
+ operation args val)
+ val)))))
(defun url-file-handler-identity (&rest args)
;; Identity function