From 072645bff9910def1a5b88c95df91c261c106348 Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Mon, 16 Jan 2006 22:22:44 +0000 Subject: [PATCH] (rmail-nuke-pinhead-header, rmail-reformat-message) (rmail-msg-restore-non-pruned-header, rmail-msg-prune-header): Deleted. (rmail-narrow-to-header): Fix typo, error if we cannot find the end of the headers. --- lisp/mail/ChangeLog | 10 ++++ lisp/mail/rmail.el | 136 ++------------------------------------------ 2 files changed, 14 insertions(+), 132 deletions(-) diff --git a/lisp/mail/ChangeLog b/lisp/mail/ChangeLog index 5279734e1ca..642630d2911 100644 --- a/lisp/mail/ChangeLog +++ b/lisp/mail/ChangeLog @@ -1,5 +1,15 @@ 2006-01-16 Alex Schroeder + * rmail.el (rmail-nuke-pinhead-header, rmail-reformat-message) + (rmail-msg-restore-non-pruned-header, rmail-msg-prune-header): + Deleted. + (rmail-narrow-to-header): Fix typo, error if we cannot find the + end of the headers. + + * rmailsum.el (rmail-message-subject-p, rmail-message-senders-p): + Use mail-fetch-field instead of mail-header-get-header. + (rmail-summary-next-same-subject): Simplify. + * rmail.el (rmail): Create the buffer using file-name-nondirectory. (rmail-mode-map): Bind j to rmail-show-message instead of diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index f18c12bcfd8..c6f6dbe4479 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -1762,88 +1762,9 @@ is non-nil if the user has supplied the password interactively. (t (message "Malformed MIME quoted-printable message"))))) -;;; DEPRECATED -pmr -;; Delete the "From ..." line, creating various other headers with -;; information from it if they don't already exist. Now puts the -;; original line into a mail-from: header line for debugging and for -;; use by the rmail-output function. -(defun rmail-nuke-pinhead-header () - (save-excursion - (save-restriction - (let ((start (point)) - (end (progn - (condition-case () - (search-forward "\n\n") - (error - (goto-char (point-max)) - (insert "\n\n"))) - (point))) - has-from has-date) - (narrow-to-region start end) - (let ((case-fold-search t)) - (goto-char start) - (setq has-from (search-forward "\nFrom:" nil t)) - (goto-char start) - (setq has-date (and (search-forward "\nDate:" nil t) (point))) - (goto-char start)) - (let ((case-fold-search nil)) - (if (re-search-forward (concat "^" rmail-unix-mail-delimiter) nil t) - (replace-match - (concat - "Mail-from: \\&" - ;; Keep and reformat the date if we don't - ;; have a Date: field. - (if has-date - "" - (concat - "Date: \\2, \\4 \\3 \\9 \\5 " - - ;; The timezone could be matched by group 7 or group 10. - ;; If neither of them matched, assume EST, since only - ;; Easterners would be so sloppy. - ;; It's a shame the substitution can't use "\\10". - (cond - ((/= (match-beginning 7) (match-end 7)) "\\7") - ((/= (match-beginning 10) (match-end 10)) - (buffer-substring (match-beginning 10) - (match-end 10))) - (t "EST")) - "\n")) - ;; Keep and reformat the sender if we don't - ;; have a From: field. - (if has-from - "" - "From: \\1\n")) - t))))))) ;;;; *** Rmail Message Formatting and Header Manipulation *** -(defun rmail-reformat-message (beg end) - (goto-char beg) - (forward-line 1) - (if (/= (following-char) ?0) - (error "Bad format in RMAIL file")) - (let ((inhibit-read-only t) - (delta (- (buffer-size) end))) - (delete-char 1) - (insert ?1) - (forward-line 1) - (let ((case-fold-search t)) - (while (looking-at "Summary-line:\\|Mail-From:") - (forward-line 1))) - (if (looking-at "\\*\\*\\* EOOH \\*\\*\\*\n") - (delete-region (point) - (progn (forward-line 1) (point)))) - (let ((str (buffer-substring (point) - (save-excursion (search-forward "\n\n" end 'move) - (point))))) - (insert str "*** EOOH ***\n") - (narrow-to-region (point) (- (buffer-size) delta))) - (goto-char (point-min)) - (if rmail-message-filter (funcall rmail-message-filter)) - (if (or rmail-displayed-headers rmail-ignored-headers) - (rmail-clear-headers)))) - (defun rmail-clear-headers (&optional ignored-headers) "Delete all header fields that Rmail should not show. If the optional argument IGNORED-HEADERS is non-nil, @@ -1893,55 +1814,6 @@ unless they also match `rmail-nonignored-headers'." instead of the current message." (rmail-desc-get-header-display-state (or msg rmail-current-message))) -;; mbox: untested -(defun rmail-msg-restore-non-pruned-header () - (let ((old-point (point)) - new-point - new-start - (inhibit-read-only t)) - (save-excursion - (narrow-to-region - (rmail-desc-get-start rmail-current-message) - (point-max)) - (goto-char (point-min)) - (forward-line 1) - ;; Change 1 to 0. - (delete-char 1) - (insert ?0) - ;; Insert new EOOH line at the proper place. - (forward-line 1) - (let ((case-fold-search t)) - (while (looking-at "Summary-Line:\\|Mail-From:") - (forward-line 1))) - (insert "*** EOOH ***\n") - (setq new-start (point)) - ;; Delete the old reformatted header. - (forward-char -1) - (search-forward "\n*** EOOH ***\n") - (forward-line -1) - (let ((start (point))) - (search-forward "\n\n") - (if (and (<= start old-point) - (<= old-point (point))) - (setq new-point new-start)) - (delete-region start (point))) - ;; Narrow to after the new EOOH line. - (narrow-to-region new-start (point-max))) - (if new-point - (goto-char new-point)))) - -;; mbox: untested -(defun rmail-msg-prune-header () - (let ((new-point - (= (point) (point-min)))) - (save-excursion - (narrow-to-region - (rmail-desc-get-start rmail-current-message) - (point-max)) - (rmail-reformat-message (point-min) (point-max))) - (if new-point - (goto-char (point-min))))) - (defun rmail-toggle-header (&optional arg) "Show original message header if pruned header currently shown, or vice versa. With argument ARG, show the message header pruned if ARG is greater than zero; @@ -2581,15 +2453,15 @@ or forward if N is negative." (setq mid (+ low (/ (- high low) 2)))) (if (>= where (rmail-desc-get-start high)) high low))) -;;; mbox: ready (defun rmail-narrow-to-header (msg) + "Narrow to buffer the headers of message number MSG." (save-excursion (let ((start (rmail-desc-get-start msg)) - (end (rmail-desc-get-end msg))) + (end (rmail-desc-get-end msg))) (widen) (goto-char start) - (search-forward "\n\n" end nil t) - (narrow-to-region start (point))))) + (search-forward "\n\n" end) ; error if we don't find it + (narrow-to-region start (point))))) ;;; mbox: ready (defun rmail-message-recipients-p (msg recipients &optional primary-only) -- 2.39.2