comparison lisp/hyperbole/hgnus.el @ 0:376386a54a3c r19-14

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