aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-06-24 07:43:26 +0000
committerRichard M. Stallman1995-06-24 07:43:26 +0000
commit5f98a1d819065593407e75bfbeec7c0e43908bde (patch)
treeeb00afe2a9b356db866ae99d638d036616e161dd
parent3fc9add97b53ce1dd2f972926d3155cc4eaceafe (diff)
downloademacs-5f98a1d819065593407e75bfbeec7c0e43908bde.tar.gz
emacs-5f98a1d819065593407e75bfbeec7c0e43908bde.zip
(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.
-rw-r--r--lisp/mail/mail-hist.el20
1 files changed, 15 insertions, 5 deletions
diff --git a/lisp/mail/mail-hist.el b/lisp/mail/mail-hist.el
index fa0db93e2c0..88ccd0dcc1d 100644
--- a/lisp/mail/mail-hist.el
+++ b/lisp/mail/mail-hist.el
@@ -180,12 +180,24 @@ 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.
185If 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.
189The 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.
185Optional argument CONTENTS is a string which will be the contents 195Optional 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:
@@ -193,9 +205,7 @@ Optional argument CONTENTS is a string which will be the contents
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 ()