Mercurial > emacs
annotate lisp/gnus/rfc2231.el @ 70511:cd1e2cf9f28c
* xresmini.texi (GTK resources): Inserted GTK description.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sun, 07 May 2006 19:39:28 +0000 |
parents | 26ee9321c6d7 |
children | cac840c3298d e6bf73e43cf4 |
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 |
68606
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
3 ;; Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
4 ;; 2006 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 |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
44 (defun rfc2231-parse-string (string &optional signal-error) |
31717 | 45 "Parse STRING and return a list. |
46 The list will be on the form | |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
47 `(name (attribute . value) (attribute . value)...)'. |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
48 |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
49 If the optional SIGNAL-ERROR is non-nil, signal an error when this |
68940
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
50 function fails in parsing of parameters. Otherwise, this function |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
51 must never cause a Lisp error." |
31717 | 52 (with-temp-buffer |
53 (let ((ttoken (ietf-drums-token-to-list ietf-drums-text-token)) | |
54 (stoken (ietf-drums-token-to-list ietf-drums-tspecials)) | |
55 (ntoken (ietf-drums-token-to-list "0-9")) | |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
56 c type attribute encoded number prev-attribute vals |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
57 prev-encoded parameters value) |
68940
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
58 (ietf-drums-init |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
59 (condition-case nil |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
60 (mail-header-remove-whitespace |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
61 (mail-header-remove-comments string)) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
62 ;; The most likely cause of an error is unbalanced parentheses |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
63 ;; or double-quotes. If all parentheses and double-quotes are |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
64 ;; quoted meaninglessly with backslashes, removing them might |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
65 ;; make it parseable. Let's try... |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
66 (error |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
67 (let (mod) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
68 (when (and (string-match "\\\\\"" string) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
69 (not (string-match "\\`\"\\|[^\\]\"" string))) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
70 (setq string (mm-replace-in-string string "\\\\\"" "\"") |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
71 mod t)) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
72 (when (and (string-match "\\\\(" string) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
73 (string-match "\\\\)" string) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
74 (not (string-match "\\`(\\|[^\\][()]" string))) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
75 (setq string (mm-replace-in-string string "\\\\\\([()]\\)" "\\1") |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
76 mod t)) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
77 (or (and mod |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
78 (ignore-errors |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
79 (mail-header-remove-whitespace |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
80 (mail-header-remove-comments string)))) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
81 ;; Finally, attempt to extract only type. |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
82 (if (string-match |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
83 (concat "\\`[\t\n ]*\\([^" ietf-drums-tspecials "\t\n ]+" |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
84 "\\(/[^" ietf-drums-tspecials |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
85 "\t\n ]+\\)?\\)\\([\t\n ;]\\|\\'\\)") |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
86 string) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
87 (match-string 1 string) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
88 "")))))) |
31717 | 89 (let ((table (copy-syntax-table ietf-drums-syntax-table))) |
90 (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
|
91 (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
|
92 (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
|
93 (modify-syntax-entry ?= " " table) |
31717 | 94 ;; The following isn't valid, but one should be liberal |
95 ;; in what one receives. | |
96 (modify-syntax-entry ?\: "w" table) | |
97 (set-syntax-table table)) | |
98 (setq c (char-after)) | |
99 (when (and (memq c ttoken) | |
68940
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
100 (not (memq c stoken)) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
101 (setq type (ignore-errors |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
102 (downcase |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
103 (buffer-substring (point) (progn |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
104 (forward-sexp 1) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
105 (point))))))) |
31717 | 106 ;; Do the params |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
107 (condition-case err |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
108 (progn |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
109 (while (not (eobp)) |
31717 | 110 (setq c (char-after)) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
111 (unless (eq c ?\;) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
112 (error "Invalid header: %s" string)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
113 (forward-char 1) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
114 ;; If c in nil, then this is an invalid header, but |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
115 ;; since elm generates invalid headers on this form, |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
116 ;; we allow it. |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
117 (when (setq c (char-after)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
118 (if (and (memq c ttoken) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
119 (not (memq c stoken))) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
120 (setq attribute |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
121 (intern |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
122 (downcase |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
123 (buffer-substring |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
124 (point) (progn (forward-sexp 1) (point)))))) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
125 (error "Invalid header: %s" string)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
126 (setq c (char-after)) |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
127 (if (eq c ?*) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
128 (progn |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
129 (forward-char 1) |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
130 (setq c (char-after)) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
131 (if (not (memq c ntoken)) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
132 (setq encoded t |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
133 number nil) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
134 (setq number |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
135 (string-to-number |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
136 (buffer-substring |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
137 (point) (progn (forward-sexp 1) (point))))) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
138 (setq c (char-after)) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
139 (when (eq c ?*) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
140 (setq encoded t) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
141 (forward-char 1) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
142 (setq c (char-after))))) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
143 (setq number nil |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
144 encoded nil)) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
145 ;; See if we have any previous continuations. |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
146 (when (and prev-attribute |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
147 (not (eq prev-attribute attribute))) |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
148 (setq vals |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
149 (mapconcat 'cdr (sort vals 'car-less-than-car) "")) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
150 (push (cons prev-attribute |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
151 (if prev-encoded |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
152 (rfc2231-decode-encoded-string vals) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
153 vals)) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
154 parameters) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
155 (setq prev-attribute nil |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
156 vals nil |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
157 prev-encoded nil)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
158 (unless (eq c ?=) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
159 (error "Invalid header: %s" string)) |
31717 | 160 (forward-char 1) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
161 (setq c (char-after)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
162 (cond |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
163 ((eq c ?\") |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
164 (setq value (buffer-substring (1+ (point)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
165 (progn |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
166 (forward-sexp 1) |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
167 (1- (point))))) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
168 (when encoded |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
169 (setq value (mapconcat (lambda (c) (format "%%%02x" c)) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
170 value "")))) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
171 ((and (or (memq c ttoken) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
172 ;; EXTENSION: Support non-ascii chars. |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
173 (> c ?\177)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
174 (not (memq c stoken))) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
175 (setq value |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
176 (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
|
177 (point) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
178 (progn |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
179 (forward-sexp) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
180 ;; 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
|
181 ;; 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
|
182 ;; 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
|
183 (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
|
184 (> (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
|
185 (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
|
186 (forward-sexp)) |
28264c86d408
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-668
Miles Bader <miles@gnu.org>
parents:
64754
diff
changeset
|
187 (point))))) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
188 (t |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
189 (error "Invalid header: %s" string))) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
190 (if number |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
191 (progn |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
192 (push (cons number value) vals) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
193 (setq prev-attribute attribute |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
194 prev-encoded encoded)) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
195 (push (cons attribute |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
196 (if encoded |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
197 (rfc2231-decode-encoded-string value) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
198 value)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
199 parameters)))) |
31717 | 200 |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
201 ;; Take care of any final continuations. |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
202 (when prev-attribute |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
203 (setq vals (mapconcat 'cdr (sort vals 'car-less-than-car) "")) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
204 (push (cons prev-attribute |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
205 (if prev-encoded |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
206 (rfc2231-decode-encoded-string vals) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
207 vals)) |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
208 parameters))) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
209 (error |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
210 (setq parameters nil) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
211 (if signal-error |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
212 (signal (car err) (cdr err)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
213 ;;(message "%s" (error-message-string err)) |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
214 ))) |
31717 | 215 |
68940
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68762
diff
changeset
|
216 (cons type (nreverse parameters)))))) |
31717 | 217 |
218 (defun rfc2231-decode-encoded-string (string) | |
219 "Decode an RFC2231-encoded string. | |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
220 These look like: |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
221 \"us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A\", |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
222 \"us-ascii''This%20is%20%2A%2A%2Afun%2A%2A%2A\", |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
223 \"'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A\", |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
224 \"''This%20is%20%2A%2A%2Afun%2A%2A%2A\", or |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
225 \"This is ***fun***\"." |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
226 (string-match "\\`\\(\\([^']+\\)?'\\([^']+\\)?'\\)?\\(.+\\)" string) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
227 (let ((coding-system (mm-charset-to-coding-system (match-string 2 string))) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
228 ;;(language (match-string 3 string)) |
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
229 (value (match-string 4 string))) |
69640
69cdb1e84c38
(rfc2231-decode-encoded-string): Work on unibyte
Kenichi Handa <handa@m17n.org>
parents:
68940
diff
changeset
|
230 (mm-with-unibyte-buffer |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
231 (insert value) |
31717 | 232 (goto-char (point-min)) |
233 (while (search-forward "%" nil t) | |
234 (insert | |
235 (prog1 | |
236 (string-to-number (buffer-substring (point) (+ (point) 2)) 16) | |
237 (delete-region (1- (point)) (+ (point) 2))))) | |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
238 ;; Decode using the charset, if any. |
69640
69cdb1e84c38
(rfc2231-decode-encoded-string): Work on unibyte
Kenichi Handa <handa@m17n.org>
parents:
68940
diff
changeset
|
239 (if (memq coding-system '(nil ascii)) |
69cdb1e84c38
(rfc2231-decode-encoded-string): Work on unibyte
Kenichi Handa <handa@m17n.org>
parents:
68940
diff
changeset
|
240 (buffer-string) |
69cdb1e84c38
(rfc2231-decode-encoded-string): Work on unibyte
Kenichi Handa <handa@m17n.org>
parents:
68940
diff
changeset
|
241 (mm-decode-coding-string (buffer-string) coding-system))))) |
31717 | 242 |
243 (defun rfc2231-encode-string (param value) | |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
244 "Return and PARAM=VALUE string encoded according to RFC2231. |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
245 Use `mml-insert-parameter' or `mml-insert-parameter-string' to insert |
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
246 the result of this function." |
31717 | 247 (let ((control (ietf-drums-token-to-list ietf-drums-no-ws-ctl-token)) |
248 (tspecial (ietf-drums-token-to-list ietf-drums-tspecials)) | |
249 (special (ietf-drums-token-to-list "*'%\n\t")) | |
250 (ascii (ietf-drums-token-to-list ietf-drums-text-token)) | |
251 (num -1) | |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
252 ;; Don't make lines exceeding 76 column. |
68606
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
253 (limit (- 74 (length param))) |
31717 | 254 spacep encodep charsetp charset broken) |
69640
69cdb1e84c38
(rfc2231-decode-encoded-string): Work on unibyte
Kenichi Handa <handa@m17n.org>
parents:
68940
diff
changeset
|
255 (mm-with-multibyte-buffer |
31717 | 256 (insert value) |
257 (goto-char (point-min)) | |
258 (while (not (eobp)) | |
259 (cond | |
260 ((or (memq (following-char) control) | |
261 (memq (following-char) tspecial) | |
262 (memq (following-char) special)) | |
263 (setq encodep t)) | |
264 ((eq (following-char) ? ) | |
265 (setq spacep t)) | |
266 ((not (memq (following-char) ascii)) | |
267 (setq charsetp t))) | |
268 (forward-char 1)) | |
269 (when charsetp | |
270 (setq charset (mm-encode-body))) | |
69644
26ee9321c6d7
(rfc2231-encode-string): Use mm-disable-multibyte
Kenichi Handa <handa@m17n.org>
parents:
69640
diff
changeset
|
271 (mm-disable-multibyte) |
31717 | 272 (cond |
68606
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
273 ((or encodep charsetp |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
274 (progn |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
275 (end-of-line) |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
276 (> (current-column) (if spacep (- limit 2) limit)))) |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
277 (setq limit (- limit 6)) |
31717 | 278 (goto-char (point-min)) |
68606
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
279 (insert (symbol-name (or charset 'us-ascii)) "''") |
31717 | 280 (while (not (eobp)) |
281 (if (or (not (memq (following-char) ascii)) | |
282 (memq (following-char) control) | |
283 (memq (following-char) tspecial) | |
284 (memq (following-char) special) | |
285 (eq (following-char) ? )) | |
286 (progn | |
68606
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
287 (when (>= (current-column) (1- limit)) |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
288 (insert ";\n") |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
289 (setq broken t)) |
31717 | 290 (insert "%" (format "%02x" (following-char))) |
291 (delete-char 1)) | |
68606
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
292 (when (> (current-column) limit) |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
293 (insert ";\n") |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
67418
diff
changeset
|
294 (setq broken t)) |
31717 | 295 (forward-char 1))) |
296 (goto-char (point-min)) | |
297 (if (not broken) | |
298 (insert param "*=") | |
299 (while (not (eobp)) | |
68720
d9dde5b81e71
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-57
Miles Bader <miles@gnu.org>
parents:
68606
diff
changeset
|
300 (insert (if (>= num 0) " " "") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
301 param "*" (format "%d" (incf num)) "*=") |
31717 | 302 (forward-line 1)))) |
303 (spacep | |
304 (goto-char (point-min)) | |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
305 (insert param "=\"") |
31717 | 306 (goto-char (point-max)) |
307 (insert "\"")) | |
308 (t | |
309 (goto-char (point-min)) | |
68762
970bf6e6463b
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-62
Miles Bader <miles@gnu.org>
parents:
68720
diff
changeset
|
310 (insert param "="))) |
31717 | 311 (buffer-string)))) |
312 | |
313 (provide 'rfc2231) | |
314 | |
52401 | 315 ;;; arch-tag: c3ab751d-d108-406a-b301-68882ad8cd63 |
31717 | 316 ;;; rfc2231.el ends here |