Mercurial > emacs
annotate lisp/mail/pmailsort.el @ 97688:fea1fc8fb2e8
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 24 Aug 2008 19:06:36 +0000 |
parents | ec1125c7ac26 |
children | 1aab9bdd9355 |
rev | line source |
---|---|
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
1 ;;; pmailsort.el --- Pmail: sort messages |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
2 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
3 ;; Copyright (C) 1990, 1993, 1994, 2001, 2002, 2003, 2004, |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
5 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
6 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp> |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
7 ;; Maintainer: FSF |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
8 ;; Keywords: mail |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
9 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
11 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
15 ;; (at your option) any later version. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
16 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
21 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
24 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
25 ;;; Commentary: |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
26 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
27 ;;; Code: |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
28 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
29 (eval-when-compile |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
30 (require 'mail-utils) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
31 (require 'sort) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
32 (require 'pmail)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
33 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
34 (autoload 'timezone-make-date-sortable "timezone") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
35 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
36 ;; Sorting messages in Pmail buffer |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
37 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
38 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
39 (defun pmail-sort-by-date (reverse) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
40 "Sort messages of current Pmail file by date. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
41 If prefix argument REVERSE is non-nil, sort them in reverse order." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
42 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
43 (pmail-sort-messages reverse |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
44 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
45 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
46 (pmail-make-date-sortable |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
47 (pmail-fetch-field msg "Date")))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
48 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
49 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
50 (defun pmail-sort-by-subject (reverse) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
51 "Sort messages of current Pmail file by subject. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
52 If prefix argument REVERSE is non-nil, sort them in reverse order." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
53 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
54 (pmail-sort-messages reverse |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
55 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
56 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
57 (let ((key (or (pmail-fetch-field msg "Subject") "")) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
58 (case-fold-search t)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
59 ;; Remove `Re:' |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
60 (if (string-match "^\\(re:[ \t]*\\)*" key) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
61 (substring key (match-end 0)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
62 key)))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
63 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
64 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
65 (defun pmail-sort-by-author (reverse) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
66 "Sort messages of current Pmail file by author. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
67 If prefix argument REVERSE is non-nil, sort them in reverse order." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
68 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
69 (pmail-sort-messages reverse |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
70 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
71 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
72 (downcase ;Canonical name |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
73 (mail-strip-quoted-names |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
74 (or (pmail-fetch-field msg "From") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
75 (pmail-fetch-field msg "Sender") ""))))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
76 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
77 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
78 (defun pmail-sort-by-recipient (reverse) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
79 "Sort messages of current Pmail file by recipient. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
80 If prefix argument REVERSE is non-nil, sort them in reverse order." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
81 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
82 (pmail-sort-messages reverse |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
83 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
84 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
85 (downcase ;Canonical name |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
86 (mail-strip-quoted-names |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
87 (or (pmail-fetch-field msg "To") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
88 (pmail-fetch-field msg "Apparently-To") "") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
89 )))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
90 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
91 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
92 (defun pmail-sort-by-correspondent (reverse) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
93 "Sort messages of current Pmail file by other correspondent. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
94 If prefix argument REVERSE is non-nil, sort them in reverse order." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
95 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
96 (pmail-sort-messages reverse |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
97 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
98 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
99 (pmail-select-correspondent |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
100 msg |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
101 '("From" "Sender" "To" "Apparently-To")))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
102 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
103 (defun pmail-select-correspondent (msg fields) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
104 (let ((ans "")) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
105 (while (and fields (string= ans "")) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
106 (setq ans |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
107 (pmail-dont-reply-to |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
108 (mail-strip-quoted-names |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
109 (or (pmail-fetch-field msg (car fields)) "")))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
110 (setq fields (cdr fields))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
111 ans)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
112 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
113 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
114 (defun pmail-sort-by-lines (reverse) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
115 "Sort messages of current Pmail file by number of lines. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
116 If prefix argument REVERSE is non-nil, sort them in reverse order." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
117 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
118 (pmail-sort-messages reverse |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
119 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
120 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
121 (count-lines (pmail-desc-get-start msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
122 (pmail-desc-get-end msg)))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
123 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
124 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
125 (defun pmail-sort-by-labels (reverse labels) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
126 "Sort messages of current Pmail file by labels. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
127 If prefix argument REVERSE is non-nil, sort them in reverse order. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
128 KEYWORDS is a comma-separated list of labels." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
129 (interactive "P\nsSort by labels: ") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
130 (or (string-match "[^ \t]" labels) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
131 (error "No labels specified")) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
132 (setq labels (concat (substring labels (match-beginning 0)) ",")) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
133 (let (labelvec) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
134 (while (string-match "[ \t]*,[ \t]*" labels) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
135 (setq labelvec (cons |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
136 (concat ", ?\\(" |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
137 (substring labels 0 (match-beginning 0)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
138 "\\),") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
139 labelvec)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
140 (setq labels (substring labels (match-end 0)))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
141 (setq labelvec (apply 'vector (nreverse labelvec))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
142 (pmail-sort-messages reverse |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
143 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
144 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
145 (let ((n 0)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
146 (while (and (< n (length labelvec)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
147 (not (pmail-message-labels-p |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
148 msg (aref labelvec n)))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
149 (setq n (1+ n))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
150 n)))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
151 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
152 ;; Basic functions |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
153 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
154 (declare-function pmail-update-summary "pmailsum" (&rest ignore)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
155 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
156 (defun pmail-sort-messages (reverse keyfun) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
157 "Sort messages of current Pmail file. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
158 If 1st argument REVERSE is non-nil, sort them in reverse order. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
159 2nd argument KEYFUN is called with a message number, and should return a key." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
160 (save-current-buffer |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
161 ;; If we are in a summary buffer, operate on the Pmail buffer. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
162 (if (eq major-mode 'pmail-summary-mode) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
163 (set-buffer pmail-buffer)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
164 (let ((buffer-read-only nil) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
165 (point-offset (- (point) (point-min))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
166 (predicate nil) ;< or string-lessp |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
167 (sort-lists nil)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
168 (message "Finding sort keys...") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
169 (pmail-header-show-headers) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
170 (widen) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
171 (let ((msgnum 1)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
172 (while (>= pmail-total-messages msgnum) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
173 (setq sort-lists |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
174 (cons (list (funcall keyfun msgnum) ;Make sorting key |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
175 (eq pmail-current-message msgnum) ;True if current |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
176 (pmail-desc-get-marker-start msgnum) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
177 (pmail-desc-get-marker-end msgnum)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
178 sort-lists)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
179 (if (zerop (% msgnum 10)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
180 (message "Finding sort keys...%d" msgnum)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
181 (setq msgnum (1+ msgnum)))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
182 (or reverse (setq sort-lists (nreverse sort-lists))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
183 ;; Decide predicate: < or string-lessp |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
184 (if (numberp (car (car sort-lists))) ;Is a key numeric? |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
185 (setq predicate (function <)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
186 (setq predicate (function string-lessp))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
187 (setq sort-lists |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
188 (sort sort-lists |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
189 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
190 (lambda (a b) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
191 (funcall predicate (car a) (car b)))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
192 (if reverse (setq sort-lists (nreverse sort-lists))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
193 ;; Now we enter critical region. So, keyboard quit is disabled. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
194 (message "Reordering messages...") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
195 (let ((inhibit-quit t) ;Inhibit quit |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
196 (current-message nil) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
197 (msgnum 1) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
198 (msginfo nil)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
199 ;; There's little hope that we can easily undo after that. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
200 (buffer-disable-undo (current-buffer)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
201 (goto-char (pmail-desc-get-start 1)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
202 ;; To force update of all markers. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
203 (insert-before-markers ?Z) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
204 (backward-char 1) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
205 ;; Now reorder messages. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
206 (while sort-lists |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
207 (setq msginfo (car sort-lists)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
208 ;; Swap two messages. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
209 (insert-buffer-substring |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
210 (current-buffer) (nth 2 msginfo) (nth 3 msginfo)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
211 (delete-region (nth 2 msginfo) (nth 3 msginfo)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
212 ;; Is current message? |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
213 (if (nth 1 msginfo) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
214 (setq current-message msgnum)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
215 (setq sort-lists (cdr sort-lists)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
216 (if (zerop (% msgnum 10)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
217 (message "Reordering messages...%d" msgnum)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
218 (setq msgnum (1+ msgnum))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
219 ;; Delete the garbage inserted before. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
220 (delete-char 1) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
221 (setq quit-flag nil) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
222 (buffer-enable-undo) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
223 (goto-char (point-min)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
224 (pmail-initialize-messages) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
225 (pmail-show-message current-message) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
226 (if (pmail-summary-exists) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
227 (pmail-select-summary |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
228 (pmail-update-summary))))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
229 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
230 ;; mbox: ready |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
231 (defun pmail-fetch-field (msg field) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
232 "Return the value of the header FIELD of MSG. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
233 Arguments are MSG and FIELD." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
234 (save-restriction |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
235 (widen) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
236 (narrow-to-region |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
237 (pmail-desc-get-start msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
238 (pmail-desc-get-end msg)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
239 (pmail-header-get-header field))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
240 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
241 (defun pmail-make-date-sortable (date) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
242 "Make DATE sortable using the function string-lessp." |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
243 ;; Assume the default time zone is GMT. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
244 (timezone-make-date-sortable date "GMT" "GMT")) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
245 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
246 (provide 'pmailsort) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
247 |
97533 | 248 ;; arch-tag: 665da245-f6a7-4115-ad8c-ba19216988d5 |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
249 ;;; pmailsort.el ends here |