Mercurial > emacs
annotate lisp/mh-e/mh-inc.el @ 62678:5e23f4f57ed5
*** empty log message ***
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Tue, 24 May 2005 14:42:01 +0000 |
parents | 4f4f410e6fe8 |
children | aa8c2e12ee24 f042e7c0fe20 |
rev | line source |
---|---|
50702 | 1 ;;; mh-inc.el --- MH-E `inc' and separate mail spool handling |
2 ;; | |
62465
4f4f410e6fe8
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
56950
diff
changeset
|
3 ;; Copyright (C) 2005 Free Software Foundation, Inc. |
50702 | 4 |
5 ;; Author: Peter S. Galbraith <psg@debian.org> | |
6 ;; Maintainer: Bill Wohler <wohler@newt.com> | |
7 ;; Keywords: mail | |
8 ;; See: mh-e.el | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;; Support for inc. In addition to reading from the system mailbox, inc can | |
30 ;; also be used to incorporate mail from multiple spool files into separate | |
31 ;; folders. See `C-h v mh-inc-spool-list'. | |
32 | |
33 ;;; Change Log: | |
34 | |
35 ;;; Code: | |
36 | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
37 (eval-when-compile (require 'mh-acros)) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
38 (mh-require-cl) |
50702 | 39 |
40 (defvar mh-inc-spool-map (make-sparse-keymap) | |
41 "Keymap for MH-E's mh-inc-spool commands.") | |
42 | |
43 (defvar mh-inc-spool-map-help nil | |
44 "Help text to for `mh-inc-spool-map'.") | |
45 | |
46 (define-key mh-inc-spool-map "?" | |
47 '(lambda () | |
48 (interactive) | |
49 (if mh-inc-spool-map-help | |
56673
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
50 (let ((mh-help-messages (list (list nil mh-inc-spool-map-help)))) |
e9a6cbc8ca5e
Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents:
52401
diff
changeset
|
51 (mh-help)) |
50702 | 52 (mh-ephem-message |
53 "There are no keys defined yet. Customize `mh-inc-spool-list'")))) | |
54 | |
55 (defun mh-inc-spool-generator (folder spool) | |
56 "Create a command to inc into FOLDER from SPOOL file." | |
57 (let ((folder1 (make-symbol "folder")) | |
58 (spool1 (make-symbol "spool"))) | |
59 (set folder1 folder) | |
60 (set spool1 spool) | |
61 (setf (symbol-function (intern (concat "mh-inc-spool-" folder))) | |
62 `(lambda () | |
63 ,(format "Inc spool file %s into folder %s" spool folder) | |
64 (interactive) | |
65 (mh-inc-folder ,spool1 (concat "+" ,folder1)))))) | |
66 | |
67 (defun mh-inc-spool-def-key (key folder) | |
68 "Define a KEY in `mh-inc-spool-map' to inc FOLDER and collect help string." | |
69 (when (not (= 0 key)) | |
70 (define-key mh-inc-spool-map (format "%c" key) | |
71 (intern (concat "mh-inc-spool-" folder))) | |
72 (setq mh-inc-spool-map-help (concat mh-inc-spool-map-help "[" | |
73 (char-to-string key) | |
74 "] inc " folder " folder\n")))) | |
75 | |
76 ;; Avoid compiler warning | |
56950
244535d043c2
(mh-inc-spool-list): Correctly declare the external var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56673
diff
changeset
|
77 (defvar mh-inc-spool-list) |
50702 | 78 |
79 (defun mh-inc-spool-make () | |
80 "Make all commands and defines keys for contents of `mh-inc-spool-list'." | |
81 (when mh-inc-spool-list | |
82 (setq mh-inc-spool-map-help nil) | |
83 (loop for elem in mh-inc-spool-list | |
84 do (let ((spool (nth 0 elem)) | |
85 (folder (nth 1 elem)) | |
86 (key (nth 2 elem))) | |
87 (progn | |
88 (mh-inc-spool-generator folder spool) | |
89 (mh-inc-spool-def-key key folder)))))) | |
90 | |
91 ;;;###mh-autoload | |
92 (defun mh-inc-spool-list-set (symbol value) | |
93 "Set-default SYMBOL to VALUE to update the `mh-inc-spool-list' variable. | |
94 Also rebuilds the user commands. | |
95 This is called after 'customize is used to alter `mh-inc-spool-list'." | |
96 (set-default symbol value) | |
97 (mh-inc-spool-make)) | |
98 | |
99 (provide 'mh-inc) | |
100 | |
56950
244535d043c2
(mh-inc-spool-list): Correctly declare the external var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56673
diff
changeset
|
101 ;; Local Variables: |
244535d043c2
(mh-inc-spool-list): Correctly declare the external var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56673
diff
changeset
|
102 ;; indent-tabs-mode: nil |
244535d043c2
(mh-inc-spool-list): Correctly declare the external var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56673
diff
changeset
|
103 ;; sentence-end-double-space: nil |
244535d043c2
(mh-inc-spool-list): Correctly declare the external var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56673
diff
changeset
|
104 ;; End: |
50702 | 105 |
56950
244535d043c2
(mh-inc-spool-list): Correctly declare the external var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56673
diff
changeset
|
106 ;; arch-tag: 3713cf2a-6082-4cb4-8ce2-99d9acaba835 |
50702 | 107 ;;; mh-inc.el ends here |