Mercurial > emacs
annotate lisp/mail/pmailsort.el @ 100078:92f7e2af2df4
Checked programs.texi.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 30 Nov 2008 22:10:20 +0000 |
parents | a82fd29a3a12 |
children | 84fb073c79f6 |
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 |
97808
1aab9bdd9355
Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents:
97533
diff
changeset
|
36 (declare-function pmail-update-summary "pmailsum" (&rest ignore)) |
1aab9bdd9355
Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents:
97533
diff
changeset
|
37 |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
38 ;; 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
|
39 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
40 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
41 (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
|
42 "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
|
43 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
|
44 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
45 (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
|
46 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
47 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
48 (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
|
49 (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
|
50 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
51 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
52 (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
|
53 "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
|
54 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
|
55 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
56 (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
|
57 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
58 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
59 (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
|
60 (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
|
61 ;; Remove `Re:' |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
62 (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
|
63 (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
|
64 key)))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
65 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
66 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
67 (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
|
68 "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
|
69 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
|
70 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
71 (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
|
72 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
73 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
74 (downcase ;Canonical name |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
75 (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
|
76 (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
|
77 (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
|
78 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
79 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
80 (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
|
81 "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
|
82 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
|
83 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
84 (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
|
85 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
86 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
87 (downcase ;Canonical name |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
88 (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
|
89 (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
|
90 (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
|
91 )))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
92 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
93 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
94 (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
|
95 "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
|
96 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
|
97 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
98 (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
|
99 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
100 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
101 (pmail-select-correspondent |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
102 msg |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
103 '("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
|
104 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
105 (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
|
106 (let ((ans "")) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
107 (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
|
108 (setq ans |
98017
4f69bd0a8c9f
(pmail-dont-reply-to, pmail-desc-get-marker-end)
Glenn Morris <rgm@gnu.org>
parents:
97808
diff
changeset
|
109 ;; NB despite the name, this lives in mail-utils.el. |
4f69bd0a8c9f
(pmail-dont-reply-to, pmail-desc-get-marker-end)
Glenn Morris <rgm@gnu.org>
parents:
97808
diff
changeset
|
110 (rmail-dont-reply-to |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
111 (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
|
112 (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
|
113 (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
|
114 ans)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
115 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
116 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
117 (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
|
118 "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
|
119 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
|
120 (interactive "P") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
121 (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
|
122 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
123 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
124 (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
|
125 (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
|
126 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
127 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
128 (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
|
129 "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
|
130 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
|
131 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
|
132 (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
|
133 (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
|
134 (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
|
135 (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
|
136 (let (labelvec) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
137 (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
|
138 (setq labelvec (cons |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
139 (concat ", ?\\(" |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
140 (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
|
141 "\\),") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
142 labelvec)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
143 (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
|
144 (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
|
145 (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
|
146 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
147 (lambda (msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
148 (let ((n 0)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
149 (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
|
150 (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
|
151 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
|
152 (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
|
153 n)))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
154 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
155 ;; Basic functions |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
156 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
157 (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
|
158 "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
|
159 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
|
160 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
|
161 (save-current-buffer |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
162 ;; 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
|
163 (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
|
164 (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
|
165 (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
|
166 (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
|
167 (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
|
168 (sort-lists nil)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
169 (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
|
170 (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
|
171 (widen) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
172 (let ((msgnum 1)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
173 (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
|
174 (setq sort-lists |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
175 (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
|
176 (eq pmail-current-message msgnum) ;True if current |
98049
a82fd29a3a12
(pmail-sort-messages): Use pmail-desc-get-start, pmail-desc-get-end
Glenn Morris <rgm@gnu.org>
parents:
98019
diff
changeset
|
177 (pmail-desc-get-start msgnum) |
a82fd29a3a12
(pmail-sort-messages): Use pmail-desc-get-start, pmail-desc-get-end
Glenn Morris <rgm@gnu.org>
parents:
98019
diff
changeset
|
178 (pmail-desc-get-end msgnum)) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
179 sort-lists)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
180 (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
|
181 (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
|
182 (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
|
183 (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
|
184 ;; 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
|
185 (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
|
186 (setq predicate (function <)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
187 (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
|
188 (setq sort-lists |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
189 (sort sort-lists |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
190 (function |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
191 (lambda (a b) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
192 (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
|
193 (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
|
194 ;; 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
|
195 (message "Reordering messages...") |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
196 (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
|
197 (current-message nil) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
198 (msgnum 1) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
199 (msginfo nil)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
200 ;; 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
|
201 (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
|
202 (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
|
203 ;; 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
|
204 (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
|
205 (backward-char 1) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
206 ;; Now reorder messages. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
207 (while sort-lists |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
208 (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
|
209 ;; Swap two messages. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
210 (insert-buffer-substring |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
211 (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
|
212 (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
|
213 ;; Is current message? |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
214 (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
|
215 (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
|
216 (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
|
217 (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
|
218 (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
|
219 (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
|
220 ;; 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
|
221 (delete-char 1) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
222 (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
|
223 (buffer-enable-undo) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
224 (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
|
225 (pmail-initialize-messages) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
226 (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
|
227 (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
|
228 (pmail-select-summary |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
229 (pmail-update-summary))))))) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
230 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
231 ;; mbox: ready |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
232 (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
|
233 "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
|
234 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
|
235 (save-restriction |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
236 (widen) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
237 (narrow-to-region |
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-start msg) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
239 (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
|
240 (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
|
241 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
242 (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
|
243 "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
|
244 ;; 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
|
245 (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
|
246 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
247 (provide 'pmailsort) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
248 |
98019
72564311fb7b
Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents:
98017
diff
changeset
|
249 ;; Local Variables: |
72564311fb7b
Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents:
98017
diff
changeset
|
250 ;; change-log-default-name: "ChangeLog.pmail" |
72564311fb7b
Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents:
98017
diff
changeset
|
251 ;; End: |
72564311fb7b
Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents:
98017
diff
changeset
|
252 |
97533 | 253 ;; 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
|
254 ;;; pmailsort.el ends here |