Initial Commit
[packages] / xemacs-packages / mew / mew / contrib / mew-ml.el
1 ;; -*- emacs-lisp -*-
2 ;;
3 ;; name: mew-ml.el
4 ;; version: 0.1
5 ;; description: some mailing list support for mew
6 ;; creation date: 1998-11-18
7 ;; author: "Sen Nagata" <sen@eccosys.com>
8 ;; warning: not optimized at all
9
10 ;; required:
11 ;;
12 ;;   -mew (tested for 1.93)
13 ;;   -mew-mailto.el (mew-mailto.el depends on mailto.el)
14
15 ;; installation:
16 ;;
17 ;;   -put this file (mew-mailto.el and mailto.el) in an appropriate 
18 ;;    directory (so emacs can find it)
19 ;;
20 ;;   <necessary>
21 ;;   -put:
22 ;;
23 ;;     (add-hook 'mew-init-hook (lambda () (require 'mew-ml)))
24 ;;
25 ;;    in your .emacs file.
26 ;;
27 ;;   <optional>
28 ;;   -for key-bindings put (haven't tested for xemacs yet):
29 ;;
30 ;;     (add-hook 
31 ;;       'mew-summary-mode-hook
32 ;;       (lambda () 
33 ;;         (define-key mew-summary-mode-map 
34 ;;           "ch" 'mew-ml-compose-help-message)
35 ;;         (define-key mew-summary-mode-map 
36 ;;           "cu" 'mew-ml-compose-unsubscribe-message)
37 ;;         (define-key mew-summary-mode-map 
38 ;;           "cs" 'mew-ml-compose-subscribe-message)
39 ;;         (define-key mew-summary-mode-map 
40 ;;           "cp" 'mew-ml-compose-post-message)
41 ;;         (define-key mew-summary-mode-map 
42 ;;           "co" 'mew-ml-compose-owner-message)))
43 ;;
44 ;;    in your .emacs file.
45 ;;
46 ;;   <optional>
47 ;;   -for enhancing the menu for summary mode, put:
48 ;;
49 ;;     (defvar mew-ml-menu-spec
50 ;;       '("Mailing List"
51 ;;         ["Help msg" 
52 ;;          mew-ml-compose-help-message t]
53 ;;         ["Unsubscribe msg" 
54 ;;          mew-ml-compose-unsubscribe-message t]
55 ;;         ["Subscribe msg"
56 ;;          mew-ml-compose-subscribe-message t]
57 ;;         ["Post msg"
58 ;;          mew-ml-compose-post-message t]
59 ;;         ["Owner msg"
60 ;;          mew-ml-compose-owner-message t]
61 ;;         ))
62 ;;    
63 ;;     (add-hook
64 ;;      'mew-summary-mode-hook
65 ;;      (lambda ()
66 ;;        (setq mew-summary-mode-menu-spec 
67 ;;        (nconc mew-summary-mode-menu-spec 
68 ;;              (list "----" 
69 ;;                    mew-ml-menu-spec)))
70 ;;        ;; got this section from mew-summary.el
71 ;;        (easy-menu-define
72 ;;         mew-summary-mode-menu
73 ;;         mew-summary-mode-map
74 ;;         "Menu used in Summary mode."
75 ;;         mew-summary-mode-menu-spec)))
76 ;;
77 ;;   in your .emacs.
78
79 ;; details:
80 ;;
81 ;;   this package provides a number of interactive functions
82 ;; (commands) for the user.  each of the commands ultimately creates a
83 ;; draft message based on some information.  the names of the commands
84 ;; and brief descriptions are:
85 ;;
86 ;;        mew-ml-compose-*-message
87 ;;            make a draft message from one of the corresponding
88 ;;            List-* headers (Unsubscribe, Subscribe, etc.).  if no such 
89 ;;            header is detected, the user is notified via 'message'.
90 ;;
91 ;;   note: i don't use xemacs that often so i don't test it as much.
92
93 ;; usage:
94 ;;
95 ;;   -invoke mew
96 ;;   -try out the commands mentioned above in 'details'
97 ;;   -you can also try the commands via the menu now
98
99 ;; notes and todo:
100 ;;
101 ;;   -see TODO items in code
102 ;;   -place the menu and keybinding 'hook' stuff mentioned above into a 
103 ;;    separate file and suggest that the user 'require'/'load' this via 
104 ;;    their .emacs file?  another possibility is just to set up our own
105 ;;    menus...seems kind of ugly though.
106 ;;   -keybindings and menu items -> is there a good way to modify the
107 ;;    existing menus for mew?  (is that a bad idea?)
108 ;;   -support some kind of warning message for messages which should be
109 ;;    edited (e.g. subscribe messages requiring names).  there isn't a
110 ;;    standard solution for this yet (for a discussion, see section A.5 of rfc
111 ;;    2368)
112 ;;   -i've used this code w/ emacs versions >= 20.3
113 ;;   -test w/ xemacs -- not at all sure of the menu and keybinding stuff
114 ;;   -prepare a test suite...
115
116 ;; how should we handle the dependecy on mew?
117 ;; doing the following seems to have catastrophic effects on my machine :-(
118 ;(require 'mew)
119
120 ;; will this work?
121 (eval-when-compile 
122   (require 'mew))
123
124 (defconst mew-ml-version "mew-ml.el 0.1")
125
126 ;; use mew-mailto support -- should be useable for things other than mew too
127 (require 'mew-mailto)
128
129 ;; notes:
130 ;;
131 ;; 1) i am not clear on whether mew-mailto-compose-message-from-header
132 ;;    returns
133 ;;
134 ;; 2) perhaps i should do the below w/ macros?
135 ;;
136 ;; 3) see 'mew-summary-reply' for a way to deal w/ the case when point
137 ;;    is not on a row w/ a message (located after all of the rows
138 ;;    representing messages) -> TODO
139 ;;
140 ;; 4) figure out a way to provide similar functionality when point is
141 ;;    is in message mode -> TODO
142
143 (defun mew-ml-compose-help-message ()
144   (interactive)
145   (if (not (mew-mailto-compose-message-from-header "List-Help"))
146       (message 
147        "There does not appear to be a List-Help: header in this message."))
148   )
149
150 (defun mew-ml-compose-unsubscribe-message ()
151   (interactive)
152   (if (not (mew-mailto-compose-message-from-header "List-Unsubscribe"))
153       (message 
154        "There does not appear to be a List-Unsubscribe: header in this message."))
155   )
156
157 (defun mew-ml-compose-subscribe-message ()
158   (interactive)
159   (if (not (mew-mailto-compose-message-from-header "List-Subscribe"))
160       (message
161        "There does not appear to be a List-Subscribe: header in this message."))
162   )
163
164 (defun mew-ml-compose-post-message ()
165   (interactive)
166   (if (not (mew-mailto-compose-message-from-header "List-Post"))
167       (message
168        "There does not appear to be a List-Post: header in this message."))
169   )
170
171 (defun mew-ml-compose-owner-message ()
172   (interactive)
173   (if (not (mew-mailto-compose-message-from-header "List-Owner"))
174       (message
175        "There does not appear to be a List-Owner: header in this message."))
176   )
177
178 ;; since this will be used via 'require'...
179 (provide 'mew-ml)