Commit 450a0d96 authored by Johan Sundström's avatar Johan Sundström

Filtering out ugly mail signatures made easy.

parent 40835f51
2000-05-30 Johan Sundström <jhs@lysator.liu.se>
* view-text.el (lyskom-filter-signature-hook): New function. Would
probably be nice to add as a configuration option too, instead of
being just hookable. :-]
(lyskom-text-is-mail-p): New ad-hoc support function.
* swedish-strings.el, english-strings.el (lyskom-message): Added
the string reformat-signature.
2000-05-29 David Byers <davby@ida.liu.se>
* lyskom-rest.el (lyskom-is-loaded): Don't bind
......
......@@ -1237,6 +1237,8 @@ On since %#8s%#9s")
(reformat-truncated . "truncated")
(reformat-signature . "designed")
(need-library . "The \"%#1s\" package is required for this command.\n")
(calc-expression . "Expression: ")
......
......@@ -1241,7 +1241,9 @@ Uppkopplad sedan %#8s%#9s")
(reformat-filled . "ombruten")
(reformat-truncated . "nedkortad")
(reformat-signature . "avsignerad")
(need-library . "Paketet \"%#1s\" behvs fr att utfra detta kommando.\n")
(calc-expression . "Uttryck: ")
......
......@@ -334,6 +334,30 @@ Note that this function must not be called asynchronously."
todo))
(defun lyskom-text-is-mail-p (text-stat)
"Ad-hoc test to determine whether a text is a mail by peeking at aux-items."
(lyskom-match-aux-items
(text-stat->aux-items text-stat)
(lambda (aux-item)
(let ((tag (aux-item->tag aux-item)))
(or (and (> tag 15) ; 16:mx-author, 17:mx-from, 18:mx-reply-to,
(< tag 22)) ; 19:mx-to, 20:mx-cc, 21:mx-date,
(= 24 tag)))))) ; 24:mx-headers
(defun lyskom-filter-signature-hook ()
"Filter out the signature of imported mail messages. Most useful
when put in your `lyskom-view-text-hook'."
(unless (eq 'kom-review-noconversion lyskom-current-command)
(when (lyskom-text-is-mail-p text-stat)
(let* ((body (text->text-mass text))
(sign (string-match "^-- $" body)))
(when sign
(set-text->text-mass text (substring body 0 sign))
(lyskom-signal-reformatted-text 'reformat-signature))))))
;(add-hook 'lyskom-view-text-hook 'lyskom-filter-signature-hook)
(defun lyskom-follow-comments (text-stat conf-stat
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment