Mercurial > emacs
comparison lisp/mail/rmail.el @ 4838:754b38c0e941
(rmail): Really don't get new mail if file name was given.
(rmail-reformat-message): Move past Mail-from as well as Summary-line.
(rmail-toggle-header): Likewise.
(rmail-next-undeleted-message): Return t unless hit end of buffer.
(rmail-delete-forward): Likewise.
(mail-unsent-separator): Add `Original message follows'.
(rmail-resend): Handle mail-self-blind.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 09 Oct 1993 03:47:15 +0000 |
parents | 22656ec8d019 |
children | 25d94807689e |
comparison
equal
deleted
inserted
replaced
4837:b040c520f090 | 4838:754b38c0e941 |
---|---|
188 ;;;; *** Rmail Mode *** | 188 ;;;; *** Rmail Mode *** |
189 | 189 |
190 ;;;###autoload | 190 ;;;###autoload |
191 (defun rmail (&optional file-name-arg) | 191 (defun rmail (&optional file-name-arg) |
192 "Read and edit incoming mail. | 192 "Read and edit incoming mail. |
193 Moves messages into file named by rmail-file-name (a babyl format file) | 193 Moves messages into file named by `rmail-file-name' (a babyl format file) |
194 and edits that file in RMAIL Mode. | 194 and edits that file in RMAIL Mode. |
195 Type \\[describe-mode] once editing that file, for a list of RMAIL commands. | 195 Type \\[describe-mode] once editing that file, for a list of RMAIL commands. |
196 | 196 |
197 May be called with filename as argument; then performs rmail editing on | 197 May be called with filename as argument; then performs rmail editing on |
198 that file, but does not copy any new mail into the file." | 198 that file, but does not copy any new mail into the file." |
230 (if (null rmail-inbox-list) | 230 (if (null rmail-inbox-list) |
231 (progn | 231 (progn |
232 (rmail-set-message-counters) | 232 (rmail-set-message-counters) |
233 (rmail-show-message)))) | 233 (rmail-show-message)))) |
234 (let ((existing-unseen (rmail-first-unseen-message))) | 234 (let ((existing-unseen (rmail-first-unseen-message))) |
235 (rmail-get-new-mail) | 235 (or file-name-arg |
236 (rmail-get-new-mail)) | |
236 ;; Show the first unseen message, which might be from a previous session | 237 ;; Show the first unseen message, which might be from a previous session |
237 ;; or might have been just read in by rmail-get-new-mail. Must | 238 ;; or might have been just read in by rmail-get-new-mail. Must |
238 ;; determine already unseen messages first, as rmail-get-new-mail | 239 ;; determine already unseen messages first, as rmail-get-new-mail |
239 ;; positions on the first new message, thus marking it as seen. | 240 ;; positions on the first new message, thus marking it as seen. |
240 (rmail-show-message existing-unseen)))) | 241 (rmail-show-message existing-unseen)))) |
925 (t (error "Cannot convert to babyl format"))))) | 926 (t (error "Cannot convert to babyl format"))))) |
926 count)) | 927 count)) |
927 | 928 |
928 ;; Delete the "From ..." line, creating various other headers with | 929 ;; Delete the "From ..." line, creating various other headers with |
929 ;; information from it if they don't already exist. Now puts the | 930 ;; information from it if they don't already exist. Now puts the |
930 ;; original line into a mail-from: header line for debugging. | 931 ;; original line into a mail-from: header line for debugging and for |
932 ;; use by the rmail-output function. | |
931 (defun rmail-nuke-pinhead-header () | 933 (defun rmail-nuke-pinhead-header () |
932 (save-excursion | 934 (save-excursion |
933 (save-restriction | 935 (save-restriction |
934 (let ((start (point)) | 936 (let ((start (point)) |
935 (end (progn | 937 (end (progn |
988 (delta (- (buffer-size) end))) | 990 (delta (- (buffer-size) end))) |
989 (delete-char 1) | 991 (delete-char 1) |
990 (insert ?1) | 992 (insert ?1) |
991 (forward-line 1) | 993 (forward-line 1) |
992 (let ((case-fold-search t)) | 994 (let ((case-fold-search t)) |
993 (if (looking-at "Summary-line: ") | 995 (while (looking-at "Summary-line:\\|Mail-From:") |
994 (forward-line 1))) | 996 (forward-line 1))) |
995 (if (looking-at "\\*\\*\\* EOOH \\*\\*\\*\n") | 997 (if (looking-at "\\*\\*\\* EOOH \\*\\*\\*\n") |
996 (delete-region (point) | 998 (delete-region (point) |
997 (progn (forward-line 1) (point)))) | 999 (progn (forward-line 1) (point)))) |
998 (let ((str (buffer-substring (point) | 1000 (let ((str (buffer-substring (point) |
999 (save-excursion (search-forward "\n\n" end 'move) | 1001 (save-excursion (search-forward "\n\n" end 'move) |
1029 (if (= (following-char) ?1) | 1031 (if (= (following-char) ?1) |
1030 (progn (delete-char 1) | 1032 (progn (delete-char 1) |
1031 (insert ?0) | 1033 (insert ?0) |
1032 (forward-line 1) | 1034 (forward-line 1) |
1033 (let ((case-fold-search t)) | 1035 (let ((case-fold-search t)) |
1034 (if (looking-at "Summary-Line:") | 1036 (while (looking-at "Summary-Line:\\|Mail-From:") |
1035 (forward-line 1))) | 1037 (forward-line 1))) |
1036 (insert "*** EOOH ***\n") | 1038 (insert "*** EOOH ***\n") |
1037 (forward-char -1) | 1039 (forward-char -1) |
1038 (search-forward "\n*** EOOH ***\n") | 1040 (search-forward "\n*** EOOH ***\n") |
1039 (forward-line -1) | 1041 (forward-line -1) |
1040 (let ((temp (point))) | 1042 (let ((temp (point))) |
1328 (rmail-next-message (- n))) | 1330 (rmail-next-message (- n))) |
1329 | 1331 |
1330 (defun rmail-next-undeleted-message (n) | 1332 (defun rmail-next-undeleted-message (n) |
1331 "Show following non-deleted message. | 1333 "Show following non-deleted message. |
1332 With prefix arg N, moves forward N non-deleted messages, | 1334 With prefix arg N, moves forward N non-deleted messages, |
1333 or backward if N is negative." | 1335 or backward if N is negative. |
1336 | |
1337 Returns t if a new message is being shown, nil otherwise." | |
1334 (interactive "p") | 1338 (interactive "p") |
1335 (rmail-maybe-set-message-counters) | 1339 (rmail-maybe-set-message-counters) |
1336 (let ((lastwin rmail-current-message) | 1340 (let ((lastwin rmail-current-message) |
1337 (current rmail-current-message)) | 1341 (current rmail-current-message)) |
1338 (while (and (> n 0) (< current rmail-total-messages)) | 1342 (while (and (> n 0) (< current rmail-total-messages)) |
1342 (while (and (< n 0) (> current 1)) | 1346 (while (and (< n 0) (> current 1)) |
1343 (setq current (1- current)) | 1347 (setq current (1- current)) |
1344 (if (not (rmail-message-deleted-p current)) | 1348 (if (not (rmail-message-deleted-p current)) |
1345 (setq lastwin current n (1+ n)))) | 1349 (setq lastwin current n (1+ n)))) |
1346 (if (/= lastwin rmail-current-message) | 1350 (if (/= lastwin rmail-current-message) |
1347 (rmail-show-message lastwin)) | 1351 (progn (rmail-show-message lastwin) |
1348 (if (< n 0) | 1352 t) |
1349 (message "No previous nondeleted message")) | 1353 (if (< n 0) |
1350 (if (> n 0) | 1354 (message "No previous nondeleted message")) |
1351 (message "No following nondeleted message")))) | 1355 (if (> n 0) |
1356 (message "No following nondeleted message")) | |
1357 nil))) | |
1352 | 1358 |
1353 (defun rmail-previous-undeleted-message (n) | 1359 (defun rmail-previous-undeleted-message (n) |
1354 "Show previous non-deleted message. | 1360 "Show previous non-deleted message. |
1355 With prefix argument N, moves backward N non-deleted messages, | 1361 With prefix argument N, moves backward N non-deleted messages, |
1356 or forward if N is negative." | 1362 or forward if N is negative." |
1564 (rmail-maybe-display-summary)))) | 1570 (rmail-maybe-display-summary)))) |
1565 | 1571 |
1566 (defun rmail-delete-forward (&optional backward) | 1572 (defun rmail-delete-forward (&optional backward) |
1567 "Delete this message and move to next nondeleted one. | 1573 "Delete this message and move to next nondeleted one. |
1568 Deleted messages stay in the file until the \\[rmail-expunge] command is given. | 1574 Deleted messages stay in the file until the \\[rmail-expunge] command is given. |
1569 With prefix argument, delete and move backward." | 1575 With prefix argument, delete and move backward. |
1576 | |
1577 Returns t if a new message is displayed after the delete, or nil otherwise." | |
1570 (interactive "P") | 1578 (interactive "P") |
1571 (rmail-set-attribute "deleted" t) | 1579 (rmail-set-attribute "deleted" t) |
1572 (let ((del-msg rmail-current-message)) | 1580 (let ((del-msg rmail-current-message)) |
1573 (if (rmail-summary-exists) | 1581 (if (rmail-summary-exists) |
1574 (save-excursion | 1582 (save-excursion |
1575 (set-buffer rmail-summary-buffer) | 1583 (set-buffer rmail-summary-buffer) |
1576 (rmail-summary-mark-deleted del-msg))) | 1584 (rmail-summary-mark-deleted del-msg))) |
1577 (rmail-next-undeleted-message (if backward -1 1)) | 1585 (prog1 (rmail-next-undeleted-message (if backward -1 1)) |
1578 (rmail-maybe-display-summary))) | 1586 (rmail-maybe-display-summary)))) |
1579 | 1587 |
1580 (defun rmail-delete-backward () | 1588 (defun rmail-delete-backward () |
1581 "Delete this message and move to previous nondeleted one. | 1589 "Delete this message and move to previous nondeleted one. |
1582 Deleted messages stay in the file until the \\[rmail-expunge] command is given." | 1590 Deleted messages stay in the file until the \\[rmail-expunge] command is given." |
1583 (interactive) | 1591 (interactive) |
1877 ;;>> Insert resent-from: | 1885 ;;>> Insert resent-from: |
1878 (insert "Resent-From: " from "\n") | 1886 (insert "Resent-From: " from "\n") |
1879 (insert "Resent-Date: " (mail-rfc822-date) "\n") | 1887 (insert "Resent-Date: " (mail-rfc822-date) "\n") |
1880 ;;>> Insert resent-to: and bcc if need be. | 1888 ;;>> Insert resent-to: and bcc if need be. |
1881 (let ((before (point))) | 1889 (let ((before (point))) |
1890 (if mail-self-blind | |
1891 (insert "Resent-Bcc: " (user-login-name) "\n")) | |
1882 (insert "Resent-To: " (if (stringp address) | 1892 (insert "Resent-To: " (if (stringp address) |
1883 address | 1893 address |
1884 (mapconcat 'identity address ",\n\t")) | 1894 (mapconcat 'identity address ",\n\t")) |
1885 "\n") | 1895 "\n") |
1886 (expand-mail-aliases before (point))) | 1896 (expand-mail-aliases before (point))) |
1905 (defvar mail-unsent-separator | 1915 (defvar mail-unsent-separator |
1906 (concat "^ *---+ +Unsent message follows +---+ *$\\|" | 1916 (concat "^ *---+ +Unsent message follows +---+ *$\\|" |
1907 "^ *---+ +Returned message +---+ *$\\|" | 1917 "^ *---+ +Returned message +---+ *$\\|" |
1908 "^ *---+ +Original message +---+ *$\\|" | 1918 "^ *---+ +Original message +---+ *$\\|" |
1909 "^ *--+ +begin message +--+ *$\\|" | 1919 "^ *--+ +begin message +--+ *$\\|" |
1920 "^ *---+ +Original message follows +---+ *$\\|" | |
1910 "^|? *---+ +Message text follows: +---+ *|?$")) | 1921 "^|? *---+ +Message text follows: +---+ *|?$")) |
1911 | 1922 |
1912 (defun rmail-retry-failure () | 1923 (defun rmail-retry-failure () |
1913 "Edit a mail message which is based on the contents of the current message. | 1924 "Edit a mail message which is based on the contents of the current message. |
1914 For a message rejected by the mail system, extract the interesting headers and | 1925 For a message rejected by the mail system, extract the interesting headers and |