Discussion:
deffoo?
Nikolaus Rath
2015-05-18 01:11:01 UTC
Permalink
Hello,

I want to implement some improvements to nnimap, so I'm trying to find
my way around the Gnus source.

One thing I stumbled upon is the use of "deffoo" and "defvoo". The help did
not help me at all ("The same as `defun', only register FUNC").

Can someone explain what this macros do / how they differ from defun /
defvar?

Thanks!
-Nikolaus
--
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

»Time flies like an arrow, fruit flies like a Banana.«
Emanuel Berg
2015-05-18 01:36:56 UTC
Permalink
Post by Nikolaus Rath
One thing I stumbled upon is the use of "deffoo" and
"defvoo". The help did not help me at all ("The same
as `defun', only register FUNC").
Can someone explain what this macros do / how they
differ from defun / defvar?
Use the source, Luke!

(defmacro deffoo (func args &rest forms)
"The same as `defun', only register FUNC."
`(prog1
(defun ,func ,args ,@forms)
(nnoo-register-function ',func)))

So the difference is nothing more than

(nnoo-register-function ',func)

- you could equally well do

(defun make-soap () ...)
(nnoo-register-function 'make-soap)

`nnoo-register-function' isn't documented, but it
is defined like this:

(defun nnoo-register-function (func)
(let ((funcs (nthcdr 3 (assoc (nnoo-backend func)
nnoo-definition-alist))))
(unless funcs
(error "%s belongs to a backend that hasn't been declared" func))
(setcar funcs (cons func (car funcs)))))

You can grep the Emacs and/or Gnus source to find out
when those vars are used (or search the Gnus manual) -
however, often this would be a backward way to
do things.

Rather, you will find `nnoo-register-function' when
you need it, and then you will understand exactly what
it does, is the way it works most of the time.

Good luck!
--
underground experts united
http://user.it.uu.se/~embe8573
Nikolaus Rath
2015-05-18 02:16:16 UTC
Permalink
Post by Nikolaus Rath
Hello,
I want to implement some improvements to nnimap, so I'm trying to find
my way around the Gnus source.
One thing I stumbled upon is the use of "deffoo" and "defvoo". The help did
not help me at all ("The same as `defun', only register FUNC").
Can someone explain what this macros do / how they differ from defun /
defvar?
Mea culpa, I just found the explanations in the Gnus Reference Guide
(which, to my defense, is rather well hidden in the appendices).


Best,
-Nikolaus
--
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

»Time flies like an arrow, fruit flies like a Banana.«
Emanuel Berg
2015-05-18 02:28:24 UTC
Permalink
Post by Nikolaus Rath
Hello, I want to implement some improvements to
nnimap, so I'm trying to find my way around the
Gnus source. One thing I stumbled upon is the use
of "deffoo" and "defvoo". The help did not help me
at all ("The same as `defun', only register FUNC").
Can someone explain what this macros do / how they
differ from defun / defvar?
Mea culpa, I just found the explanations in the Gnus
Reference Guide (which, to my defense, is rather
well hidden in the appendices).
Well, let's hear it?
--
underground experts united
http://user.it.uu.se/~embe8573
Nikolaus Rath
2015-05-18 16:02:49 UTC
Permalink
Post by Emanuel Berg
Post by Nikolaus Rath
Hello, I want to implement some improvements to
nnimap, so I'm trying to find my way around the
Gnus source. One thing I stumbled upon is the use
of "deffoo" and "defvoo". The help did not help me
at all ("The same as `defun', only register FUNC").
Can someone explain what this macros do / how they
differ from defun / defvar?
Mea culpa, I just found the explanations in the Gnus
Reference Guide (which, to my defense, is rather
well hidden in the appendices).
Well, let's hear it?
Well, Eric gave it away already. They implement some limited support for
inheritance, so that one backend can inherit functions from another.

Best,
-Nikolaus
--
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

»Time flies like an arrow, fruit flies like a Banana.«
Eric Abrahamsen
2015-05-18 11:46:00 UTC
Permalink
Post by Nikolaus Rath
Hello,
I want to implement some improvements to nnimap, so I'm trying to find
my way around the Gnus source.
One thing I stumbled upon is the use of "deffoo" and "defvoo". The help did
not help me at all ("The same as `defun', only register FUNC").
Can someone explain what this macros do / how they differ from defun /
defvar?
That's part of Gnus' home-rolled
I-can't-believe-it's-not-object-oriented inheritance system. Probably it
was written before EIEIO was a twinkle in Eric Ludlam's eye, but by god
it would be nice if someone™ would re-write Gnus to use the new tools...

Eric
Ted Zlatanov
2015-11-05 20:30:55 UTC
Permalink
On Mon, 18 May 2015 07:46:00 -0400 Eric Abrahamsen <***@ericabrahamsen.net> wrote:

EA> That's part of Gnus' home-rolled
EA> I-can't-believe-it's-not-object-oriented inheritance system. Probably it
EA> was written before EIEIO was a twinkle in Eric Ludlam's eye, but by god
EA> it would be nice if someone™ would re-write Gnus to use the new tools...

I'd cry happy tears if that happened.

Ted
Eric Abrahamsen
2015-11-06 09:12:43 UTC
Permalink
Post by Ted Zlatanov
EA> That's part of Gnus' home-rolled
EA> I-can't-believe-it's-not-object-oriented inheritance system. Probably it
EA> was written before EIEIO was a twinkle in Eric Ludlam's eye, but by god
EA> it would be nice if someone™ would re-write Gnus to use the new tools...
I'd cry happy tears if that happened.
Someday (someday), I will manage this. I'm practicing on BBDB first!
Loading...