]> code.delx.au - gnu-emacs/blobdiff - lisp/url/url-parse.el
Add a new function `svg-embed'
[gnu-emacs] / lisp / url / url-parse.el
index 4007d1f35b3b925650e5a74c29475697feb3e301..6e51b35f5a1ebbe4e997cd6d8761af528500811b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; url-parse.el --- Uniform Resource Locator parser
 
-;; Copyright (C) 1996-1999, 2004-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2016 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
   silent (use-cookies t))
 
 (defsubst url-port (urlobj)
-  "Return the port number for the URL specified by URLOBJ."
+  "Return the port number for the URL specified by URLOBJ.
+If the port spec is nil (i.e. URLOBJ specifies no port number),
+return the default port number for URLOBJ's scheme."
   (declare (gv-setter (lambda (port) `(setf (url-portspec ,urlobj) ,port))))
   (or (url-portspec urlobj)
       (if (url-type urlobj)
           (url-scheme-get-property (url-type urlobj) 'default-port))))
 
-
 (defun url-path-and-query (urlobj)
   "Return the path and query components of URLOBJ.
-These two components are store together in the FILENAME slot of
+These two components are stored together in the FILENAME slot of
 the object.  The return value of this function is (PATH . QUERY),
 where each of PATH and QUERY are strings or nil."
   (let ((name (url-filename urlobj))
@@ -58,8 +59,6 @@ where each of PATH and QUERY are strings or nil."
          (setq path  (substring name 0 (match-beginning 0))
                query (substring name (match-end 0)))
        (setq path name)))
-    (if (equal path "") (setq path nil))
-    (if (equal query "") (setq query nil))
     (cons path query)))
 
 (defun url-port-if-non-default (urlobj)
@@ -98,6 +97,7 @@ If the specified port number is the default, return nil."
 
 (defun url-recreate-url-attributes (urlobj)
   "Recreate the attributes of an URL string from the parsed URLOBJ."
+  (declare (obsolete nil "24.3"))
   (when (url-attributes urlobj)
     (concat ";"
            (mapconcat (lambda (x)
@@ -105,7 +105,6 @@ If the specified port number is the default, return nil."
                              (concat (car x) "=" (cdr x))
                            (car x)))
                        (url-attributes urlobj) ";"))))
-(make-obsolete 'url-recreate-url-attributes nil "24.3")
 
 ;;;###autoload
 (defun url-generic-parse-url (url)
@@ -124,7 +123,7 @@ TARGET   is the fragment identifier component (used to refer to a
 ATTRIBUTES is nil; this slot originally stored the attribute and
          value alists for IMAP URIs, but this feature was removed
          since it conflicts with RFC 3986.
-FULLNESS is non-nil iff the hierarchical sequence component of
+FULLNESS is non-nil if the hierarchical sequence component of
          the URL starts with two slashes, \"//\".
 
 The parser follows RFC 3986, except that it also tries to handle
@@ -216,8 +215,7 @@ parses to
            (when (looking-at "#")
              (let ((opoint (point)))
                (forward-char 1)
-               (unless (eobp)
-                 (setq fragment (buffer-substring (point) (point-max))))
+                (setq fragment (buffer-substring (point) (point-max)))
                (delete-region opoint (point-max)))))
 
           (if (and host (string-match "%[0-9][0-9]" host))