Gnus development mailing list
 help / color / mirror / Atom feed
* Oo -- oo!
@ 1996-04-12  8:55 Lars Magne Ingebrigtsen
  0 siblings, 0 replies; only message in thread
From: Lars Magne Ingebrigtsen @ 1996-04-12  8:55 UTC (permalink / raw)


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)

\f

(defvoo nndir-status-string "" nil nnmh-status-string)
(defconst nndir-version "nndir 1.0")

\f

;;; 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."


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-04-12  8:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-12  8:55 Oo -- oo! Lars Magne Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).