diff options
| author | Eli Zaretskii | 2004-03-07 20:02:02 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2004-03-07 20:02:02 +0000 |
| commit | 651f4d9f27e3703502afebaf3b075dd55e2067b2 (patch) | |
| tree | 1d4b8383121a0d6cc18a4fe470f5d9dc3ccddc28 | |
| parent | 1abcd0881985c2228459e51911a752870b106adc (diff) | |
| download | emacs-651f4d9f27e3703502afebaf3b075dd55e2067b2.tar.gz emacs-651f4d9f27e3703502afebaf3b075dd55e2067b2.zip | |
(rfc2368-unhexify-char): Deleted.
(rfc2368-unhexify-string): Use replace-regexp-in-string.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/mail/rfc2368.el | 36 |
2 files changed, 13 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f357a7dca34..a7aedbbe57e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2004-03-07 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * net/browse-url.el (rfc2368-parse-mailto-url): Autoload. | ||
| 4 | (browse-url-mail): Use it. | ||
| 5 | |||
| 6 | * mail/rfc2368.el (rfc2368-unhexify-char): Deleted. | ||
| 7 | (rfc2368-unhexify-string): Use replace-regexp-in-string. | ||
| 8 | |||
| 1 | 2004-03-07 Francis J. Wright <F.J.Wright@qmul.ac.uk> | 9 | 2004-03-07 Francis J. Wright <F.J.Wright@qmul.ac.uk> |
| 2 | 10 | ||
| 3 | * woman.el (woman-man.conf-path): Doc fix. | 11 | * woman.el (woman-man.conf-path): Doc fix. |
diff --git a/lisp/mail/rfc2368.el b/lisp/mail/rfc2368.el index 4bfeb911063..07ea44cef04 100644 --- a/lisp/mail/rfc2368.el +++ b/lisp/mail/rfc2368.el | |||
| @@ -76,39 +76,13 @@ | |||
| 76 | (defconst rfc2368-mailto-query-index 4 | 76 | (defconst rfc2368-mailto-query-index 4 |
| 77 | "Describes the portion of the url after '?'.") | 77 | "Describes the portion of the url after '?'.") |
| 78 | 78 | ||
| 79 | ;; for dealing w/ unhexifying strings, my preferred approach is to use | ||
| 80 | ;; a 'string-replace-match-using-function' which can perform a | ||
| 81 | ;; string-replace-match and compute the replacement text based on a | ||
| 82 | ;; passed function -- however, emacs doesn't seem to have such a | ||
| 83 | ;; function yet :-( | ||
| 84 | |||
| 85 | ;; for the moment a rip-off of url-unhex (w3/url.el) | ||
| 86 | (defun rfc2368-unhexify-char (char) | ||
| 87 | "Unhexify CHAR -- e.g. %20 -> <SPC>." | ||
| 88 | (if (> char ?9) | ||
| 89 | (if (>= char ?a) | ||
| 90 | (+ 10 (- char ?a)) | ||
| 91 | (+ 10 (- char ?A))) | ||
| 92 | (- char ?0))) | ||
| 93 | |||
| 94 | ;; for the moment a rip-off of url-unhex-string (w3/url.el) (slightly modified) | ||
| 95 | (defun rfc2368-unhexify-string (string) | 79 | (defun rfc2368-unhexify-string (string) |
| 96 | "Unhexify STRING -- e.g. 'hello%20there' -> 'hello there'." | 80 | "Unhexify STRING -- e.g. 'hello%20there' -> 'hello there'." |
| 97 | (let ((case-fold-search t) | 81 | (replace-regexp-in-string "%[[:xdigit:]]\\{2\\}" |
| 98 | (result "")) | 82 | (lambda (match) |
| 99 | (while (string-match "%[0-9a-f][0-9a-f]" string) | 83 | (string (string-to-number (substring match 1) |
| 100 | (let* ((start (match-beginning 0)) | 84 | 16))) |
| 101 | (hex-code (+ (* 16 | 85 | string t t)) |
| 102 | (rfc2368-unhexify-char (elt string (+ start 1)))) | ||
| 103 | (rfc2368-unhexify-char (elt string (+ start 2)))))) | ||
| 104 | (setq result (concat | ||
| 105 | result (substring string 0 start) | ||
| 106 | (char-to-string hex-code)) | ||
| 107 | string (substring string (match-end 0))))) | ||
| 108 | ;; it seems clearer to do things this way than to just return: | ||
| 109 | ;; (concat result string) | ||
| 110 | (setq result (concat result string)) | ||
| 111 | result)) | ||
| 112 | 86 | ||
| 113 | (defun rfc2368-parse-mailto-url (mailto-url) | 87 | (defun rfc2368-parse-mailto-url (mailto-url) |
| 114 | "Parse MAILTO-URL, and return an alist of header-name, header-value pairs. | 88 | "Parse MAILTO-URL, and return an alist of header-name, header-value pairs. |