summaryrefslogtreecommitdiff
path: root/lisp/mail
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/rmail.el4
-rw-r--r--lisp/mail/rmailmm.el81
-rw-r--r--lisp/mail/smtpmail.el1
3 files changed, 62 insertions, 24 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index ffb52683bd7..139b7cf926a 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -4289,7 +4289,7 @@ With prefix argument N moves forward N messages with these labels.
;;;***
-;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "ec0bed149baed671125f623e5b012f6f")
+;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "b1ce015fd919b54cc7b1d0b2155489f9")
;;; Generated autoloads from rmailmm.el
(autoload 'rmail-mime "rmailmm" "\
@@ -4380,7 +4380,7 @@ If prefix argument REVERSE is non-nil, sorts in reverse order.
;;;### (autoloads (rmail-summary-by-senders rmail-summary-by-topic
;;;;;; rmail-summary-by-regexp rmail-summary-by-recipients rmail-summary-by-labels
-;;;;;; rmail-summary) "rmailsum" "rmailsum.el" "666a5db1021cdcba6e68a18a553d65f1")
+;;;;;; rmail-summary) "rmailsum" "rmailsum.el" "d855683972baef7111d4508dffbb54b6")
;;; Generated autoloads from rmailsum.el
(autoload 'rmail-summary "rmailsum" "\
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 918d2dfc365..708ec64706e 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -691,7 +691,9 @@ modified."
The value is a MIME-entiy object (see `rmail-mime-enty-new')."
(save-excursion
(goto-char (point-min))
- (rmail-mime-process nil t)))
+ (condition-case nil
+ (rmail-mime-process nil t)
+ (error nil))))
(defun rmail-mime-insert (entity &optional content-type disposition)
"Insert a MIME-entity ENTITY in the current buffer.
@@ -744,30 +746,31 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'."
message type disposition encoding))
(defun rmail-show-mime ()
- (let ((mbox-buf rmail-buffer))
- (condition-case nil
- (let ((entity (rmail-mime-parse)))
- (with-current-buffer rmail-view-buffer
- (let ((inhibit-read-only t)
- (rmail-buffer mbox-buf))
- (erase-buffer)
- (rmail-mime-insert entity))))
- (error
- ;; Decoding failed. Insert the original message body as is.
- (let ((region (with-current-buffer mbox-buf
- (goto-char (point-min))
- (re-search-forward "^$" nil t)
- (forward-line 1)
- (cons (point) (point-max)))))
- (with-current-buffer rmail-view-buffer
- (let ((inhibit-read-only t))
- (erase-buffer)
- (insert-buffer-substring mbox-buf (car region) (cdr region))))
- (message "MIME decoding failed"))))))
+ "Function to set in `rmail-show-mime-function' (which see)."
+ (let ((mbox-buf rmail-buffer)
+ (entity (rmail-mime-parse)))
+ (if entity
+ (with-current-buffer rmail-view-buffer
+ (let ((inhibit-read-only t)
+ (rmail-buffer mbox-buf))
+ (erase-buffer)
+ (rmail-mime-insert entity)))
+ ;; Decoding failed. Insert the original message body as is.
+ (let ((region (with-current-buffer mbox-buf
+ (goto-char (point-min))
+ (re-search-forward "^$" nil t)
+ (forward-line 1)
+ (cons (point) (point-max)))))
+ (with-current-buffer rmail-view-buffer
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (insert-buffer-substring mbox-buf (car region) (cdr region))))
+ (message "MIME decoding failed")))))
(setq rmail-show-mime-function 'rmail-show-mime)
(defun rmail-insert-mime-forwarded-message (forward-buffer)
+ "Function to set in `rmail-insert-mime-forwarded-message-function' (which see)."
(let ((mbox-buf (with-current-buffer forward-buffer rmail-view-buffer)))
(save-restriction
(narrow-to-region (point) (point))
@@ -777,6 +780,7 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'."
'rmail-insert-mime-forwarded-message)
(defun rmail-insert-mime-resent-message (forward-buffer)
+ "Function to set in `rmail-insert-mime-resent-message-function' (which see)."
(insert-buffer-substring
(with-current-buffer forward-buffer rmail-view-buffer))
(goto-char (point-min))
@@ -787,6 +791,41 @@ attachments as specfied by `rmail-mime-attachment-dirs-alist'."
(setq rmail-insert-mime-resent-message-function
'rmail-insert-mime-resent-message)
+(defun rmail-search-mime-message (msg regexp)
+ "Function to set in `rmail-search-mime-message-function' (which see)."
+ (save-restriction
+ (narrow-to-region (rmail-msgbeg msg) (rmail-msgend msg))
+ (let ((mbox-buf (current-buffer))
+ (header-end (save-excursion
+ (re-search-forward "^$" nil 'move) (point)))
+ (body-end (point-max))
+ (entity (rmail-mime-parse)))
+ (or
+ ;; At first, just search the headers.
+ (with-temp-buffer
+ (insert-buffer-substring mbox-buf nil header-end)
+ (rfc2047-decode-region (point-min) (point))
+ (goto-char (point-min))
+ (re-search-forward regexp nil t))
+ ;; Next, search the body.
+ (if (and entity
+ (let* ((content-type (rmail-mime-entity-type entity))
+ (charset (cdr (assq 'charset (cdr content-type)))))
+ (or (not (string-match "text/.*" (car content-type)))
+ (and charset
+ (not (string= (downcase charset) "us-ascii"))))))
+ ;; Search the decoded MIME message.
+ (with-temp-buffer
+ (let ((rmail-buffer mbox-buf))
+ (rmail-mime-insert entity))
+ (goto-char (point-min))
+ (re-search-forward regexp nil t))
+ ;; Search the body without decoding.
+ (goto-char header-end)
+ (re-search-forward regexp nil t))))))
+
+(setq rmail-search-mime-message-function 'rmail-search-mime-message)
+
(provide 'rmailmm)
;; Local Variables:
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 4e76de60188..62bfbb740c4 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -1007,5 +1007,4 @@ many continuation lines."
(provide 'smtpmail)
-;; arch-tag: a76992df-6d71-43b7-9e72-4bacc6c05466
;;; smtpmail.el ends here