diff options
| author | Richard M. Stallman | 1990-12-03 22:48:04 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1990-12-03 22:48:04 +0000 |
| commit | 22a72f53979d0f0eee99deea105338928370f9d0 (patch) | |
| tree | 0934e1b772ddf6b16fae7d8c5c0bdf9aaef1934c | |
| parent | 4d4d11ccf50b6eac0d3f15b211170a443a427822 (diff) | |
| download | emacs-22a72f53979d0f0eee99deea105338928370f9d0.tar.gz emacs-22a72f53979d0f0eee99deea105338928370f9d0.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/mail/rmailsort.el | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/lisp/mail/rmailsort.el b/lisp/mail/rmailsort.el index af7487eee59..cf78876883c 100644 --- a/lisp/mail/rmailsort.el +++ b/lisp/mail/rmailsort.el | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | (define-key rmail-mode-map "\C-c\C-s\C-s" 'rmail-sort-by-subject) | 28 | (define-key rmail-mode-map "\C-c\C-s\C-s" 'rmail-sort-by-subject) |
| 29 | (define-key rmail-mode-map "\C-c\C-s\C-a" 'rmail-sort-by-author) | 29 | (define-key rmail-mode-map "\C-c\C-s\C-a" 'rmail-sort-by-author) |
| 30 | (define-key rmail-mode-map "\C-c\C-s\C-r" 'rmail-sort-by-recipient) | 30 | (define-key rmail-mode-map "\C-c\C-s\C-r" 'rmail-sort-by-recipient) |
| 31 | (define-key rmail-mode-map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent) | ||
| 31 | 32 | ||
| 32 | (defun rmail-sort-by-date (reverse) | 33 | (defun rmail-sort-by-date (reverse) |
| 33 | "Sort messages of current Rmail file by date. | 34 | "Sort messages of current Rmail file by date. |
| @@ -75,6 +76,26 @@ If prefix argument REVERSE is non-nil, sort them in reverse order." | |||
| 75 | (rmail-fetch-field msg "Apparently-To") "") | 76 | (rmail-fetch-field msg "Apparently-To") "") |
| 76 | ))))) | 77 | ))))) |
| 77 | 78 | ||
| 79 | (defun rmail-sort-by-correspondent (reverse) | ||
| 80 | "Sort messages of current Rmail file by other correspondent. | ||
| 81 | If prefix argument REVERSE is non-nil, sort them in reverse order." | ||
| 82 | (interactive "P") | ||
| 83 | (rmail-sort-messages reverse | ||
| 84 | (function | ||
| 85 | (lambda (msg) | ||
| 86 | (rmail-select-correspondent | ||
| 87 | msg | ||
| 88 | '("From" "Sender" "To" "Apparently-To")))))) | ||
| 89 | |||
| 90 | (defun rmail-select-correspondent (msg fields) | ||
| 91 | (let ((ans "")) | ||
| 92 | (while (and fields (string= ans "")) | ||
| 93 | (setq ans | ||
| 94 | (rmail-dont-reply-to | ||
| 95 | (mail-strip-quoted-names | ||
| 96 | (or (rmail-fetch-field msg (car fields)) "")))) | ||
| 97 | (setq fields (cdr fields))) | ||
| 98 | ans)) | ||
| 78 | 99 | ||
| 79 | 100 | ||
| 80 | (defun rmail-sort-messages (reverse keyfunc) | 101 | (defun rmail-sort-messages (reverse keyfunc) |
| @@ -137,8 +158,9 @@ Arguments are MSG and FIELD." | |||
| 137 | (if (string-match | 158 | (if (string-match |
| 138 | "\\([0-9]+\\) +\\([^ ,]+\\) +\\([0-9]+\\) +\\([0-9:]+\\)" date) | 159 | "\\([0-9]+\\) +\\([^ ,]+\\) +\\([0-9]+\\) +\\([0-9:]+\\)" date) |
| 139 | (concat | 160 | (concat |
| 140 | ;; Year (discarding century) | 161 | ;; Year |
| 141 | (substring (substring date (match-beginning 3) (match-end 3)) -2) | 162 | (rmail-date-full-year |
| 163 | (substring date (match-beginning 3) (match-end 3))) | ||
| 142 | ;; Month | 164 | ;; Month |
| 143 | (cdr | 165 | (cdr |
| 144 | (assoc | 166 | (assoc |
| @@ -153,3 +175,8 @@ Arguments are MSG and FIELD." | |||
| 153 | date | 175 | date |
| 154 | ) | 176 | ) |
| 155 | )) | 177 | )) |
| 178 | |||
| 179 | (defun rmail-date-full-year (year-string) | ||
| 180 | (if (<= (length year-string) 2) | ||
| 181 | (concat "19" year-string) | ||
| 182 | year-string)) | ||