aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-04-14 22:16:50 +0000
committerRichard M. Stallman1995-04-14 22:16:50 +0000
commit8095bf233dba40256cc2878baaf4514e547d5295 (patch)
tree5c0fb4c3f3e3426ad4aefc9d9dae75ee4738e5ab
parent167d976be457011a0dc60a3ba4be667475cbb6e3 (diff)
downloademacs-8095bf233dba40256cc2878baaf4514e547d5295.tar.gz
emacs-8095bf233dba40256cc2878baaf4514e547d5295.zip
(rmail-reformat-message): Call `rmail-clear-headers'
also if `rmail-displayed-headers' is set. (rmail-clear-headers): Handle `rmail-displayed-headers' correctly. (rmail-insert-inbox-text): When reading old .newmail-<user> file, report it specifically. (rmail-displayed-headers): New variable. (rmail-clear-headers): Handle rmail-displayed-headers (rmail-display-labels): Use `format' to convert message numbers to strings. (rmail-resend): If mailabbrev loaded, use that to expand abbrevs.
-rw-r--r--lisp/mail/rmail.el78
1 files changed, 55 insertions, 23 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 4ec63c41d87..78b9163bf52 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -71,6 +71,12 @@ It is useful to set this variable in the site customization file.")
71 "*Regexp to match Header fields that Rmail should normally hide.") 71 "*Regexp to match Header fields that Rmail should normally hide.")
72 72
73;;;###autoload 73;;;###autoload
74(defvar rmail-displayed-headers nil
75 "*Regexp to match Header fields that Rmail should display.
76If nil, display all header fields except those matched by
77`rmail-ignored-headers'.")
78
79;;;###autoload
74(defvar rmail-retry-ignored-headers nil "\ 80(defvar rmail-retry-ignored-headers nil "\
75*Headers that should be stripped when retrying a failed message.") 81*Headers that should be stripped when retrying a failed message.")
76 82
@@ -948,13 +954,14 @@ It returns t if it got any new messages."
948 (if (file-directory-p file) 954 (if (file-directory-p file)
949 (setq file (expand-file-name (user-login-name) 955 (setq file (expand-file-name (user-login-name)
950 file))))) 956 file)))))
951 (if popmail 957 (cond (popmail
952 (message "Getting mail from post office ...") 958 (message "Getting mail from post office ..."))
953 (if (or (and (file-exists-p tofile) 959 ((and (file-exists-p tofile)
954 (/= 0 (nth 7 (file-attributes tofile)))) 960 (/= 0 (nth 7 (file-attributes tofile))))
955 (and (file-exists-p file) 961 (message "Getting mail from %s..." tofile))
956 (/= 0 (nth 7 (file-attributes file))))) 962 ((and (file-exists-p file)
957 (message "Getting mail from %s..." file))) 963 (/= 0 (nth 7 (file-attributes file))))
964 (message "Getting mail from %s..." file)))
958 ;; Set TOFILE if have not already done so, and 965 ;; Set TOFILE if have not already done so, and
959 ;; rename or copy the file FILE to TOFILE if and as appropriate. 966 ;; rename or copy the file FILE to TOFILE if and as appropriate.
960 (cond ((not renamep) 967 (cond ((not renamep)
@@ -1220,22 +1227,42 @@ It returns t if it got any new messages."
1220 (narrow-to-region (point) (- (buffer-size) delta))) 1227 (narrow-to-region (point) (- (buffer-size) delta)))
1221 (goto-char (point-min)) 1228 (goto-char (point-min))
1222 (if rmail-message-filter (funcall rmail-message-filter)) 1229 (if rmail-message-filter (funcall rmail-message-filter))
1223 (if rmail-ignored-headers (rmail-clear-headers)))) 1230 (if (or rmail-displayed-headers rmail-ignored-headers)
1231 (rmail-clear-headers))))
1224 1232
1225(defun rmail-clear-headers (&optional ignored-headers) 1233(defun rmail-clear-headers (&optional ignored-headers)
1226 (or ignored-headers (setq ignored-headers rmail-ignored-headers)) 1234 "Delete all header fields that Rmail should not show.
1235If the optional argument IGNORED-HEADERS is non-nil,
1236delete all header fields whose names match that regexp.
1237Otherwise, if `rmail-displayed-headers' is non-nil,
1238delete all header fields *except* those whose names match that regexp.
1239Otherwise, delete all header fields whose names match `rmail-ignored-headers'."
1227 (if (search-forward "\n\n" nil t) 1240 (if (search-forward "\n\n" nil t)
1228 (save-restriction 1241 (if (and rmail-displayed-headers (null ignored-headers))
1229 (narrow-to-region (point-min) (point)) 1242 (save-restriction
1230 (let ((buffer-read-only nil)) 1243 (narrow-to-region (point-min) (point))
1231 (while (let ((case-fold-search t)) 1244 (let ((buffer-read-only nil) lim)
1232 (goto-char (point-min)) 1245 (goto-char (point-min))
1233 (re-search-forward ignored-headers nil t)) 1246 (while (save-excursion
1234 (beginning-of-line) 1247 (re-search-forward "\n[^ \t]")
1235 (delete-region (point) 1248 (and (not (eobp))
1236 (progn (re-search-forward "\n[^ \t]") 1249 (setq lim (1- (point)))))
1237 (forward-char -1) 1250 (if (save-excursion
1238 (point)))))))) 1251 (re-search-forward rmail-displayed-headers lim t))
1252 (goto-char lim)
1253 (delete-region (point) lim))))
1254 (goto-char (point-min)))
1255 (or ignored-headers (setq ignored-headers rmail-ignored-headers))
1256 (save-restriction
1257 (narrow-to-region (point-min) (point))
1258 (let ((buffer-read-only nil))
1259 (while (let ((case-fold-search t))
1260 (goto-char (point-min))
1261 (re-search-forward ignored-headers nil t))
1262 (beginning-of-line)
1263 (delete-region (point)
1264 (progn (re-search-forward "\n[^ \t]")
1265 (1- (point))))))))))
1239 1266
1240(defun rmail-toggle-header () 1267(defun rmail-toggle-header ()
1241 "Show original message header if pruned header currently shown, or vice versa." 1268 "Show original message header if pruned header currently shown, or vice versa."
@@ -1312,8 +1339,8 @@ It returns t if it got any new messages."
1312 (setq blurb (concat (substring blurb 0 (match-beginning 0)) "," 1339 (setq blurb (concat (substring blurb 0 (match-beginning 0)) ","
1313 (substring blurb (match-end 0))))) 1340 (substring blurb (match-end 0)))))
1314 (setq mode-line-process 1341 (setq mode-line-process
1315 (concat " " rmail-current-message "/" rmail-total-messages 1342 (format " %d/%d%s"
1316 blurb)))) 1343 rmail-current-message rmail-total-messages blurb))))
1317 1344
1318;; Turn an attribute of a message on or off according to STATE. 1345;; Turn an attribute of a message on or off according to STATE.
1319;; ATTR is the name of the attribute, as a string. 1346;; ATTR is the name of the attribute, as a string.
@@ -2251,8 +2278,13 @@ typically for purposes of moderating a list."
2251 address 2278 address
2252 (mapconcat 'identity address ",\n\t")) 2279 (mapconcat 'identity address ",\n\t"))
2253 "\n") 2280 "\n")
2281 ;; Expand abbrevs in the recipients.
2254 (save-excursion 2282 (save-excursion
2255 (expand-mail-aliases before (point)))) 2283 (if (featurep 'mailabbrev)
2284 (progn
2285 (mail-abbrevs-setup)
2286 (expand-region-abbrevs before (point) t))
2287 (expand-mail-aliases before (point)))))
2256 ;;>> Set up comment, if any. 2288 ;;>> Set up comment, if any.
2257 (if (and (sequencep comment) (not (zerop (length comment)))) 2289 (if (and (sequencep comment) (not (zerop (length comment))))
2258 (let ((before (point)) 2290 (let ((before (point))