diff options
| author | Richard M. Stallman | 2004-03-04 17:02:13 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-03-04 17:02:13 +0000 |
| commit | 926f20041fc4d5cdaa94737117a236be2744cd02 (patch) | |
| tree | e9ee1551ccbf8d37e72f89a34634224436eed82f | |
| parent | 5bb54c616f442f29e9241bd920a15f8a4d5f0432 (diff) | |
| download | emacs-926f20041fc4d5cdaa94737117a236be2744cd02.tar.gz emacs-926f20041fc4d5cdaa94737117a236be2744cd02.zip | |
(mail-unquote-printable-region): New arg UNIBYTE.
| -rw-r--r-- | lisp/mail/mail-utils.el | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el index 96a57b38f07..aecc87cf178 100644 --- a/lisp/mail/mail-utils.el +++ b/lisp/mail/mail-utils.el | |||
| @@ -108,11 +108,15 @@ we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=." | |||
| 108 | (apply 'concat (nreverse (cons (substring string i) strings)))))) | 108 | (apply 'concat (nreverse (cons (substring string i) strings)))))) |
| 109 | 109 | ||
| 110 | ;;;###autoload | 110 | ;;;###autoload |
| 111 | (defun mail-unquote-printable-region (beg end &optional wrapper noerror) | 111 | (defun mail-unquote-printable-region (beg end &optional wrapper noerror |
| 112 | unibyte) | ||
| 112 | "Undo the \"quoted printable\" encoding in buffer from BEG to END. | 113 | "Undo the \"quoted printable\" encoding in buffer from BEG to END. |
| 113 | If the optional argument WRAPPER is non-nil, | 114 | If the optional argument WRAPPER is non-nil, |
| 114 | we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=. | 115 | we expect to find and remove the wrapper characters =?ISO-8859-1?Q?....?=. |
| 115 | If NOERROR is non-nil, return t if successful." | 116 | If NOERROR is non-nil, return t if successful. |
| 117 | If UNIBYTE is non-nil, insert converted characters as unibyte. | ||
| 118 | That is useful if you are going to character code decoding afterward, | ||
| 119 | as Rmail does." | ||
| 116 | (interactive "r\nP") | 120 | (interactive "r\nP") |
| 117 | (let (failed) | 121 | (let (failed) |
| 118 | (save-match-data | 122 | (save-match-data |
| @@ -131,13 +135,16 @@ If NOERROR is non-nil, return t if successful." | |||
| 131 | ((= (char-after (match-beginning 1)) ?=) | 135 | ((= (char-after (match-beginning 1)) ?=) |
| 132 | (replace-match "=")) | 136 | (replace-match "=")) |
| 133 | ((match-beginning 2) | 137 | ((match-beginning 2) |
| 134 | (replace-match | 138 | (let ((char (+ (* 16 (mail-unquote-printable-hexdigit |
| 135 | (make-string 1 | 139 | (char-after (match-beginning 2)))) |
| 136 | (+ (* 16 (mail-unquote-printable-hexdigit | 140 | (mail-unquote-printable-hexdigit |
| 137 | (char-after (match-beginning 2)))) | 141 | (char-after (1+ (match-beginning 2))))))) |
| 138 | (mail-unquote-printable-hexdigit | 142 | (if unibyte |
| 139 | (char-after (1+ (match-beginning 2)))))) | 143 | (progn |
| 140 | t t)) | 144 | (replace-match "") |
| 145 | ;; insert-char will insert this as unibyte, | ||
| 146 | (insert-char char 1)) | ||
| 147 | (replace-match (make-string 1 char) t t)))) | ||
| 141 | (noerror | 148 | (noerror |
| 142 | (setq failed t)) | 149 | (setq failed t)) |
| 143 | (t | 150 | (t |