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