annotate lisp/hyperbole/hgnus.el @ 100:4be1180a9e89 r20-1b2

Import from CVS: tag r20-1b2
author cvs
date Mon, 13 Aug 2007 09:15:11 +0200
parents 131b0175ea99
children
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: hgnus.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Support Hyperbole buttons in news reader/poster: GNUS.
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, news
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
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
9 ;; ORG: InfoDock Associates
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: 24-Dec-91 at 22:29:28 by Bob Weiner
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
12 ;; LAST-MOD: 26-Jan-97 at 14:43:54 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 ;;
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
17 ;; Copyright (C) 1991-1996, 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 ;; This only works with GNUS 3.15 or above, so be sure to check your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; newsreader version {M-ESC gnus-version RET} before reporting any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; problems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; Automatically configured for use in "hyperbole.el".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; If hsite loading fails prior to initializing Hyperbole Gnus support,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
29 ;; {M-x Gnus-init RET}
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; will do it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; Have not yet overloaded 'news-reply-yank-original'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; to yank and hide button data from news article buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (require 'hmail)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (require 'hsmail)
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
45 (cond ((or (featurep 'gnus-msg)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
46 (featurep 'gnuspost)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
47 ((load "gnus-msg" t))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
48 (t (load "gnuspost" t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (setq hnews:composer 'news-reply-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 hnews:lister 'gnus-summary-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 hnews:reader 'gnus-article-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;;; Public functions
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 (defun Gnus-init ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "Initializes Hyperbole support for Gnus Usenet news reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (defun lnews:to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "Sets current buffer to the Usenet news article summary listing buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (and (eq major-mode hnews:reader) (set-buffer gnus-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun rnews:to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "Sets current buffer to the Usenet news article reader buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (and (eq major-mode hnews:lister) (set-buffer gnus-article-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defun rnews:summ-msg-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Displays news message associated with current summary header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (let ((article (gnus-summary-article-number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (if (or (null gnus-current-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (/= article gnus-current-article))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;; Selected subject is different from current article's.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (gnus-summary-display-article article))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;;; Overlay 'gnus-inews-article' from "gnuspost.el" to make it include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;;; any signature before Hyperbole button data. Does this by having
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;;; signature inserted within narrowed buffer and then applies a hook to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;;; have the buffer widened before sending.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (hypb:function-symbol-replace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 'gnus-inews-article 'widen 'hmail:msg-narrow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;; Overload this function from "rnewspost.el" for supercite compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;;; only when supercite is in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (if (hypb:supercite-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (defun news-reply-yank-original (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 "Supercite version of news-reply-yank-original.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 Insert the message being replied to in the reply buffer. Puts point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 before the mail headers and mark after body of the text. Calls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 mail-yank-original to actually yank the message into the buffer and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 cite text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 If mail-yank-original is not overloaded by supercite, each nonblank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 line is indented ARG spaces (default 3). Just \\[universal-argument]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 as ARG means don't indent and don't delete any header fields."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (mail-yank-original arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (exchange-point-and-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (run-hooks 'news-reply-header-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;;; Private variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (var:append 'gnus-Inews-article-hook '(widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;;; Hide any Hyperbole button data and highlight buttons if possible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;;; in news article being read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (var:append 'gnus-article-prepare-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (if (fboundp 'hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 '(hmail:msg-narrow hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 '(hmail:msg-narrow)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (if (fboundp 'hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (var:append 'gnus-summary-prepare-hook '(hproperty:but-create)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;;; Try to setup comment addition as the first element of these hooks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (if (fboundp 'add-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;; Called from 'news-post-news' if prev unsent article exists and user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ;; says erase it. Add a comment on Hyperbole button support.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (add-hook 'news-setup-hook 'smail:comment-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;; Called from 'news-post-news' if no prev unsent article exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;; Add a comment on Hyperbole button support.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (add-hook 'news-reply-mode-hook 'smail:comment-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (var:append 'news-setup-hook '(smail:comment-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (var:append 'news-reply-mode-hook '(smail:comment-add)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (provide 'hgnus)