summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2014-05-09 14:49:30 +0200
committerMichael Albinus <michael.albinus@gmx.de>2014-05-09 14:49:30 +0200
commit0f09bbfa7fe4fd98ff317a469b82cedde081b2eb (patch)
tree705fce20be03a47c165e6375094c07c6821b877c
parent472c15bf14b52226589f8582a57d1811e1ee3ad2 (diff)
downloademacs-0f09bbfa7fe4fd98ff317a469b82cedde081b2eb.tar.gz
* url-handlers.el (url-file-handler-load-in-progress): New defvar.
(url-file-handler): Use it, in order to avoid recursive load.
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-handlers.el35
2 files changed, 26 insertions, 14 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index da7d7325a01..408f659681f 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
+2014-05-09 Michael Albinus <michael.albinus@gmx.de>
+
+ * url-handlers.el (url-file-handler-load-in-progress): New defvar.
+ (url-file-handler): Use it, in order to avoid recursive load.
+
2014-05-01 Glenn Morris <rgm@gnu.org>
* url-parse.el (url-generic-parse-url): Doc fix (replace `iff').
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index ecf56e786b5..b0f01123bbb 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -137,25 +137,32 @@ 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."
- (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)
+ (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