diff options
| author | Richard M. Stallman | 1995-02-05 02:46:08 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-05 02:46:08 +0000 |
| commit | 60fb2b34a378097012f46db3ac9968ac7f60692e (patch) | |
| tree | a9672baef84847baa39f59921e58aea82527f796 | |
| parent | 5e882a6a2274cbf0141bc460500f72e056148002 (diff) | |
| download | emacs-60fb2b34a378097012f46db3ac9968ac7f60692e.tar.gz emacs-60fb2b34a378097012f46db3ac9968ac7f60692e.zip | |
(rmail-next-same-subject): New command.
(rmail-previous-same-subject): Likewise.
(rmail-mode-map): Add bindings for C-c C-n and C-c C-p.
| -rw-r--r-- | lisp/mail/rmail.el | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 0bc70936edb..deb5547efb3 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -414,6 +414,8 @@ Note: it means the file has no messages in it.\n\^_"))) | |||
| 414 | (define-key rmail-mode-map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent) | 414 | (define-key rmail-mode-map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent) |
| 415 | (define-key rmail-mode-map "\C-c\C-s\C-l" 'rmail-sort-by-lines) | 415 | (define-key rmail-mode-map "\C-c\C-s\C-l" 'rmail-sort-by-lines) |
| 416 | (define-key rmail-mode-map "\C-c\C-s\C-k" 'rmail-sort-by-keywords) | 416 | (define-key rmail-mode-map "\C-c\C-s\C-k" 'rmail-sort-by-keywords) |
| 417 | (define-key rmail-mode-map "\C-c\C-n" 'rmail-next-same-subject) | ||
| 418 | (define-key rmail-mode-map "\C-c\C-p" 'rmail-previous-same-subject) | ||
| 417 | ) | 419 | ) |
| 418 | 420 | ||
| 419 | (define-key rmail-mode-map [menu-bar] (make-sparse-keymap)) | 421 | (define-key rmail-mode-map [menu-bar] (make-sparse-keymap)) |
| @@ -1747,6 +1749,54 @@ Interactively, empty argument means use same regexp used last time." | |||
| 1747 | ;; (if found | 1749 | ;; (if found |
| 1748 | ;; (rmail-show-message found)) | 1750 | ;; (rmail-show-message found)) |
| 1749 | found)) | 1751 | found)) |
| 1752 | |||
| 1753 | (defun rmail-next-same-subject (n) | ||
| 1754 | "Go to the next mail message having the same subject header. | ||
| 1755 | With prefix argument N, do this N times. | ||
| 1756 | If N is negative, go backwards instead." | ||
| 1757 | (interactive "p") | ||
| 1758 | (let* ((subject (mail-fetch-field "Subject")) | ||
| 1759 | (search-regexp (concat "^Subject: *\\(Re: *\\)?" | ||
| 1760 | (regexp-quote subject) | ||
| 1761 | "\n")) | ||
| 1762 | (forward (> n 0)) | ||
| 1763 | (i rmail-current-message) | ||
| 1764 | found) | ||
| 1765 | (if (string-match "Re:[ \t]*" subject) | ||
| 1766 | (setq subject (substring subject (match-end 0)))) | ||
| 1767 | (save-excursion | ||
| 1768 | (save-restriction | ||
| 1769 | (widen) | ||
| 1770 | (while (and (/= n 0) | ||
| 1771 | (if forward | ||
| 1772 | (< i rmail-total-messages) | ||
| 1773 | (> i 1))) | ||
| 1774 | (let (done) | ||
| 1775 | (while (and (not done) | ||
| 1776 | (if forward | ||
| 1777 | (< i rmail-total-messages) | ||
| 1778 | (> i 1))) | ||
| 1779 | (setq i (if forward (1+ i) (1- i))) | ||
| 1780 | (goto-char (rmail-msgbeg i)) | ||
| 1781 | (search-forward "\n*** EOOH ***\n") | ||
| 1782 | (let ((beg (point)) end) | ||
| 1783 | (search-forward "\n\n") | ||
| 1784 | (setq end (point)) | ||
| 1785 | (goto-char beg) | ||
| 1786 | (setq done (re-search-forward search-regexp end t)))) | ||
| 1787 | (if done (setq found i))) | ||
| 1788 | (setq n (if forward (1- n) (1+ n)))))) | ||
| 1789 | (if found | ||
| 1790 | (rmail-show-message found) | ||
| 1791 | (error "No %s message with same subject" | ||
| 1792 | (if forward "following" "previous"))))) | ||
| 1793 | |||
| 1794 | (defun rmail-previous-same-subject (n) | ||
| 1795 | "Go to the previous mail message having the same subject header. | ||
| 1796 | With prefix argument N, do this N times. | ||
| 1797 | If N is negative, go forwards instead." | ||
| 1798 | (interactive "p") | ||
| 1799 | (rmail-next-same-subject (- n))) | ||
| 1750 | 1800 | ||
| 1751 | ;;;; *** Rmail Message Deletion Commands *** | 1801 | ;;;; *** Rmail Message Deletion Commands *** |
| 1752 | 1802 | ||