1 ;;; hgnus.el --- Support Hyperbole buttons in news reader/poster: GNUS.
3 ;; Copyright (C) 1991-1995, 2004 Free Software Foundation, Inc.
4 ;; Developed with support from Motorola Inc.
6 ;; Author: Bob Weiner, Brown U.
7 ;; Maintainer: Mats Lidell <matsl@contactor.se>
8 ;; Keywords: hypermedia, news
10 ;; This file is part of GNU Hyperbole.
12 ;; GNU Hyperbole is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 3, or (at
15 ;; your option) any later version.
17 ;; GNU Hyperbole 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 GNU
20 ;; General Public License for more details.
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.
29 ;; This only works with GNUS 3.15 or above, so be sure to check your
30 ;; newsreader version {M-ESC gnus-version RET} before reporting any
33 ;; Automatically configured for use in "hyperbole.el".
34 ;; If hsite loading fails prior to initializing Hyperbole Gnus support,
36 ;; {M-x Gnus-init RTN}
41 ;; Have not yet overloaded 'news-reply-yank-original'
42 ;; to yank and hide button data from news article buffer.
47 ;;; Other required Elisp libraries
58 (setq hnews:composer 'news-reply-mode
59 hnews:lister 'gnus-summary-mode
60 hnews:reader 'gnus-article-mode)
68 "Initializes Hyperbole support for Gnus Usenet news reading."
73 "Sets current buffer to the Usenet news article summary listing buffer."
74 (and (eq major-mode hnews:reader) (set-buffer gnus-summary-buffer)))
77 "Sets current buffer to the Usenet news article reader buffer."
78 (and (eq major-mode hnews:lister) (set-buffer gnus-article-buffer)))
80 (defun rnews:summ-msg-to ()
81 "Displays news message associated with current summary header."
82 (let ((article (gnus-summary-article-number)))
83 (if (or (null gnus-current-article)
84 (/= article gnus-current-article))
85 ;; Selected subject is different from current article's.
86 (gnus-summary-display-article article))))
89 ;;; Overlay 'gnus-inews-article' from "gnuspost.el" to make it include
90 ;;; any signature before Hyperbole button data. Does this by having
91 ;;; signature inserted within narrowed buffer and then applies a hook to
92 ;;; have the buffer widened before sending.
93 (hypb:function-symbol-replace
94 'gnus-inews-article 'widen 'hmail:msg-narrow)
96 ;;; Overload this function from "rnewspost.el" for supercite compatibility
97 ;;; only when supercite is in use.
98 (if (hypb:supercite-p)
99 (defun news-reply-yank-original (arg)
100 "Supercite version of news-reply-yank-original.
101 Insert the message being replied to in the reply buffer. Puts point
102 before the mail headers and mark after body of the text. Calls
103 mail-yank-original to actually yank the message into the buffer and
106 If mail-yank-original is not overloaded by supercite, each nonblank
107 line is indented ARG spaces (default 3). Just \\[universal-argument]
108 as ARG means don't indent and don't delete any header fields."
110 (mail-yank-original arg)
111 (exchange-point-and-mark)
112 (run-hooks 'news-reply-header-hook))
116 ;;; Private variables
119 (var:append 'gnus-Inews-article-hook '(widen))
121 ;;; Hide any Hyperbole button data and highlight buttons if possible
122 ;;; in news article being read.
123 (var:append 'gnus-article-prepare-hook
124 (if (fboundp 'hproperty:but-create)
125 '(hmail:msg-narrow hproperty:but-create)
126 '(hmail:msg-narrow)))
128 (if (fboundp 'hproperty:but-create)
129 (var:append 'gnus-summary-prepare-hook '(hproperty:but-create)))
131 ;;; Try to setup comment addition as the first element of these hooks.
132 (if (fboundp 'add-hook)
133 ;; Called from 'news-post-news' if prev unsent article exists and user
134 ;; says erase it. Add a comment on Hyperbole button support.
136 (add-hook 'news-setup-hook 'smail:comment-add)
137 ;; Called from 'news-post-news' if no prev unsent article exists.
138 ;; Add a comment on Hyperbole button support.
139 (add-hook 'news-reply-mode-hook 'smail:comment-add))
140 (var:append 'news-setup-hook '(smail:comment-add))
141 (var:append 'news-reply-mode-hook '(smail:comment-add)))
145 ;;; hgnus.el ends here