annotate lisp/hyperbole/hgnus.el @ 80:1ce6082ce73f r20-0b90

Import from CVS: tag r20-0b90
author cvs
date Mon, 13 Aug 2007 09:06:37 +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: 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
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: 24-Dec-91 at 22:29:28 by Bob Weiner
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
12 ;; LAST-MOD: 8-Aug-95 at 10:53:53 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 ;; 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 ;;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
29 ;; {M-x Gnus-init RTN}
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)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
45 ;; This is not in Gnus 5.x
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 24
diff changeset
46 ;(require 'gnuspost)
0
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 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (setq hnews:composer 'news-reply-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 hnews:lister 'gnus-summary-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 hnews:reader 'gnus-article-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (defun Gnus-init ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 "Initializes Hyperbole support for Gnus Usenet news reading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defun lnews:to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 "Sets current buffer to the Usenet news article summary listing buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (and (eq major-mode hnews:reader) (set-buffer gnus-summary-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defun rnews:to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "Sets current buffer to the Usenet news article reader buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (and (eq major-mode hnews:lister) (set-buffer gnus-article-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (defun rnews:summ-msg-to ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 "Displays news message associated with current summary header."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (let ((article (gnus-summary-article-number)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (if (or (null gnus-current-article)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (/= article gnus-current-article))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ;; Selected subject is different from current article's.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (gnus-summary-display-article article))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;;; Overlay 'gnus-inews-article' from "gnuspost.el" to make it include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;;; any signature before Hyperbole button data. Does this by having
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;;; signature inserted within narrowed buffer and then applies a hook to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;;; have the buffer widened before sending.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (hypb:function-symbol-replace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 'gnus-inews-article 'widen 'hmail:msg-narrow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ;;; Overload this function from "rnewspost.el" for supercite compatibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;;; only when supercite is in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (if (hypb:supercite-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defun news-reply-yank-original (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 "Supercite version of news-reply-yank-original.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 Insert the message being replied to in the reply buffer. Puts point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 before the mail headers and mark after body of the text. Calls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 mail-yank-original to actually yank the message into the buffer and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 cite text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 If mail-yank-original is not overloaded by supercite, each nonblank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 line is indented ARG spaces (default 3). Just \\[universal-argument]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 as ARG means don't indent and don't delete any header fields."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (mail-yank-original arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (exchange-point-and-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (run-hooks 'news-reply-header-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ;;; Private variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (var:append 'gnus-Inews-article-hook '(widen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;;; Hide any Hyperbole button data and highlight buttons if possible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;;; in news article being read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (var:append 'gnus-article-prepare-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (if (fboundp 'hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 '(hmail:msg-narrow hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 '(hmail:msg-narrow)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (if (fboundp 'hproperty:but-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (var:append 'gnus-summary-prepare-hook '(hproperty:but-create)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;;; Try to setup comment addition as the first element of these hooks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (if (fboundp 'add-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;; Called from 'news-post-news' if prev unsent article exists and user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;; says erase it. Add a comment on Hyperbole button support.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (add-hook 'news-setup-hook 'smail:comment-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;; Called from 'news-post-news' if no prev unsent article exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;; Add a comment on Hyperbole button support.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (add-hook 'news-reply-mode-hook 'smail:comment-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (var:append 'news-setup-hook '(smail:comment-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (var:append 'news-reply-mode-hook '(smail:comment-add)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (provide 'hgnus)