diff options
| author | Richard M. Stallman | 1998-08-01 19:12:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-08-01 19:12:59 +0000 |
| commit | 68cf9ca116f5ac764e922b4043898e649f5dc95d (patch) | |
| tree | e4ba521cb30e1a9184ed8a4d659d34152d177cac | |
| parent | 8761c2c46b673eae54d0fd6d97641e7d74c303dd (diff) | |
| download | emacs-68cf9ca116f5ac764e922b4043898e649f5dc95d.tar.gz emacs-68cf9ca116f5ac764e922b4043898e649f5dc95d.zip | |
(mail-header-format): Convert string to symbol.
| -rw-r--r-- | lisp/mail/mailheader.el | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lisp/mail/mailheader.el b/lisp/mail/mailheader.el index 142b29c4f35..8ec06d64f74 100644 --- a/lisp/mail/mailheader.el +++ b/lisp/mail/mailheader.el | |||
| @@ -150,19 +150,30 @@ skip the header altogether if there are no other elements. | |||
| 150 | 150 | ||
| 151 | (defun mail-header-format (format-rules headers) | 151 | (defun mail-header-format (format-rules headers) |
| 152 | "Use FORMAT-RULES to format HEADERS and insert into current buffer. | 152 | "Use FORMAT-RULES to format HEADERS and insert into current buffer. |
| 153 | FORMAT-RULES is an alist whose keys are header names (symbols), and whose | 153 | HEADERS should be an alist of the form (HEADER . VALUE), |
| 154 | values are functions that format the header, the results of which are | 154 | where HEADER is a header field name (a symbol or a string), |
| 155 | inserted, unless it is nil. The function takes two arguments, the header | 155 | and VALUE is the contents for that header field. |
| 156 | symbol, and the value of that header. If the function itself is nil, the | 156 | |
| 157 | default action is to insert the value of the header, unless it is nil. | 157 | FORMAT-RULES is an alist of elements (HEADER . FUNCTION) Here HEADER |
| 158 | is a header field name (a symbol), and FUNCTION is how to format that | ||
| 159 | header field, if it appears in HEADERS. Each FUNCTION should take two | ||
| 160 | arguments: the header symbol, and the value of that header. The value | ||
| 161 | returned by FUNCTION is inserted in the buffer unless it is nil. | ||
| 162 | |||
| 163 | If the function for a header field is nil, or if no function is | ||
| 164 | specified for a particular header field, the default action is to | ||
| 165 | insert the value of the header, unless it is nil. | ||
| 166 | |||
| 158 | The headers are inserted in the order of the FORMAT-RULES. | 167 | The headers are inserted in the order of the FORMAT-RULES. |
| 159 | A key of t represents any otherwise unmentioned headers. | 168 | A key of t in FORMAT-RULES. represents any otherwise unmentioned headers. |
| 160 | A key of nil has as its value a list of defaulted headers to ignore." | 169 | A key of nil has as its value a list of defaulted headers to ignore." |
| 161 | (let ((ignore (append (cdr (assq nil format-rules)) | 170 | (let ((ignore (append (cdr (assq nil format-rules)) |
| 162 | (mapcar #'car format-rules)))) | 171 | (mapcar #'car format-rules)))) |
| 163 | (dolist (rule format-rules) | 172 | (dolist (rule format-rules) |
| 164 | (let* ((header (car rule)) | 173 | (let* ((header (car rule)) |
| 165 | (value (mail-header header))) | 174 | (value (mail-header header))) |
| 175 | (if (stringp header) | ||
| 176 | (setq header (intern header))) | ||
| 166 | (cond ((null header) 'ignore) | 177 | (cond ((null header) 'ignore) |
| 167 | ((eq header t) | 178 | ((eq header t) |
| 168 | (dolist (defaulted headers) | 179 | (dolist (defaulted headers) |
| @@ -171,11 +182,11 @@ A key of nil has as its value a list of defaulted headers to ignore." | |||
| 171 | (value (cdr defaulted))) | 182 | (value (cdr defaulted))) |
| 172 | (if (cdr rule) | 183 | (if (cdr rule) |
| 173 | (funcall (cdr rule) header value) | 184 | (funcall (cdr rule) header value) |
| 174 | (funcall mail-header-format-function header value)))))) | 185 | (funcall mail-header-format-function header value)))))) |
| 175 | (value | 186 | (value |
| 176 | (if (cdr rule) | 187 | (if (cdr rule) |
| 177 | (funcall (cdr rule) header value) | 188 | (funcall (cdr rule) header value) |
| 178 | (funcall mail-header-format-function header value)))))) | 189 | (funcall mail-header-format-function header value)))))) |
| 179 | (insert "\n"))) | 190 | (insert "\n"))) |
| 180 | 191 | ||
| 181 | (provide 'mailheader) | 192 | (provide 'mailheader) |