diff options
author | Glenn Morris <rgm@gnu.org> | 2014-05-11 23:59:30 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2014-05-11 23:59:30 -0700 |
commit | bbbabffe06d4c763534d5be92844c48a3f8746e2 (patch) | |
tree | a6fffb13638948223f3142e5209cbce57282fbbd /lisp/url/url-handlers.el | |
parent | ffd6d9c4d321e93e301f9cafd1fe054389898978 (diff) | |
parent | 96b894717caa773aa6d98ff57385f1c7537e8972 (diff) | |
download | emacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.tar.gz |
Merge from emacs-24; up to 2014-05-12T06:15:47Z!rgm@gnu.org
Diffstat (limited to 'lisp/url/url-handlers.el')
-rw-r--r-- | lisp/url/url-handlers.el | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index 9a05746ebff..c86acb680d0 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -138,34 +138,41 @@ like URLs \(Gnus is particularly bad at this\)." (inhibit-file-name-operation operation)) (apply operation args))) +(defvar url-file-handler-load-in-progress nil + "Check for recursive load.") + ;;;###autoload (defun url-file-handler (operation &rest args) "Function called from the `file-name-handler-alist' routines. OPERATION is what needs to be done (`file-exists-p', etc). ARGS are the arguments that would have been passed to OPERATION." - ;; 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))) + ;; 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)) + ;; 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 |