diff options
| author | Glenn Morris | 2014-05-11 23:59:30 -0700 |
|---|---|---|
| committer | Glenn Morris | 2014-05-11 23:59:30 -0700 |
| commit | bbbabffe06d4c763534d5be92844c48a3f8746e2 (patch) | |
| tree | a6fffb13638948223f3142e5209cbce57282fbbd /lisp/url | |
| parent | ffd6d9c4d321e93e301f9cafd1fe054389898978 (diff) | |
| parent | 96b894717caa773aa6d98ff57385f1c7537e8972 (diff) | |
| download | emacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.tar.gz emacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.zip | |
Merge from emacs-24; up to 2014-05-12T06:15:47Z!rgm@gnu.org
Diffstat (limited to 'lisp/url')
| -rw-r--r-- | lisp/url/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/url/url-handlers.el | 53 |
2 files changed, 35 insertions, 23 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index f3426656038..aba4a2c53e8 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-05-12 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-04 Glenn Morris <rgm@gnu.org> | 6 | 2014-05-04 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 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\)." | |||
| 138 | (inhibit-file-name-operation operation)) | 138 | (inhibit-file-name-operation operation)) |
| 139 | (apply operation args))) | 139 | (apply operation args))) |
| 140 | 140 | ||
| 141 | (defvar url-file-handler-load-in-progress nil | ||
| 142 | "Check for recursive load.") | ||
| 143 | |||
| 141 | ;;;###autoload | 144 | ;;;###autoload |
| 142 | (defun url-file-handler (operation &rest args) | 145 | (defun url-file-handler (operation &rest args) |
| 143 | "Function called from the `file-name-handler-alist' routines. | 146 | "Function called from the `file-name-handler-alist' routines. |
| 144 | OPERATION is what needs to be done (`file-exists-p', etc). ARGS are | 147 | OPERATION is what needs to be done (`file-exists-p', etc). ARGS are |
| 145 | the arguments that would have been passed to OPERATION." | 148 | the arguments that would have been passed to OPERATION." |
| 146 | ;; Check, whether there are arguments we want pass to Tramp. | 149 | ;; Avoid recursive load. |
| 147 | (if (catch :do | 150 | (if (and load-in-progress url-file-handler-load-in-progress) |
| 148 | (dolist (url (cons default-directory args)) | 151 | (url-run-real-handler operation args) |
| 149 | (and (member | 152 | (let ((url-file-handler-load-in-progress load-in-progress)) |
| 150 | (url-type (url-generic-parse-url (and (stringp url) url))) | 153 | ;; Check, whether there are arguments we want pass to Tramp. |
| 151 | url-tramp-protocols) | 154 | (if (catch :do |
| 152 | (throw :do t)))) | 155 | (dolist (url (cons default-directory args)) |
| 153 | (apply 'url-tramp-file-handler operation args) | 156 | (and (member |
| 154 | ;; Otherwise, let's do the job. | 157 | (url-type (url-generic-parse-url (and (stringp url) url))) |
| 155 | (let ((fn (get operation 'url-file-handlers)) | 158 | url-tramp-protocols) |
| 156 | (val nil) | 159 | (throw :do t)))) |
| 157 | (hooked nil)) | 160 | (apply 'url-tramp-file-handler operation args) |
| 158 | (if (and (not fn) (intern-soft (format "url-%s" operation)) | 161 | ;; Otherwise, let's do the job. |
| 159 | (fboundp (intern-soft (format "url-%s" operation)))) | 162 | (let ((fn (get operation 'url-file-handlers)) |
| 160 | (error "Missing URL handler mapping for %s" operation)) | 163 | (val nil) |
| 161 | (if fn | 164 | (hooked nil)) |
| 162 | (setq hooked t | 165 | (if (and (not fn) (intern-soft (format "url-%s" operation)) |
| 163 | val (save-match-data (apply fn args))) | 166 | (fboundp (intern-soft (format "url-%s" operation)))) |
| 164 | (setq hooked nil | 167 | (error "Missing URL handler mapping for %s" operation)) |
| 165 | val (url-run-real-handler operation args))) | 168 | (if fn |
| 166 | (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real") | 169 | (setq hooked t |
| 167 | operation args val) | 170 | val (save-match-data (apply fn args))) |
| 168 | val))) | 171 | (setq hooked nil |
| 172 | val (url-run-real-handler operation args))) | ||
| 173 | (url-debug 'handlers "%s %S%S => %S" (if hooked "Hooked" "Real") | ||
| 174 | operation args val) | ||
| 175 | val))))) | ||
| 169 | 176 | ||
| 170 | (defun url-file-handler-identity (&rest args) | 177 | (defun url-file-handler-identity (&rest args) |
| 171 | ;; Identity function | 178 | ;; Identity function |