Commit | Line | Data |
---|---|---|
5a4aad03 | 1 | ;;; mh-inc.el --- MH-E "inc" and separate mail spool handling |
dda00b2c | 2 | |
ba318903 | 3 | ;; Copyright (C) 2003-2004, 2006-2014 Free Software Foundation, Inc. |
924df208 BW |
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 | ||
5e809f55 | 12 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
924df208 | 13 | ;; it under the terms of the GNU General Public License as published by |
5e809f55 GM |
14 | ;; the Free Software Foundation, either version 3 of the License, or |
15 | ;; (at your option) any later version. | |
924df208 BW |
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 | |
5e809f55 | 23 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
924df208 BW |
24 | |
25 | ;;; Commentary: | |
26 | ||
dda00b2c BW |
27 | ;; Support for inc. In addition to reading from the system mailbox, |
28 | ;; inc can also be used to incorporate mail from multiple spool files | |
29 | ;; into separate folders. See "C-h v mh-inc-spool-list". | |
924df208 BW |
30 | |
31 | ;;; Change Log: | |
32 | ||
33 | ;;; Code: | |
34 | ||
dda00b2c | 35 | (require 'mh-e) |
f0d73c14 | 36 | (mh-require-cl) |
924df208 BW |
37 | |
38 | (defvar mh-inc-spool-map-help nil | |
dda00b2c | 39 | "Help text for `mh-inc-spool-map'.") |
924df208 BW |
40 | |
41 | (define-key mh-inc-spool-map "?" | |
4f91a816 SM |
42 | (lambda () |
43 | (interactive) | |
44 | (if mh-inc-spool-map-help | |
45 | (mh-help mh-inc-spool-map-help) | |
46 | (mh-ephem-message | |
47 | "There are no keys defined yet; customize `mh-inc-spool-list'")))) | |
dda00b2c BW |
48 | |
49 | ;;;###mh-autoload | |
50 | (defun mh-inc-spool-make () | |
51 | "Make all commands and defines keys for contents of `mh-inc-spool-list'." | |
52 | (setq mh-inc-spool-map-help nil) | |
53 | (when mh-inc-spool-list | |
54 | (loop for elem in mh-inc-spool-list | |
55 | do (let ((spool (nth 0 elem)) | |
56 | (folder (nth 1 elem)) | |
57 | (key (nth 2 elem))) | |
58 | (progn | |
59 | (mh-inc-spool-generator folder spool) | |
60 | (mh-inc-spool-def-key key folder)))))) | |
61 | ||
62 | (defalias 'mh-inc-spool-make-no-autoload 'mh-inc-spool-make) | |
924df208 BW |
63 | |
64 | (defun mh-inc-spool-generator (folder spool) | |
65 | "Create a command to inc into FOLDER from SPOOL file." | |
66 | (let ((folder1 (make-symbol "folder")) | |
67 | (spool1 (make-symbol "spool"))) | |
68 | (set folder1 folder) | |
69 | (set spool1 spool) | |
70 | (setf (symbol-function (intern (concat "mh-inc-spool-" folder))) | |
71 | `(lambda () | |
dda00b2c | 72 | ,(format "Inc spool file %s into folder %s." spool folder) |
924df208 BW |
73 | (interactive) |
74 | (mh-inc-folder ,spool1 (concat "+" ,folder1)))))) | |
75 | ||
76 | (defun mh-inc-spool-def-key (key folder) | |
77 | "Define a KEY in `mh-inc-spool-map' to inc FOLDER and collect help string." | |
78 | (when (not (= 0 key)) | |
79 | (define-key mh-inc-spool-map (format "%c" key) | |
80 | (intern (concat "mh-inc-spool-" folder))) | |
dda00b2c BW |
81 | (add-to-list 'mh-inc-spool-map-help |
82 | (concat "[" (char-to-string key) "] inc " folder " folder\n") | |
83 | t))) | |
924df208 BW |
84 | |
85 | (provide 'mh-inc) | |
86 | ||
cee9f5c6 BW |
87 | ;; Local Variables: |
88 | ;; indent-tabs-mode: nil | |
89 | ;; sentence-end-double-space: nil | |
90 | ;; End: | |
924df208 BW |
91 | |
92 | ;;; mh-inc.el ends here |