annotate lisp/mail/rmailsort.el @ 3698:e748df7e6e74

Refer to GPL version two.
author Jim Blandy <jimb@redhat.com>
date Sat, 12 Jun 1993 21:44:46 +0000
parents 2c1553d7aad1
children fab096be7274
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; rmailsort.el --- Rmail: sort messages.
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
3 ;; Copyright (C) 1990, 1993 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
4
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
5 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp>
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
6 ;; Version: $Header: rmailsort.el,v 1.6 93/05/26 22:24:42 umerin Exp $
814
38b2499cb3e9 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
7 ;; Keywords: mail
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 767
diff changeset
8
767
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
9 ;; This file is part of GNU Emacs.
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
767
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 767
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
767
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
14 ;; any later version.
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
767
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
19 ;; GNU General Public License for more details.
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
767
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
21 ;; You should have received a copy of the GNU General Public License
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
02bfc9709961 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 658
diff changeset
24
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
25 ;;; Commentary:
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
26
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
27 ;; LCD Archive Entry:
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
28 ;; rmailsort|Masanobu UMEDA|umerin@mse.kyutech.ac.jp|
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
29 ;; Rmail: sort messages.|
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
30 ;; $Date: 93/05/26 22:24:42 $|$Revision: 1.6 $|~/misc/rmailsort.el.Z|
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
31
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 767
diff changeset
32 ;;; Code:
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 (require 'rmail)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 (require 'sort)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
37 (autoload 'timezone-make-date-sortable "timezone")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
38
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; GNUS compatible key bindings.
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
40
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 (define-key rmail-mode-map "\C-c\C-s\C-d" 'rmail-sort-by-date)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 (define-key rmail-mode-map "\C-c\C-s\C-s" 'rmail-sort-by-subject)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 (define-key rmail-mode-map "\C-c\C-s\C-a" 'rmail-sort-by-author)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 (define-key rmail-mode-map "\C-c\C-s\C-r" 'rmail-sort-by-recipient)
131
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
45 (define-key rmail-mode-map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent)
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
46 (define-key rmail-mode-map "\C-c\C-s\C-l" 'rmail-sort-by-lines)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
47
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
48 ;; Key binding may not be installed unless Rmail Summary mode is loaded.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
49 (if (boundp 'rmail-summary-mode-map)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
50 (progn
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
51 (define-key rmail-summary-mode-map
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
52 "\C-c\C-s\C-d" 'rmail-summary-sort-by-date)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
53 (define-key rmail-summary-mode-map
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
54 "\C-c\C-s\C-s" 'rmail-summary-sort-by-subject)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
55 (define-key rmail-summary-mode-map
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
56 "\C-c\C-s\C-a" 'rmail-summary-sort-by-author)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
57 (define-key rmail-summary-mode-map
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
58 "\C-c\C-s\C-r" 'rmail-summary-sort-by-recipient)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
59 (define-key rmail-summary-mode-map
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
60 "\C-c\C-s\C-c" 'rmail-summary-sort-by-correspondent)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
61 (define-key rmail-summary-mode-map
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
62 "\C-c\C-s\C-l" 'rmail-summary-sort-by-lines)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
63 ))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
64
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
65
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
66 ;; Sorting messages in Rmail buffer
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (defun rmail-sort-by-date (reverse)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 "Sort messages of current Rmail file by date.
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 If prefix argument REVERSE is non-nil, sort them in reverse order."
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 (interactive "P")
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 (rmail-sort-messages reverse
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 (function
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 (lambda (msg)
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
75 (rmail-make-date-sortable
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 (rmail-fetch-field msg "Date"))))))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (defun rmail-sort-by-subject (reverse)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 "Sort messages of current Rmail file by subject.
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 If prefix argument REVERSE is non-nil, sort them in reverse order."
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (interactive "P")
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (rmail-sort-messages reverse
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (function
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (lambda (msg)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (let ((key (or (rmail-fetch-field msg "Subject") ""))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (case-fold-search t))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;; Remove `Re:'
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (if (string-match "^\\(re:[ \t]+\\)*" key)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (substring key (match-end 0)) key))))))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (defun rmail-sort-by-author (reverse)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 "Sort messages of current Rmail file by author.
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 If prefix argument REVERSE is non-nil, sort them in reverse order."
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (interactive "P")
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (rmail-sort-messages reverse
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (function
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 (lambda (msg)
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
98 (downcase ;Canonical name
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
99 (mail-strip-quoted-names
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
100 (or (rmail-fetch-field msg "From")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
101 (rmail-fetch-field msg "Sender") "")))))))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (defun rmail-sort-by-recipient (reverse)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 "Sort messages of current Rmail file by recipient.
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 If prefix argument REVERSE is non-nil, sort them in reverse order."
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (interactive "P")
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (rmail-sort-messages reverse
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (function
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (lambda (msg)
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
110 (downcase ;Canonical name
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
111 (mail-strip-quoted-names
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
112 (or (rmail-fetch-field msg "To")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
113 (rmail-fetch-field msg "Apparently-To") "")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
114 ))))))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115
131
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
116 (defun rmail-sort-by-correspondent (reverse)
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
117 "Sort messages of current Rmail file by other correspondent.
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
118 If prefix argument REVERSE is non-nil, sort them in reverse order."
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
119 (interactive "P")
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
120 (rmail-sort-messages reverse
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
121 (function
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
122 (lambda (msg)
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
123 (rmail-select-correspondent
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
124 msg
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
125 '("From" "Sender" "To" "Apparently-To"))))))
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
126
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
127 (defun rmail-select-correspondent (msg fields)
d4c523560fe8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 92
diff changeset
128 (let ((ans ""))
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
129 (while (and fields (string= ans ""))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
130 (setq ans
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
131 (rmail-dont-reply-to
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
132 (mail-strip-quoted-names
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
133 (or (rmail-fetch-field msg (car fields)) ""))))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
134 (setq fields (cdr fields)))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
135 ans))
148
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
136
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
137 (defun rmail-sort-by-lines (reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
138 "Sort messages of current Rmail file by lines of the message.
148
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
139 If prefix argument REVERSE is non-nil, sort them in reverse order."
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
140 (interactive "P")
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
141 (rmail-sort-messages reverse
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
142 (function
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
143 (lambda (msg)
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
144 (count-lines (rmail-msgbeg msgnum)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
145 (rmail-msgend msgnum))))))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
147 ;; Sorting messages in Rmail Summary buffer.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
148
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
149 (defun rmail-summary-sort-by-date (reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
150 "Sort messages of current Rmail summary by date.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
151 If prefix argument REVERSE is non-nil, sort them in reverse order."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
152 (interactive "P")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
153 (rmail-sort-from-summary (function rmail-sort-by-date) reverse))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
154
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
155 (defun rmail-summary-sort-by-subject (reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
156 "Sort messages of current Rmail summary by subject.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
157 If prefix argument REVERSE is non-nil, sort them in reverse order."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
158 (interactive "P")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
159 (rmail-sort-from-summary (function rmail-sort-by-subject) reverse))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
160
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
161 (defun rmail-summary-sort-by-author (reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
162 "Sort messages of current Rmail summary by author.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
163 If prefix argument REVERSE is non-nil, sort them in reverse order."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
164 (interactive "P")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
165 (rmail-sort-from-summary (function rmail-sort-by-author) reverse))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
167 (defun rmail-summary-sort-by-recipient (reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
168 "Sort messages of current Rmail summary by recipient.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
169 If prefix argument REVERSE is non-nil, sort them in reverse order."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
170 (interactive "P")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
171 (rmail-sort-from-summary (function rmail-sort-by-recipient) reverse))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
172
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
173 (defun rmail-summary-sort-by-correspondent (reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
174 "Sort messages of current Rmail summary by other correspondent.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
175 If prefix argument REVERSE is non-nil, sort them in reverse order."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
176 (interactive "P")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
177 (rmail-sort-from-summary (function rmail-sort-by-correspondent) reverse))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
178
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
179 (defun rmail-summary-sort-by-lines (reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
180 "Sort messages of current Rmail summary by lines of the message.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
181 If prefix argument REVERSE is non-nil, sort them in reverse order."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
182 (interactive "P")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
183 (rmail-sort-from-summary (function rmail-sort-by-lines) reverse))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
184
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
185
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
186 ;; Basic functions
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
187
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
188 (defun rmail-sort-messages (reverse keyfun)
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 "Sort messages of current Rmail file.
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
190 If 1st argument REVERSE is non-nil, sort them in reverse order.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
191 2nd argument KEYFUN is called with a message number, and should return a key."
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 (let ((buffer-read-only nil)
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
193 (predicate nil) ;< or string-lessp
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (sort-lists nil))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (message "Finding sort keys...")
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (widen)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (let ((msgnum 1))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (while (>= rmail-total-messages msgnum)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (setq sort-lists
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
200 (cons (list (funcall keyfun msgnum) ;Make sorting key
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
201 (eq rmail-current-message msgnum) ;True if current
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
202 (aref rmail-message-vector msgnum)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
203 (aref rmail-message-vector (1+ msgnum)))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 sort-lists))
148
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
205 (if (zerop (% msgnum 10))
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
206 (message "Finding sort keys...%d" msgnum))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 (setq msgnum (1+ msgnum))))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 (or reverse (setq sort-lists (nreverse sort-lists)))
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
209 ;; Decide predicate: < or string-lessp
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
210 (if (numberp (car (car sort-lists))) ;Is a key numeric?
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
211 (setq predicate (function <))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
212 (setq predicate (function string-lessp)))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (setq sort-lists
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 (sort sort-lists
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 (function
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 (lambda (a b)
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
217 (funcall predicate (car a) (car b))))))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 (if reverse (setq sort-lists (nreverse sort-lists)))
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
219 ;; Now we enter critical region. So, keyboard quit is disabled.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
220 (message "Reordering messages...")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
221 (let ((inhibit-quit t) ;Inhibit quit
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
222 (current-message nil)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
223 (msgnum 1)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
224 (msginfo nil))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
225 ;; There's little hope that we can easily undo after that.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
226 (buffer-flush-undo (current-buffer))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
227 (goto-char (rmail-msgbeg 1))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
228 ;; To force update of all markers.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
229 (insert-before-markers ?Z)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
230 (backward-char 1)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
231 ;; Now reorder messages.
148
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
232 (while sort-lists
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
233 (setq msginfo (car sort-lists))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
234 ;; Swap two messages.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
235 (insert-buffer-substring
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
236 (current-buffer) (nth 2 msginfo) (nth 3 msginfo))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
237 (delete-region (nth 2 msginfo) (nth 3 msginfo))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
238 ;; Is current message?
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
239 (if (nth 1 msginfo)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
240 (setq current-message msgnum))
148
a099f0c77321 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 131
diff changeset
241 (setq sort-lists (cdr sort-lists))
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
242 (if (zerop (% msgnum 10))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
243 (message "Reordering messages...%d" msgnum))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
244 (setq msgnum (1+ msgnum)))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
245 ;; Delete the garbage inserted before.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
246 (delete-char 1)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
247 (setq quit-flag nil)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
248 (buffer-enable-undo)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
249 (rmail-set-message-counters)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
250 (rmail-show-message current-message))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
251 ))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
252
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
253 (defun rmail-sort-from-summary (sortfun reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
254 "Sort Rmail messages from Summary buffer and update it after sorting."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
255 (pop-to-buffer rmail-buffer)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
256 (funcall sortfun reverse)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
257 (rmail-summary))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 (defun rmail-fetch-field (msg field)
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
260 "Return the value of the header FIELD of MSG.
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 Arguments are MSG and FIELD."
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
262 (save-restriction
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
263 (widen)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
264 (let ((next (rmail-msgend msg)))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (goto-char (rmail-msgbeg msg))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (narrow-to-region (if (search-forward "\n*** EOOH ***\n" next t)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 (point)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 (forward-line 1)
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 (point))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (progn (search-forward "\n\n" nil t) (point)))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 (mail-fetch-field field))))
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
273 (defun rmail-make-date-sortable (date)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
274 "Make DATE sortable using the function string-lessp."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
275 ;; Assume the default time zone is GMT.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
276 (timezone-make-date-sortable date "GMT" "GMT"))
90
92266e9b90bb Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277
3133
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
278 ;; Copy of the function gnus-comparable-date in gnus.el version 3.13
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
279 ;
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
280 ;(defun rmail-make-date-sortable (date)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
281 ; "Make sortable string by string-lessp from DATE."
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
282 ; (let ((month '(("JAN" . " 1")("FEB" . " 2")("MAR" . " 3")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
283 ; ("APR" . " 4")("MAY" . " 5")("JUN" . " 6")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
284 ; ("JUL" . " 7")("AUG" . " 8")("SEP" . " 9")
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
285 ; ("OCT" . "10")("NOV" . "11")("DEC" . "12")))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
286 ; (date (or date "")))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
287 ; ;; Can understand the following styles:
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
288 ; ;; (1) 14 Apr 89 03:20:12 GMT
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
289 ; ;; (2) Fri, 17 Mar 89 4:01:33 GMT
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
290 ; (if (string-match
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
291 ; "\\([0-9]+\\) \\([^ ,]+\\) \\([0-9]+\\) \\([0-9:]+\\)" date)
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
292 ; (concat
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
293 ; ;; Year
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
294 ; (substring date (match-beginning 3) (match-end 3))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
295 ; ;; Month
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
296 ; (cdr
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
297 ; (assoc
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
298 ; (upcase (substring date (match-beginning 2) (match-end 2))) month))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
299 ; ;; Day
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
300 ; (format "%2d" (string-to-int
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
301 ; (substring date
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
302 ; (match-beginning 1) (match-end 1))))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
303 ; ;; Time
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
304 ; (substring date (match-beginning 4) (match-end 4)))
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
305 ; ;; Cannot understand DATE string.
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
306 ; date
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
307 ; )
2c1553d7aad1 New version from Umeda. Needs detailed entry.
Richard M. Stallman <rms@gnu.org>
parents: 2851
diff changeset
308 ; ))
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 150
diff changeset
309
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 150
diff changeset
310 (provide 'rmailsort)
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
311
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
312 ;;; rmailsort.el ends here