88155
|
1 ;;; mh-inc.el --- MH-E "inc" and separate mail spool handling
|
|
2 ;;
|
|
3 ;; Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
|
|
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., 51 Franklin Street, Fifth Floor,
|
|
25 ;; Boston, MA 02110-1301, 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
|
|
37 ;;(message "> mh-inc")
|
|
38 (eval-when-compile (require 'mh-acros))
|
|
39 (mh-require-cl)
|
|
40 ;;(message "< mh-inc")
|
|
41
|
|
42 (defvar mh-inc-spool-map (make-sparse-keymap)
|
|
43 "Keymap for MH-E's mh-inc-spool commands.")
|
|
44
|
|
45 (defvar mh-inc-spool-map-help nil
|
|
46 "Help text to for `mh-inc-spool-map'.")
|
|
47
|
|
48 (define-key mh-inc-spool-map "?"
|
|
49 '(lambda ()
|
|
50 (interactive)
|
|
51 (if mh-inc-spool-map-help
|
|
52 (let ((mh-help-messages (list (list nil mh-inc-spool-map-help))))
|
|
53 (mh-help))
|
|
54 (mh-ephem-message
|
|
55 "There are no keys defined yet. Customize `mh-inc-spool-list'"))))
|
|
56
|
|
57 (defun mh-inc-spool-generator (folder spool)
|
|
58 "Create a command to inc into FOLDER from SPOOL file."
|
|
59 (let ((folder1 (make-symbol "folder"))
|
|
60 (spool1 (make-symbol "spool")))
|
|
61 (set folder1 folder)
|
|
62 (set spool1 spool)
|
|
63 (setf (symbol-function (intern (concat "mh-inc-spool-" folder)))
|
|
64 `(lambda ()
|
|
65 ,(format "Inc spool file %s into folder %s" spool folder)
|
|
66 (interactive)
|
|
67 (mh-inc-folder ,spool1 (concat "+" ,folder1))))))
|
|
68
|
|
69 (defun mh-inc-spool-def-key (key folder)
|
|
70 "Define a KEY in `mh-inc-spool-map' to inc FOLDER and collect help string."
|
|
71 (when (not (= 0 key))
|
|
72 (define-key mh-inc-spool-map (format "%c" key)
|
|
73 (intern (concat "mh-inc-spool-" folder)))
|
|
74 (setq mh-inc-spool-map-help (concat mh-inc-spool-map-help "["
|
|
75 (char-to-string key)
|
|
76 "] inc " folder " folder\n"))))
|
|
77
|
|
78 ;; Shush compiler.
|
|
79 (eval-when-compile (defvar mh-inc-spool-list))
|
|
80
|
|
81 (defun mh-inc-spool-make ()
|
|
82 "Make all commands and defines keys for contents of `mh-inc-spool-list'."
|
|
83 (when mh-inc-spool-list
|
|
84 (setq mh-inc-spool-map-help nil)
|
|
85 (loop for elem in mh-inc-spool-list
|
|
86 do (let ((spool (nth 0 elem))
|
|
87 (folder (nth 1 elem))
|
|
88 (key (nth 2 elem)))
|
|
89 (progn
|
|
90 (mh-inc-spool-generator folder spool)
|
|
91 (mh-inc-spool-def-key key folder))))))
|
|
92
|
|
93 ;;;###mh-autoload
|
|
94 (defun mh-inc-spool-list-set (symbol value)
|
|
95 "Set-default SYMBOL to VALUE to update the `mh-inc-spool-list' variable.
|
|
96 Also rebuilds the user commands.
|
|
97 This is called after 'customize is used to alter `mh-inc-spool-list'."
|
|
98 (set-default symbol value)
|
|
99 (mh-inc-spool-make))
|
|
100
|
|
101 (provide 'mh-inc)
|
|
102
|
|
103 ;; Local Variables:
|
|
104 ;; indent-tabs-mode: nil
|
|
105 ;; sentence-end-double-space: nil
|
|
106 ;; End:
|
|
107
|
|
108 ;; arch-tag: 3713cf2a-6082-4cb4-8ce2-99d9acaba835
|
|
109 ;;; mh-inc.el ends here
|