Mercurial > emacs
annotate lisp/gnus/nnoo.el @ 69478:e8bb5df2ba7a
Add index entries around each paragraph rather than depend on entries
from beginning of node. Doing so ensures that index entries are less
likely to be forgotten if text is cut and pasted, and are necessary
anyway if the references are on a separate page. It seems that
makeinfo is now (v. 4.8) only producing one index entry per node, so
there is no longer any excuse not to. Use subheading instead of
heading. The incorrect use of heading produced very large fonts in
Info--as large as the main heading.
(From Bill Wohler): MH-E never did appear in Emacs 21--MH-E versions 6
and 7 appeared *around* the time of these Emacs releases.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Wed, 15 Mar 2006 00:26:12 +0000 |
parents | 808f636eb13e |
children | e3694f1cb928 9e490faa9f6b |
rev | line source |
---|---|
17493 | 1 ;;; nnoo.el --- OO Gnus Backends |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2 |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
68633
1077b8039c32
Update copyright notices of all files in the gnus directory.
Romain Francoise <romain@orebokech.com>
parents:
64754
diff
changeset
|
4 ;; 2004, 2005, 2006 Free Software Foundation, Inc. |
17493 | 5 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 7 ;; Keywords: news |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
17493 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;;; Code: | |
29 | |
30 (require 'nnheader) | |
19494
4280cff25537
Require cl only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
31 (eval-when-compile (require 'cl)) |
17493 | 32 |
33 (defvar nnoo-definition-alist nil) | |
34 (defvar nnoo-state-alist nil) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
35 (defvar nnoo-parent-backend nil) |
17493 | 36 |
37 (defmacro defvoo (var init &optional doc &rest map) | |
38 "The same as `defvar', only takes list of variables to MAP to." | |
39 `(prog1 | |
40 ,(if doc | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
41 `(defvar ,var ,init ,(concat doc "\n\nThis is a Gnus server variable. See Info node `(gnus)Select Methods'.")) |
17493 | 42 `(defvar ,var ,init)) |
43 (nnoo-define ',var ',map))) | |
44 (put 'defvoo 'lisp-indent-function 2) | |
45 (put 'defvoo 'edebug-form-spec '(var init &optional doc &rest map)) | |
46 | |
47 (defmacro deffoo (func args &rest forms) | |
48 "The same as `defun', only register FUNC." | |
49 `(prog1 | |
50 (defun ,func ,args ,@forms) | |
51 (nnoo-register-function ',func))) | |
52 (put 'deffoo 'lisp-indent-function 2) | |
53 (put 'deffoo 'edebug-form-spec '(&define name lambda-list def-body)) | |
54 | |
55 (defun nnoo-register-function (func) | |
56 (let ((funcs (nthcdr 3 (assoc (nnoo-backend func) | |
57 nnoo-definition-alist)))) | |
58 (unless funcs | |
59 (error "%s belongs to a backend that hasn't been declared" func)) | |
60 (setcar funcs (cons func (car funcs))))) | |
61 | |
62 (defmacro nnoo-declare (backend &rest parents) | |
63 `(eval-and-compile | |
68940
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
64 (if (assq ',backend nnoo-definition-alist) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
65 (setcar (cdr (assq ',backend nnoo-definition-alist)) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
66 (mapcar 'list ',parents)) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
67 (push (list ',backend |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
68 (mapcar 'list ',parents) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
69 nil nil) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
70 nnoo-definition-alist)) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
71 (unless (assq ',backend nnoo-state-alist) |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
72 (push (list ',backend "*internal-non-initialized-backend*") |
808f636eb13e
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Miles Bader <miles@gnu.org>
parents:
68633
diff
changeset
|
73 nnoo-state-alist)))) |
17493 | 74 (put 'nnoo-declare 'lisp-indent-function 1) |
75 | |
76 (defun nnoo-parents (backend) | |
77 (nth 1 (assoc backend nnoo-definition-alist))) | |
78 | |
79 (defun nnoo-variables (backend) | |
80 (nth 2 (assoc backend nnoo-definition-alist))) | |
81 | |
82 (defun nnoo-functions (backend) | |
83 (nth 3 (assoc backend nnoo-definition-alist))) | |
84 | |
85 (defmacro nnoo-import (backend &rest imports) | |
86 `(nnoo-import-1 ',backend ',imports)) | |
87 (put 'nnoo-import 'lisp-indent-function 1) | |
88 | |
89 (defun nnoo-import-1 (backend imports) | |
90 (let ((call-function | |
91 (if (symbolp (car imports)) (pop imports) 'nnoo-parent-function)) | |
92 imp functions function) | |
93 (while (setq imp (pop imports)) | |
94 (setq functions | |
95 (or (cdr imp) | |
96 (nnoo-functions (car imp)))) | |
97 (while functions | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
98 (unless (fboundp |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
99 (setq function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
100 (nnoo-symbol backend |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
101 (nnoo-rest-symbol (car functions))))) |
17493 | 102 (eval `(deffoo ,function (&rest args) |
103 (,call-function ',backend ',(car functions) args)))) | |
104 (pop functions))))) | |
105 | |
106 (defun nnoo-parent-function (backend function args) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
107 (let ((pbackend (nnoo-backend function)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
108 (nnoo-parent-backend backend)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
109 (nnoo-change-server pbackend |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
110 (nnoo-current-server backend) |
17493 | 111 (cdr (assq pbackend (nnoo-parents backend)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
112 (prog1 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
113 (apply function args) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
114 ;; Copy the changed variables back into the child. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
115 (let ((vars (cdr (assq pbackend (nnoo-parents backend))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
116 (while vars |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
117 (set (cadar vars) (symbol-value (caar vars))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
118 (setq vars (cdr vars))))))) |
17493 | 119 |
120 (defun nnoo-execute (backend function &rest args) | |
121 "Execute FUNCTION on behalf of BACKEND." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
122 (let ((pbackend (nnoo-backend function)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
123 (nnoo-parent-backend backend)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
124 (nnoo-change-server pbackend |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
125 (nnoo-current-server backend) |
17493 | 126 (cdr (assq pbackend (nnoo-parents backend)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
127 (prog1 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
128 (apply function args) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
129 ;; Copy the changed variables back into the child. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
130 (let ((vars (cdr (assq pbackend (nnoo-parents backend))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
131 (while vars |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
132 (set (cadar vars) (symbol-value (caar vars))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
133 (setq vars (cdr vars))))))) |
17493 | 134 |
135 (defmacro nnoo-map-functions (backend &rest maps) | |
136 `(nnoo-map-functions-1 ',backend ',maps)) | |
137 (put 'nnoo-map-functions 'lisp-indent-function 1) | |
138 | |
139 (defun nnoo-map-functions-1 (backend maps) | |
140 (let (m margs i) | |
141 (while (setq m (pop maps)) | |
142 (setq i 0 | |
143 margs nil) | |
144 (while (< i (length (cdr m))) | |
145 (if (numberp (nth i (cdr m))) | |
146 (push `(nth ,i args) margs) | |
147 (push (nth i (cdr m)) margs)) | |
148 (incf i)) | |
149 (eval `(deffoo ,(nnoo-symbol backend (nnoo-rest-symbol (car m))) | |
150 (&rest args) | |
151 (nnoo-parent-function ',backend ',(car m) | |
152 ,(cons 'list (nreverse margs)))))))) | |
153 | |
154 (defun nnoo-backend (symbol) | |
155 (string-match "^[^-]+-" (symbol-name symbol)) | |
156 (intern (substring (symbol-name symbol) 0 (1- (match-end 0))))) | |
157 | |
158 (defun nnoo-rest-symbol (symbol) | |
159 (string-match "^[^-]+-" (symbol-name symbol)) | |
160 (intern (substring (symbol-name symbol) (match-end 0)))) | |
161 | |
162 (defun nnoo-symbol (backend symbol) | |
163 (intern (format "%s-%s" backend symbol))) | |
164 | |
165 (defun nnoo-define (var map) | |
166 (let* ((backend (nnoo-backend var)) | |
167 (def (assq backend nnoo-definition-alist)) | |
168 (parents (nth 1 def))) | |
169 (unless def | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19494
diff
changeset
|
170 (error "%s belongs to a backend that hasn't been declared" var)) |
17493 | 171 (setcar (nthcdr 2 def) |
172 (delq (assq var (nth 2 def)) (nth 2 def))) | |
173 (setcar (nthcdr 2 def) | |
174 (cons (cons var (symbol-value var)) | |
175 (nth 2 def))) | |
176 (while map | |
177 (nconc (assq (nnoo-backend (car map)) parents) | |
178 (list (list (pop map) var)))))) | |
179 | |
180 (defun nnoo-change-server (backend server defs) | |
181 (let* ((bstate (cdr (assq backend nnoo-state-alist))) | |
182 (current (car bstate)) | |
183 (parents (nnoo-parents backend)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
184 (server (if nnoo-parent-backend |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
185 (format "%s+%s" nnoo-parent-backend server) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
186 server)) |
17493 | 187 (bvariables (nnoo-variables backend)) |
188 state def) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
189 ;; If we don't have a current state, we push an empty state |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
190 ;; onto the alist. |
17493 | 191 (unless bstate |
192 (push (setq bstate (list backend nil)) | |
193 nnoo-state-alist) | |
194 (pop bstate)) | |
195 (if (equal server current) | |
196 t | |
197 (nnoo-push-server backend current) | |
198 (setq state (or (cdr (assoc server (cddr bstate))) | |
199 (nnoo-variables backend))) | |
200 (while state | |
201 (set (caar state) (cdar state)) | |
202 (pop state)) | |
203 (setcar bstate server) | |
204 (unless (cdr (assoc server (cddr bstate))) | |
205 (while (setq def (pop defs)) | |
206 (unless (assq (car def) bvariables) | |
207 (nconc bvariables | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
208 (list (cons (car def) (and (boundp (car def)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
209 (symbol-value (car def))))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
210 (if (equal server "*internal-non-initialized-backend*") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
211 (set (car def) (symbol-value (cadr def))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
212 (set (car def) (cadr def))))) |
17493 | 213 (while parents |
214 (nnoo-change-server | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
215 (caar parents) (format "%s+%s" backend server) |
17493 | 216 (mapcar (lambda (def) (list (car def) (symbol-value (cadr def)))) |
217 (cdar parents))) | |
218 (pop parents)))) | |
219 t) | |
220 | |
221 (defun nnoo-push-server (backend current) | |
222 (let ((bstate (assq backend nnoo-state-alist)) | |
223 (defs (nnoo-variables backend))) | |
224 ;; Remove the old definition. | |
225 (setcdr (cdr bstate) (delq (assoc current (cddr bstate)) (cddr bstate))) | |
226 ;; If this is the first time we push the server (i. e., this is | |
227 ;; the nil server), then we update the default values of | |
228 ;; all the variables to reflect the current values. | |
229 (when (equal current "*internal-non-initialized-backend*") | |
230 (let ((defaults (nnoo-variables backend)) | |
231 def) | |
232 (while (setq def (pop defaults)) | |
233 (setcdr def (symbol-value (car def)))))) | |
234 (let (state) | |
235 (while defs | |
236 (push (cons (caar defs) (symbol-value (caar defs))) | |
237 state) | |
238 (pop defs)) | |
239 (nconc bstate (list (cons current state)))))) | |
240 | |
241 (defsubst nnoo-current-server-p (backend server) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
242 (equal (nnoo-current-server backend) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
243 (if nnoo-parent-backend |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
244 (format "%s+%s" nnoo-parent-backend server) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
245 server))) |
17493 | 246 |
247 (defun nnoo-current-server (backend) | |
248 (nth 1 (assq backend nnoo-state-alist))) | |
249 | |
250 (defun nnoo-close-server (backend &optional server) | |
251 (unless server | |
252 (setq server (nnoo-current-server backend))) | |
253 (when server | |
254 (let* ((bstate (cdr (assq backend nnoo-state-alist))) | |
255 (defs (assoc server (cdr bstate)))) | |
256 (when bstate | |
257 (setcar bstate nil) | |
258 (setcdr bstate (delq defs (cdr bstate))) | |
259 (pop defs) | |
260 (while defs | |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
261 (set (car (pop defs)) nil))))) |
17493 | 262 t) |
263 | |
264 (defun nnoo-close (backend) | |
265 (setq nnoo-state-alist | |
266 (delq (assq backend nnoo-state-alist) | |
267 nnoo-state-alist)) | |
268 t) | |
269 | |
270 (defun nnoo-status-message (backend server) | |
271 (nnheader-get-report backend)) | |
272 | |
273 (defun nnoo-server-opened (backend server) | |
274 (and (nnoo-current-server-p backend server) | |
275 nntp-server-buffer | |
276 (buffer-name nntp-server-buffer))) | |
277 | |
278 (defmacro nnoo-define-basics (backend) | |
279 "Define `close-server', `server-opened' and `status-message'." | |
280 `(eval-and-compile | |
281 (nnoo-define-basics-1 ',backend))) | |
282 | |
283 (defun nnoo-define-basics-1 (backend) | |
284 (let ((functions '(close-server server-opened status-message))) | |
285 (while functions | |
286 (eval `(deffoo ,(nnoo-symbol backend (car functions)) | |
287 (&optional server) | |
288 (,(nnoo-symbol 'nnoo (pop functions)) ',backend server))))) | |
289 (eval `(deffoo ,(nnoo-symbol backend 'open-server) | |
290 (server &optional defs) | |
291 (nnoo-change-server ',backend server defs)))) | |
292 | |
293 (defmacro nnoo-define-skeleton (backend) | |
294 "Define all required backend functions for BACKEND. | |
295 All functions will return nil and report an error." | |
296 `(eval-and-compile | |
297 (nnoo-define-skeleton-1 ',backend))) | |
298 | |
299 (defun nnoo-define-skeleton-1 (backend) | |
300 (let ((functions '(retrieve-headers | |
301 request-close request-article | |
302 request-group close-group | |
303 request-list request-post request-list-newsgroups)) | |
304 function fun) | |
305 (while (setq function (pop functions)) | |
306 (when (not (fboundp (setq fun (nnoo-symbol backend function)))) | |
307 (eval `(deffoo ,fun | |
308 (&rest args) | |
309 (nnheader-report ',backend ,(format "%s-%s not implemented" | |
310 backend function)))))))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
311 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
312 (defun nnoo-set (server &rest args) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
313 (let ((parents (nnoo-parents (car server))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
314 (nnoo-parent-backend (car server))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
315 (while parents |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
316 (nnoo-change-server (caar parents) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
317 (cadr server) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
318 (cdar parents)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
319 (pop parents))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
320 (nnoo-change-server (car server) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
321 (cadr server) (cddr server)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
322 (while args |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
323 (set (pop args) (pop args)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
324 |
17493 | 325 (provide 'nnoo) |
326 | |
52401 | 327 ;;; arch-tag: 0196b5ed-6f34-4778-a455-73a971f837e7 |
38413
a26d9b55abb6
Some fixes to follow coding conventions in files from Gnus.
Pavel Janík <Pavel@Janik.cz>
parents:
31716
diff
changeset
|
328 ;;; nnoo.el ends here |