| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When you make a new `shimbun' module `foobar' for reading contents of http://www.foobar.net, what you have to do first is to put the following S expressions in the first part of the `sb-foobar.el' file:
(require 'shimbun) (luna-define-class shimbun-foobar (shimbun) ()) |
We will explain what they are below, so you can understand they are just
incantations now. You have to use the same suffix `foobar' in the
file name (`sb-foobar.el') and the class name
(`shimbun-foobar') as the second argument for the
luna-define-class macro.
Major jobs of the `shimbun-foobar' module can be classified broadly into the following four categories (note that you may rephrase "folder" with "group" if you are a Gnus user):
headers.
shimbun-headers of `shimbun.el' does the first job,
shimbun-get-headers does the second, shimbun-article does
the third and shimbun-make-contents does the last.
The shimbun-headers method does the first job, the
shimbun-get-headers method does the second, the
shimbun-article method does the third and the
shimbun-make-contents method does the last thing. The default
methods for those categories are defined in the `shimbun.el'
module.
Open the `shimbun.el' file. You may see unfamiliar definitions
like luna-define-generic or luna-define-method there. Hm,
they look like defun, don't you? You may also see there's just a
doc-string in the former definition and the same symbol is declared
again in the later form. And further, there are some symbols only
declared by the luna-define-generic form, not by the
luna-define-method form. What on earth are we seeing? Isn't the
program not written in the Emacs-Lisp language?
The truth is that the `shimbun' modules use the `luna.el' module provided by FLIM which enables you to write object oriented programs in the Emacs-Lisp language.
There are method programs defined rigidly for the specific purposes in
the `shimbun.el' module. The shimbun-headers method gets a
page source from a certain URL, the shimbun-get-headers method
gathers subjects and other informations, etc... (see above). They
do routine works, so they cannot take proper method to meet various web
contents in the world. Eh? Oh, you shouldn't believe in a heresy!
The `shimbun.el' module only provides the default method functions.
Remember the defadvice feature. There are three ways to modify
the behavior of a function: :before, :around and
:after. Similarly, each default `shimbun' method function
can be modified for a certain purpose (note that the :around
method-qualifier can be omitted). And it should be written specially
that the modification will be effective only when the specified
`shimbun' module is selected.
Now as you may have understood that the luna-define-generic form
provides only a husk in a sense, the luna-define-method form
defines an actual function which can be different for each
`shimbun' module, and the luna-define-class form declares
the `shimbun' class in the first part of the `sb-foobar.el'
module.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |