;;; url-methods.el --- Load URL schemes as needed
-;; Copyright (C) 1996, 1997, 1998, 1999, 2004,
-;; 2005, 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2011 Free Software Foundation, Inc.
;; Keywords: comm, data, processes, hypermedia
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-;;
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
-;;
+
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
"Signal an error for an unknown URL scheme."
(error "Unkown URL scheme: %s" (url-type url)))
+(defvar url-scheme--registering-proxy nil)
+
(defun url-scheme-register-proxy (scheme)
"Automatically find a proxy for SCHEME and put it in `url-proxy-services'."
(let* ((env-var (concat scheme "_proxy"))
(env-proxy (or (getenv (upcase env-var))
(getenv (downcase env-var))))
(cur-proxy (assoc scheme url-proxy-services))
- (urlobj nil))
+ (urlobj nil)
+ (url-scheme--registering-proxy t))
;; If env-proxy is an empty string, treat it as if it were nil
(when (and (stringp env-proxy)
(message "Using a proxy for %s..." scheme)))))
(defun url-scheme-get-property (scheme property)
- "Get property of a URL SCHEME.
+ "Get PROPERTY of a URL SCHEME.
Will automatically try to load a backend from url-SCHEME.el if
it has not already been loaded."
(setq scheme (downcase scheme))
(if (fboundp loader)
(progn
;; Found the module to handle <scheme> URLs
- (url-scheme-register-proxy scheme)
+ (unless url-scheme--registering-proxy
+ (url-scheme-register-proxy scheme))
(setq desc (list 'name scheme
'loader loader))
(dolist (cell url-scheme-methods)
(provide 'url-methods)
-;; arch-tag: 336863f8-5a07-4906-9be5-b3c6bcebbe67
;;; url-methods.el ends here