Mercurial > emacs
comparison lisp/mail/mail-hist.el @ 12374:5888dd3f1a72
(mail-hist-text-size-limit): New var.
(mail-hist-text-too-long-p): New func.
(mail-hist-add-header-contents-to-ring): call above; if the text is
too long, then store the empty string in the history.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 24 Jun 1995 07:43:26 +0000 |
parents | 8415d665d19f |
children | 83f275dcd93a |
comparison
equal
deleted
inserted
replaced
12373:58b96b3c285e | 12374:5888dd3f1a72 |
---|---|
178 "Get HEADER's history ring, or nil if none. | 178 "Get HEADER's history ring, or nil if none. |
179 HEADER is a string without the colon." | 179 HEADER is a string without the colon." |
180 (setq header (downcase header)) | 180 (setq header (downcase header)) |
181 (cdr (assoc header mail-hist-header-ring-alist))) | 181 (cdr (assoc header mail-hist-header-ring-alist))) |
182 | 182 |
183 (defvar mail-hist-text-size-limit nil | |
184 "*Don't store any header or body with more than this many characters. | |
185 If the value is nil, that means no limit on text size.") | |
186 | |
187 (defun mail-hist-text-too-long-p (text) | |
188 "Return t if TEXT does not exceed mail-hist's size limit. | |
189 The variable `mail-hist-text-size-limit' defines this limit." | |
190 (if mail-hist-text-size-limit | |
191 (> (length text) mail-hist-text-size-limit))) | |
192 | |
183 (defsubst mail-hist-add-header-contents-to-ring (header &optional contents) | 193 (defsubst mail-hist-add-header-contents-to-ring (header &optional contents) |
184 "Add the contents of HEADER to the header history ring. | 194 "Add the contents of HEADER to the header history ring. |
185 Optional argument CONTENTS is a string which will be the contents | 195 Optional argument CONTENTS is a string which will be the contents |
186 (instead of whatever's found in the header)." | 196 \(instead of whatever's found in the header)." |
187 (setq header (downcase header)) | 197 (setq header (downcase header)) |
188 (let ((ring (cdr (assoc header mail-hist-header-ring-alist)))) | 198 (let ((ctnts (or contents (mail-hist-current-header-contents))) |
199 (ring (cdr (assoc header mail-hist-header-ring-alist)))) | |
200 (if (mail-hist-text-too-long-p ctnts) (setq ctnts "")) | |
189 (or ring | 201 (or ring |
190 ;; If the ring doesn't exist, we'll have to make it and add it | 202 ;; If the ring doesn't exist, we'll have to make it and add it |
191 ;; to the mail-header-ring-alist: | 203 ;; to the mail-header-ring-alist: |
192 (prog1 | 204 (prog1 |
193 (setq ring (make-ring mail-hist-history-size)) | 205 (setq ring (make-ring mail-hist-history-size)) |
194 (setq mail-hist-header-ring-alist | 206 (setq mail-hist-header-ring-alist |
195 (cons (cons header ring) mail-hist-header-ring-alist)))) | 207 (cons (cons header ring) mail-hist-header-ring-alist)))) |
196 (ring-insert | 208 (ring-insert ring ctnts))) |
197 ring | |
198 (or contents (mail-hist-current-header-contents))))) | |
199 | 209 |
200 ;;;###autoload | 210 ;;;###autoload |
201 (defun mail-hist-put-headers-into-history () | 211 (defun mail-hist-put-headers-into-history () |
202 "Put headers and contents of this message into mail header history. | 212 "Put headers and contents of this message into mail header history. |
203 Each header has its own independent history, as does the body of the | 213 Each header has its own independent history, as does the body of the |