emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117093: * url-handlers.el (url-file-handler-load


From: Michael Albinus
Subject: [Emacs-diffs] emacs-24 r117093: * url-handlers.el (url-file-handler-load-in-progress): New defvar.
Date: Fri, 09 May 2014 12:49:34 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117093
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: emacs-24
timestamp: Fri 2014-05-09 14:49:30 +0200
message:
  * url-handlers.el (url-file-handler-load-in-progress): New defvar.
  (url-file-handler): Use it, in order to avoid recursive load.
modified:
  lisp/url/ChangeLog             changelog-20091113204419-o5vbwnq5f7feedwu-3116
  lisp/url/url-handlers.el       
urlhandlers.el-20091113204419-o5vbwnq5f7feedwu-2987
=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog        2014-05-01 23:55:25 +0000
+++ b/lisp/url/ChangeLog        2014-05-09 12:49:30 +0000
@@ -1,3 +1,8 @@
+2014-05-09  Michael Albinus  <address@hidden>
+
+       * 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  <address@hidden>
 
        * url-parse.el (url-generic-parse-url): Doc fix (replace `iff').

=== modified file 'lisp/url/url-handlers.el'
--- a/lisp/url/url-handlers.el  2014-03-26 15:21:17 +0000
+++ b/lisp/url/url-handlers.el  2014-05-09 12:49:30 +0000
@@ -137,25 +137,32 @@
        (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]