aboutsummaryrefslogtreecommitdiff
path: root/emms-url.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2008-02-15 17:32:00 +0000
committerMichael Olson <mwolson@gnu.org>2008-02-15 17:32:00 +0000
commit4ff658089418170cc4628effc3481b6ec0f01dd2 (patch)
tree5dc4e611412d73f0adc167c7e2341d847fd51d14 /emms-url.el
parentc0ea2609fc6c3e26047f4b9d10dc04348b60719c (diff)
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
Diffstat (limited to 'emms-url.el')
-rw-r--r--emms-url.el13
1 files 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 `+'."