Mercurial > emacs
comparison lisp/mail/undigest.el @ 27375:517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Allows multiple regexps for detecting the end line.
(undigestify-rmail-message): Corresponding changes.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 21 Jan 2000 02:04:16 +0000 |
parents | 7d643cf235ad |
children | 549ccf34df84 |
comparison
equal
deleted
inserted
replaced
27374:0f5edee5242b | 27375:517cdf51989f |
---|---|
28 | 28 |
29 ;;; Code: | 29 ;;; Code: |
30 | 30 |
31 (require 'rmail) | 31 (require 'rmail) |
32 | 32 |
33 (defcustom rmail-digest-end-regexp (concat "End of.*Digest.*\n" | 33 (defcustom rmail-digest-end-regexps |
34 (regexp-quote "*********") "*" | 34 (list (concat "End of.*Digest.*\n" |
35 "\\(\n------*\\)*") | 35 (regexp-quote "*********") "*" |
36 "*Regexp matching the end of a digest message." | 36 "\\(\n------*\\)*") |
37 (concat "End of.*\n" | |
38 (regexp-quote "*") "*")) | |
39 "*Regexps matching the end of a digest message." | |
37 :group 'rmail | 40 :group 'rmail |
38 :type 'regexp) | 41 :type '(repeat regexp)) |
39 | 42 |
40 ;;;###autoload | 43 ;;;###autoload |
41 (defun undigestify-rmail-message () | 44 (defun undigestify-rmail-message () |
42 "Break up a digest message into its constituent messages. | 45 "Break up a digest message into its constituent messages. |
43 Leaves original message, deleted, before the undigestified messages." | 46 Leaves original message, deleted, before the undigestified messages." |
77 (mail-fetch-field "To") | 80 (mail-fetch-field "To") |
78 (mail-fetch-field "Apparently-To") | 81 (mail-fetch-field "Apparently-To") |
79 (mail-fetch-field "From"))) | 82 (mail-fetch-field "From"))) |
80 (error "Message is not a digest--bad header"))))) | 83 (error "Message is not a digest--bad header"))))) |
81 (save-excursion | 84 (save-excursion |
82 (goto-char (point-max)) | 85 (let (found |
83 (skip-chars-backward " \t\n") | 86 (regexps rmail-digest-end-regexps)) |
84 (let (found) | 87 (while (and regexps (not found)) |
85 ;; compensate for broken un*x digestifiers. Sigh Sigh. | 88 (goto-char (point-max)) |
86 (while (and (> (point) start) (not found)) | 89 (skip-chars-backward " \t\n") |
87 (forward-line -1) | 90 ;; compensate for broken un*x digestifiers. Sigh Sigh. |
88 (if (looking-at rmail-digest-end-regexp) | 91 (while (and (> (point) start) (not found)) |
89 (setq found t))) | 92 (forward-line -1) |
90 (if (not found) | 93 (if (looking-at (car regexps)) |
91 (error "Message is not a digest--no end line")))) | 94 (setq found t)) |
95 (setq regexps (cdr regexps))) | |
96 (unless found | |
97 (error "Message is not a digest--no end line")))) | |
92 (re-search-forward (concat "^" (make-string 55 ?-) "-*\n*")) | 98 (re-search-forward (concat "^" (make-string 55 ?-) "-*\n*")) |
93 (replace-match "\^_\^L\n0, unseen,,\n*** EOOH ***\n") | 99 (replace-match "\^_\^L\n0, unseen,,\n*** EOOH ***\n") |
94 (save-restriction | 100 (save-restriction |
95 (narrow-to-region (point) | 101 (narrow-to-region (point) |
96 (progn (search-forward "\n\n") | 102 (progn (search-forward "\n\n") |