From 4ff658089418170cc4628effc3481b6ec0f01dd2 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Fri, 15 Feb 2008 17:32:00 +0000 Subject: emms-url: Revert most of last two changes. Change remaining: Save match data. New changes: Update documentation to mention that this is only meant to be used for parts of URLs, not entire URLs. darcs-hash:20080215173207-1bfb2-916f0f32a5bc31190dcb91ac9d52a3b503835cad.gz --- emms-url.el | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/emms-url.el b/emms-url.el index 302ce36..aee894d 100644 --- a/emms-url.el +++ b/emms-url.el @@ -30,18 +30,15 @@ (defun emms-url-quote (s &optional safe) "Replace special characters in S using the `%xx' escape. +This is useful for escaping parts of URLs, but not entire URLs. + Characters in [a-zA-Z_.-/] and SAFE(default is \"\") will never be quoted. e.g., (url-quote \"abc def\") => \"abc%20def\"." (or safe (setq safe "")) (save-match-data - (string-match "\\`\\([^:]+://\\)\\(.+\\)\\'" s) - (let ((handler (match-string 1 s)) - (loc (or (match-string 2 s) s))) - (concat handler - (mapconcat - (lambda (c) + (mapconcat (lambda (c) (if (if (string-match "]" safe) ;; ] should be place at the beginning inside [] (string-match @@ -52,8 +49,8 @@ e.g., (char-to-string c))) (char-to-string c) (format "%%%02x" c))) - (string-to-list (encode-coding-string loc 'utf-8)) - ""))))) + (string-to-list (encode-coding-string s 'utf-8)) + ""))) (defun emms-url-quote-plus (s &optional safe) "Run (emms-url-quote s \" \"), then replace ` ' with `+'." -- cgit v1.2.3