From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/5909 Path: main.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.gnus.general Subject: Oo -- oo! Date: 12 Apr 1996 10:55:59 +0200 Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035146444 1756 80.91.224.250 (20 Oct 2002 20:40:44 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 20:40:44 +0000 (UTC) Return-Path: ding-request@ifi.uio.no Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by deanna.miranova.com (8.7.5/8.6.9) with SMTP id CAA29723 for ; Fri, 12 Apr 1996 02:51:29 -0700 Original-Received: from hler.ifi.uio.no (4867@hler.ifi.uio.no [129.240.94.23]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Fri, 12 Apr 1996 10:56:01 +0200 Original-Received: (from larsi@localhost) by hler.ifi.uio.no ; Fri, 12 Apr 1996 10:56:00 +0200 Original-To: ding@ifi.uio.no Original-Lines: 116 Xref: main.gmane.org gmane.emacs.gnus.general:5909 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:5909 So, like, I just went and did it. (Quelle surprise!) It wasn't that hard, but I'm not sure I did it right. I mean, it works all will make it easier to inherit functions and stuff, but it feels a bit jagged around the edges. There's a new file -- nnoo.el. It takes care of all ooey stuff. The backends have to: 1) Require nnoo. 2) Declare that they exist and which packages they intend to inherit stuff from. 3) Use `defvoo' instead of `defvar' on "public" variables. This macro takes addition parameters that say which variables in the parent package(s) they map to. 4) Use `deffoo' instead of `defun' to define "public" functions. 5) Finally, import all functions from parent packages. I've included below the new version of nndir. The problem here is that nndir group names map to other group names in the nnml and nnmh backends, which means that one has to list many of the nndir functions explicitly. If the parent backends used the same names, all that would have been required was to say: (nnoo-import 'nndir (nnmh)) and that would have taken care of everything. (I think one should be able to do that in the nndb<->nntp area, for instance.) ;;; nndir.el --- single directory newsgroup access for Gnus ;; Copyright (C) 1995,96 Free Software Foundation, Inc. ;;; Code: (require 'nnheader) (require 'nnmh) (require 'nnml) (require 'nnoo) (eval-when-compile (require 'cl)) (nnoo-declare nndir nnml nnmh) (defvoo nndir-directory nil "Where nndir will look for groups." nnml-current-directory nnmh-current-directory) (defvoo nndir-nov-is-evil nil "*Non-nil means that nndir will never retrieve NOV headers." nnml-nov-is-evil) (defvoo nndir-current-group "" nil nnml-current-group nnmh-current-group) (defvoo nndir-top-directory nil nnml-directory nnmh-directory) (defvoo nndir-get-new-mail nil nil nnml-get-new-mail nnmh-get-new-mail) (defvoo nndir-status-string "" nil nnmh-status-string) (defconst nndir-version "nndir 1.0") ;;; Interface functions. (deffoo nndir-open-server (server &optional defs) (nnoo-change-server 'nndir server defs) (setq nndir-current-group (file-name-nondirectory (directory-file-name nndir-directory))) (setq nndir-top-directory (file-name-directory (directory-file-name nndir-directory))) t) (deffoo nndir-close-server (&optional server) (nnoo-close-server 'nndir server) t) (deffoo nndir-server-opened (&optional server) (nnoo-current-server-p 'nndir server)) (deffoo nndir-request-create-group (group &optional server) (if (file-exists-p nndir-directory) (if (file-directory-p nndir-directory) t nil) (condition-case () (progn (make-directory nndir-directory t) t) (file-error nil)))) (deffoo nndir-retrieve-headers (a &optional g s o) (nnoo-execute 'nndir 'nnml-retrieve-headers a nndir-current-group s o)) (deffoo nndir-request-article (a &optional g s b) (nnoo-execute 'nndir 'nnmh-request-article a nndir-current-group s b)) (deffoo nndir-request-group (group &optional server dont-check) (nnoo-execute 'nndir 'nnmh-request-group nndir-current-group server dont-check)) (nnoo-import nndir (nnml nnml-retrieve-headers) (nnmh)) (provide 'nndir) ;;; nndir.el ends here -- "Yes. The journey through the human heart would have to wait until some other time."