annotate lisp/hyperbole/hmh.el @ 90:99da576a67e7 xemacs-20-0

Import from CVS: tag xemacs-20-0
author cvs
date Mon, 13 Aug 2007 09:10:46 +0200
parents 131b0175ea99
children 4be1180a9e89
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hmh.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Support for Hyperbole buttons in mail reader: Mh.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: hypermedia, mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
9 ;; ORG: Brown U.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; ORIG-DATE: 21-May-91 at 17:06:36
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
12 ;; LAST-MOD: 19-May-95 at 15:09:30 by Bob Weiner
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
17 ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Automatically configured for use in "hsite.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; If hsite loading fails prior to initializing Hyperbole Mh support,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
25 ;; {M-x Mh-init RTN}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; will do it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; Have not yet overloaded 'mh-yank-cur-msg' to yank and hide
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; button data from mail reader buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; Have not yet overloaded 'mh-insert-letter' to highlight buttons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; and to merge its button data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (require 'hmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (load "hsmail")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (require 'mh-e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (defun Mh-init ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 "Initializes Hyperbole support for Mh mail reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (setq hmail:composer 'mh-letter-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 hmail:lister 'mh-folder-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 hmail:modifier 'mh-letter-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 hmail:reader 'mh-show-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (var:append 'mh-show-hook '(hmail:msg-narrow Mh-hbut-highlight))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; Setup public abstract interface to Hyperbole defined mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;; reader-specific functions used in "hmail.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (rmail:init)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;; Setup private abstract interface to mail reader-specific functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;; used in "hmail.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (fset 'rmail:get-new 'mh-inc-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (fset 'rmail:msg-forward 'mh-redistribute)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (fset 'rmail:summ-msg-to 'mh-goto-msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (fset 'rmail:summ-new 'mh-rescan-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (if (interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (message "Hyperbole MH mail reader support initialized."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (defun Mh-hbut-highlight ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 "Highlight any Hyperbole buttons in buffer for which display support exists."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (if (fboundp 'hproperty:but-create) (hproperty:but-create)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defun Mh-msg-hdrs-full (toggled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 "If TOGGLED is non-nil, toggle full/hidden headers, else show full headers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 For now, a no-op."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (defun Mh-msg-narrow ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 "Narrows mail reader buffer to current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 This includes Hyperbole button data."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (Mh-msg-widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defun Mh-msg-next () (mh-next-undeleted-msg 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (defun Mh-msg-num ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 "Returns number of mail message that point is within."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (mh-get-msg-num nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defun Mh-msg-prev () (mh-previous-undeleted-msg 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (defun Mh-msg-to-p (mail-msg-id mail-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 "Sets current buffer to start of msg with MAIL-MSG-ID in MAIL-FILE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 Returns t if successful, else nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (if (not (file-readable-p mail-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (find-file mail-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (hmail:msg-narrow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (goto-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (defun Mh-msg-widen ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 "Widens buffer to full current message including Hyperbole button data."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (Mh-to) (widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (defun Mh-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 "Sets current buffer to a mail reader buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (and (eq major-mode 'Mh-folder-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (set-buffer (Mh-get-buffer Mh-show-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (defun Mh-Summ-delete () (mh-delete-msg (mh-get-msg-num t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (fset 'Mh-Summ-expunge 'mh-execute-commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (defun Mh-Summ-goto ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (let ((msg-num (mh-get-msg-num nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (mh-goto-msg msg-num nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (mh-show msg-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (defun Mh-Summ-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 "Sets current buffer to a mail listing buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (let ((summ-buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (lambda (window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (if summ-buf
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (set-buffer (window-buffer window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (if (eq major-mode 'Mh-folder-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (setq summ-buf (current-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (hypb:window-list 'no-mini)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (if summ-buf (set-buffer summ-buf))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (defun Mh-Summ-undelete-all ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 "(Mh-Summ-undelete-all: I don't think mh-e has an undelete operator."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;;; Private functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;;; Overlay version of this function from mh-e.el to run mh-show-hook at end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;;; This hook may already be run, depending on the version of mh-e you are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;;; running, but running it twice shouldn't do any harm. Comment this out if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;;; you know that your mh-e.el already runs the hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (hypb:function-overload 'mh-display-msg nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 '(run-hooks 'mh-show-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;;; Overlay version of 'mh-regenerate-headers' to highlight Hyperbole
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;;; buttons when possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (hypb:function-overload 'mh-regenerate-headers nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 '(if (fboundp 'hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (hproperty:but-create)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ;;; Set 'mh-send-letter' hook to widen to include button data before sending.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (var:append 'mh-before-send-letter-hook '(widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;;; Private variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (provide 'hmh)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177