Mercurial > emacs
annotate lisp/gnus/rfc2231.el @ 68129:6f5da26b0df1
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-690
Merge from gnus--rel--5.10
Patches applied:
* gnus--rel--5.10 (patch 174-181)
- Update from CVS
- Update from CVS: texi/gnus.texi (RSS): Addition.
2006-01-10 Katsumi Yamaoka <yamaoka@jpl.org>
* lisp/gnus/nnrss.el (nnrss-wash-html-in-text-plain-parts): New variable.
(nnrss-request-article): Render text/plain parts as HTML.
* lisp/gnus/gnus-art.el (gnus-article-wash-html-with-w3m): No need to narrow
the buffer.
2006-01-08 Reiner Steib <Reiner.Steib@gmx.de>
* lisp/gnus/gnus-cus.el (gnus-group-parameters): Sync posting-style with
custom definition of `gnus-posting-styles'.
* lisp/gnus/gnus-start.el (gnus-gnus-to-quick-newsrc-format): Bind
print-circle. Suggested by Kalle Olavi Niemitalo <kon@iki.fi>.
2006-01-05 Reiner Steib <Reiner.Steib@gmx.de>
* lisp/gnus/gnus-group.el (gnus-useful-groups): Use Gmane for ding. Use
nntp for bug archive.
2006-01-05 Katsumi Yamaoka <yamaoka@jpl.org>
* lisp/gnus/nnrss.el (nnrss-request-article): Fix the way to fill text/plain
parts.
(nnrss-normalize-date): New function converts ISO 8601 date into
RFC822 style. Suggested by Mark Plaksin <happy@mcplaksin.org>.
(nnrss-check-group): Use it.
2006-01-03 Rodrigo Ventura <yoda@isr.ist.utl.pt> (tiny change)
* lisp/gnus/gnus-xmas.el (gnus-xmas-group-startup-message): Typo
gnus-splash-face -> gnus-splash. Fixes starting from a TTY in
XEmacs.
2006-01-01 Katsumi Yamaoka <yamaoka@jpl.org>
* lisp/gnus/gnus-sum.el (gnus-summary-work-articles): Remove useless `min'.
* lisp/gnus/nnrss.el (nnrss-fetch): Make it fail gracefully when it can't
fetch a feed. Suggested by Mark Plaksin <happy@mcplaksin.org>.
(nnrss-insert-w3): Ditto.
2005-12-21 Katsumi Yamaoka <yamaoka@jpl.org>
* lisp/gnus/nnrss.el (nnrss-request-article): Fix last change; fill
text/plain parts.
2005-12-20 Katsumi Yamaoka <yamaoka@jpl.org>
* lisp/gnus/nnrss.el (nnrss-request-article): Replace <br />s with newlines
in text/plain part.
(nnrss-check-group): Don't add excessive newline to dc:subject.
2005-12-19 Katsumi Yamaoka <yamaoka@jpl.org>
* lisp/gnus/gnus-art.el (gnus-article-delete-text-of-type): Enable it to
remove MIME buttons associated with multipart/alternative parts.
(gnus-mime-display-alternative): Tag buttons using `article-type'
text property.
* lisp/gnus/gnus-msg.el (gnus-copy-article-buffer): Remove MIME buttons
associated with multipart/alternative parts.
2005-12-19 Mark Plaksin <happy@mcplaksin.org> (tiny change)
* lisp/gnus/nnrss.el (nnrss-check-group): Put the RSS dc:subject in the
article.
2005-12-18 Lars Magne Ingebrigtsen <larsi@gnus.org>
* lisp/gnus/dns.el (query-dns): Make sure we check the buffer size before
removing tcp headers.
2006-01-10 Katsumi Yamaoka <yamaoka@jpl.org>
* man/gnus.texi (RSS): Document nnrss-wash-html-in-text-plain-parts.
2006-01-06 Katsumi Yamaoka <yamaoka@jpl.org>
* man/gnus.texi (RSS): Addition.
2005-12-22 Katsumi Yamaoka <yamaoka@jpl.org>
* man/gnus.texi (Summary Post Commands): Fix function bound to `S O p'.
2005-12-19 Katsumi Yamaoka <yamaoka@jpl.org>
* man/emacs-mime.texi (Display Customization): Add setting example to
mm-discouraged-alternatives.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 11 Jan 2006 02:03:24 +0000 |
parents | 28264c86d408 |
children | 5ea0e0a7dd38 7beb78bc1f8e |
rev | line source |
---|---|
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1 ;;; rfc2231.el --- Functions for decoding rfc2231 headers |
31717 | 2 |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64671
diff
changeset
|
3 ;; Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64671
diff
changeset
|
4 ;; 2005 Free Software Foundation, Inc. |
31717 | 5 |
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
22 ;; Boston, MA 02110-1301, USA. | |
31717 | 23 |
24 ;;; Commentary: | |
25 | |
26 ;;; Code: | |
27 | |
33121
228696a7231c
2000-11-01 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
31717
diff
changeset
|
28 (eval-when-compile (require 'cl)) |
31717 | 29 (require 'ietf-drums) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
30 (require 'rfc2047) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
31 (autoload 'mm-encode-body "mm-bodies") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
32 (autoload 'mail-header-remove-whitespace "mail-parse") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
33 (autoload 'mail-header-remove-comments "mail-parse") |
31717 | 34 |
35 (defun rfc2231-get-value (ct attribute) | |
36 "Return the value of ATTRIBUTE from CT." | |
37 (cdr (assq attribute (cdr ct)))) | |
38 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
39 (defun rfc2231-parse-qp-string (string) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
40 "Parse QP-encoded string using `rfc2231-parse-string'. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
41 N.B. This is in violation with RFC2047, but it seem to be in common use." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
42 (rfc2231-parse-string (rfc2047-decode-string string))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
43 |
31717 | 44 (defun rfc2231-parse-string (string) |
45 "Parse STRING and return a list. | |
46 The list will be on the form | |
47 `(name (attribute . value) (attribute . value)...)" | |
48 (with-temp-buffer | |
49 (let ((ttoken (ietf-drums-token-to-list ietf-drums-text-token)) | |
50 (stoken (ietf-drums-token-to-list ietf-drums-tspecials)) | |
51 (ntoken (ietf-drums-token-to-list "0-9")) | |
52 (prev-value "") | |
53 display-name mailbox c display-string parameters | |
54 attribute value type subtype number encoded | |
64671
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
55 prev-attribute prev-encoded) |
31717 | 56 (ietf-drums-init (mail-header-remove-whitespace |
57 (mail-header-remove-comments string))) | |
58 (let ((table (copy-syntax-table ietf-drums-syntax-table))) | |
59 (modify-syntax-entry ?\' "w" table) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
60 (modify-syntax-entry ?* " " table) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
61 (modify-syntax-entry ?\; " " table) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
62 (modify-syntax-entry ?= " " table) |
31717 | 63 ;; The following isn't valid, but one should be liberal |
64 ;; in what one receives. | |
65 (modify-syntax-entry ?\: "w" table) | |
66 (set-syntax-table table)) | |
67 (setq c (char-after)) | |
68 (when (and (memq c ttoken) | |
69 (not (memq c stoken))) | |
70 (setq type (downcase (buffer-substring | |
71 (point) (progn (forward-sexp 1) (point))))) | |
72 ;; Do the params | |
73 (while (not (eobp)) | |
74 (setq c (char-after)) | |
75 (unless (eq c ?\;) | |
76 (error "Invalid header: %s" string)) | |
77 (forward-char 1) | |
78 ;; If c in nil, then this is an invalid header, but | |
79 ;; since elm generates invalid headers on this form, | |
80 ;; we allow it. | |
81 (when (setq c (char-after)) | |
82 (if (and (memq c ttoken) | |
83 (not (memq c stoken))) | |
84 (setq attribute | |
85 (intern | |
86 (downcase | |
87 (buffer-substring | |
88 (point) (progn (forward-sexp 1) (point)))))) | |
89 (error "Invalid header: %s" string)) | |
90 (setq c (char-after)) | |
91 (when (eq c ?*) | |
92 (forward-char 1) | |
93 (setq c (char-after)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
94 (if (not (memq c ntoken)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
95 (setq encoded t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
96 number nil) |
31717 | 97 (setq number |
98 (string-to-number | |
99 (buffer-substring | |
100 (point) (progn (forward-sexp 1) (point))))) | |
101 (setq c (char-after)) | |
102 (when (eq c ?*) | |
103 (setq encoded t) | |
104 (forward-char 1) | |
105 (setq c (char-after))))) | |
106 ;; See if we have any previous continuations. | |
107 (when (and prev-attribute | |
108 (not (eq prev-attribute attribute))) | |
64671
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
109 (push (cons prev-attribute |
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
110 (if prev-encoded |
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
111 (rfc2231-decode-encoded-string prev-value) |
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
112 prev-value)) |
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
113 parameters) |
31717 | 114 (setq prev-attribute nil |
64671
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
115 prev-value "" |
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
116 prev-encoded nil)) |
31717 | 117 (unless (eq c ?=) |
118 (error "Invalid header: %s" string)) | |
119 (forward-char 1) | |
120 (setq c (char-after)) | |
121 (cond | |
122 ((eq c ?\") | |
123 (setq value | |
124 (buffer-substring (1+ (point)) | |
125 (progn (forward-sexp 1) (1- (point)))))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
126 ((and (or (memq c ttoken) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
127 (> c ?\177)) ;; EXTENSION: Support non-ascii chars. |
31717 | 128 (not (memq c stoken))) |
129 (setq value (buffer-substring | |
67418
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
130 (point) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
131 (progn |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
132 (forward-sexp) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
133 ;; We might not have reached at the end of |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
134 ;; the value because of non-ascii chars, |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
135 ;; so we should jump over them if any. |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
136 (while (and (not (eobp)) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
137 (> (char-after) ?\177)) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
138 (forward-char 1) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
139 (forward-sexp)) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
140 (point))))) |
31717 | 141 (t |
142 (error "Invalid header: %s" string))) | |
143 (if number | |
144 (setq prev-attribute attribute | |
64671
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
145 prev-value (concat prev-value value) |
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
146 prev-encoded encoded) |
59089
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
147 (push (cons attribute |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
148 (if encoded |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
149 (rfc2231-decode-encoded-string value) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
150 value)) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
151 parameters)))) |
31717 | 152 |
153 ;; Take care of any final continuations. | |
154 (when prev-attribute | |
59089
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
155 (push (cons prev-attribute |
64671
89073e52939c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-503
Miles Bader <miles@gnu.org>
parents:
64085
diff
changeset
|
156 (if prev-encoded |
59089
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
157 (rfc2231-decode-encoded-string prev-value) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
158 prev-value)) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
56927
diff
changeset
|
159 parameters)) |
31717 | 160 |
161 (when type | |
162 `(,type ,@(nreverse parameters))))))) | |
163 | |
164 (defun rfc2231-decode-encoded-string (string) | |
165 "Decode an RFC2231-encoded string. | |
166 These look like \"us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A\"." | |
167 (with-temp-buffer | |
168 (let ((elems (split-string string "'"))) | |
169 ;; The encoded string may contain zero to two single-quote | |
170 ;; marks. This should give us the encoded word stripped | |
171 ;; of any preceding values. | |
172 (insert (car (last elems))) | |
173 (goto-char (point-min)) | |
174 (while (search-forward "%" nil t) | |
175 (insert | |
176 (prog1 | |
177 (string-to-number (buffer-substring (point) (+ (point) 2)) 16) | |
178 (delete-region (1- (point)) (+ (point) 2))))) | |
179 ;; Encode using the charset, if any. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
180 (when (and (mm-multibyte-p) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
181 (> (length elems) 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
182 (not (equal (intern (downcase (car elems))) 'us-ascii))) |
31717 | 183 (mm-decode-coding-region (point-min) (point-max) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
184 (intern (downcase (car elems))))) |
31717 | 185 (buffer-string)))) |
186 | |
187 (defun rfc2231-encode-string (param value) | |
188 "Return and PARAM=VALUE string encoded according to RFC2231." | |
189 (let ((control (ietf-drums-token-to-list ietf-drums-no-ws-ctl-token)) | |
190 (tspecial (ietf-drums-token-to-list ietf-drums-tspecials)) | |
191 (special (ietf-drums-token-to-list "*'%\n\t")) | |
192 (ascii (ietf-drums-token-to-list ietf-drums-text-token)) | |
193 (num -1) | |
194 spacep encodep charsetp charset broken) | |
195 (with-temp-buffer | |
196 (insert value) | |
197 (goto-char (point-min)) | |
198 (while (not (eobp)) | |
199 (cond | |
200 ((or (memq (following-char) control) | |
201 (memq (following-char) tspecial) | |
202 (memq (following-char) special)) | |
203 (setq encodep t)) | |
204 ((eq (following-char) ? ) | |
205 (setq spacep t)) | |
206 ((not (memq (following-char) ascii)) | |
207 (setq charsetp t))) | |
208 (forward-char 1)) | |
209 (when charsetp | |
210 (setq charset (mm-encode-body))) | |
211 (cond | |
212 ((or encodep charsetp) | |
213 (goto-char (point-min)) | |
214 (while (not (eobp)) | |
215 (when (> (current-column) 60) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
216 (insert ";\n") |
31717 | 217 (setq broken t)) |
218 (if (or (not (memq (following-char) ascii)) | |
219 (memq (following-char) control) | |
220 (memq (following-char) tspecial) | |
221 (memq (following-char) special) | |
222 (eq (following-char) ? )) | |
223 (progn | |
224 (insert "%" (format "%02x" (following-char))) | |
225 (delete-char 1)) | |
226 (forward-char 1))) | |
227 (goto-char (point-min)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
228 (insert (symbol-name (or charset 'us-ascii)) "''") |
31717 | 229 (goto-char (point-min)) |
230 (if (not broken) | |
231 (insert param "*=") | |
232 (while (not (eobp)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
233 (insert (if (>= num 0) " " "\n ") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
234 param "*" (format "%d" (incf num)) "*=") |
31717 | 235 (forward-line 1)))) |
236 (spacep | |
237 (goto-char (point-min)) | |
238 (insert param "=\"") | |
239 (goto-char (point-max)) | |
240 (insert "\"")) | |
241 (t | |
242 (goto-char (point-min)) | |
243 (insert param "="))) | |
244 (buffer-string)))) | |
245 | |
246 (provide 'rfc2231) | |
247 | |
52401 | 248 ;;; arch-tag: c3ab751d-d108-406a-b301-68882ad8cd63 |
31717 | 249 ;;; rfc2231.el ends here |