diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/url/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/url/url-handlers.el | 35 |
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 @@ | |||
| 1 | 2014-05-09 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * url-handlers.el (url-file-handler-load-in-progress): New defvar. | ||
| 4 | (url-file-handler): Use it, in order to avoid recursive load. | ||
| 5 | |||
| 1 | 2014-05-01 Glenn Morris <rgm@gnu.org> | 6 | 2014-05-01 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * url-parse.el (url-generic-parse-url): Doc fix (replace `iff'). | 8 | * 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\)." | |||
| 137 | (inhibit-file-name-operation operation)) | 137 | (inhibit-file-name-operation operation)) |
| 138 | (apply operation args))) | 138 | (apply operation args))) |
| 139 | 139 | ||
| 140 | (defvar url-file-handler-load-in-progress nil | ||
| 141 | "Check for recursive load.") | ||
| 142 | |||
| 140 | ;;;###autoload | 143 | ;;;###autoload |
| 141 | (defun url-file-handler (operation &rest args) | 144 | (defun url-file-handler (operation &rest args) |
| 142 | "Function called from the `file-name-handler-alist' routines. | 145 | "Function called from the `file-name-handler-alist' routines. |
| 143 | OPERATION is what needs to be done (`file-exists-p', etc). ARGS are | 146 | OPERATION is what needs to be done (`file-exists-p', etc). ARGS are |
| 144 | the arguments that would have been passed to OPERATION." | 147 | the arguments that would have been passed to OPERATION." |
| 145 | (let ((fn (get operation 'url-file-handlers)) | 148 | ;; Avoid recursive load. |
| 146 | (val nil) | 149 | (if (and load-in-progress url-file-handler-load-in-progress) |
| 147 | (hooked nil)) | 150 | (url-run-real-handler operation args) |
| 148 | (if (and (not fn) (intern-soft (format "url-%s" operation)) | 151 | (let ((url-file-handler-load-in-progress load-in-progress) |
| 149 | (fboundp (intern-soft (format "url-%s" operation)))) | 152 | (fn (get operation 'url-file-handlers)) |
| 150 | (error "Missing URL handler mapping for %s" operation)) | 153 | (val nil) |
| 151 | (if fn | 154 | (hooked nil)) |
| 152 | (setq hooked t | 155 | (if (and (not fn) (intern-soft (format "url-%s" operation)) |
| 153 | val (save-match-data (apply fn args))) | 156 | (fboundp (intern-soft (format "url-%s" operation)))) |
| 154 | (setq hooked nil | 157 | (error "Missing URL handler mapping for %s" operation)) |
| 155 | val (url-run-real-handler operation args))) | 158 | (if fn |
| 156 | (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real") | 159 | (setq hooked t |
| 157 | operation args val) | 160 | val (save-match-data (apply fn args))) |
| 158 | val)) | 161 | (setq hooked nil |
| 162 | val (url-run-real-handler operation args))) | ||
| 163 | (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real") | ||
| 164 | operation args val) | ||
| 165 | val))) | ||
| 159 | 166 | ||
| 160 | (defun url-file-handler-identity (&rest args) | 167 | (defun url-file-handler-identity (&rest args) |
| 161 | ;; Identity function | 168 | ;; Identity function |