Gnus development mailing list
 help / color / mirror / Atom feed
* deffoo?
@ 2015-05-18  1:11 Nikolaus Rath
  2015-05-18  1:36 ` deffoo? Emanuel Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nikolaus Rath @ 2015-05-18  1:11 UTC (permalink / raw)
  To: ding

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.«



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: deffoo?
  2015-05-18  1:11 deffoo? Nikolaus Rath
@ 2015-05-18  1:36 ` Emanuel Berg
  2015-05-18  2:16 ` deffoo? Nikolaus Rath
  2015-05-18 11:46 ` deffoo? Eric Abrahamsen
  2 siblings, 0 replies; 8+ messages in thread
From: Emanuel Berg @ 2015-05-18  1:36 UTC (permalink / raw)
  To: ding

Nikolaus Rath <Nikolaus@rath.org> writes:

> 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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: deffoo?
  2015-05-18  1:11 deffoo? Nikolaus Rath
  2015-05-18  1:36 ` deffoo? Emanuel Berg
@ 2015-05-18  2:16 ` Nikolaus Rath
  2015-05-18  2:28   ` deffoo? Emanuel Berg
  2015-05-18 11:46 ` deffoo? Eric Abrahamsen
  2 siblings, 1 reply; 8+ messages in thread
From: Nikolaus Rath @ 2015-05-18  2:16 UTC (permalink / raw)
  To: ding

On May 17 2015, Nikolaus Rath <Nikolaus@rath.org> wrote:
> 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.«



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: deffoo?
  2015-05-18  2:16 ` deffoo? Nikolaus Rath
@ 2015-05-18  2:28   ` Emanuel Berg
  2015-05-18 16:02     ` deffoo? Nikolaus Rath
  0 siblings, 1 reply; 8+ messages in thread
From: Emanuel Berg @ 2015-05-18  2:28 UTC (permalink / raw)
  To: ding

Nikolaus Rath <Nikolaus@rath.org> writes:

>> 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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: deffoo?
  2015-05-18  1:11 deffoo? Nikolaus Rath
  2015-05-18  1:36 ` deffoo? Emanuel Berg
  2015-05-18  2:16 ` deffoo? Nikolaus Rath
@ 2015-05-18 11:46 ` Eric Abrahamsen
  2015-11-05 20:30   ` deffoo? Ted Zlatanov
  2 siblings, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2015-05-18 11:46 UTC (permalink / raw)
  To: ding

Nikolaus Rath <Nikolaus@rath.org> writes:

> 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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: deffoo?
  2015-05-18  2:28   ` deffoo? Emanuel Berg
@ 2015-05-18 16:02     ` Nikolaus Rath
  0 siblings, 0 replies; 8+ messages in thread
From: Nikolaus Rath @ 2015-05-18 16:02 UTC (permalink / raw)
  To: ding

On May 17 2015, Emanuel Berg <embe8573@student.uu.se> wrote:
> Nikolaus Rath <Nikolaus@rath.org> writes:
>
>>> 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.«



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: deffoo?
  2015-05-18 11:46 ` deffoo? Eric Abrahamsen
@ 2015-11-05 20:30   ` Ted Zlatanov
  2015-11-06  9:12     ` deffoo? Eric Abrahamsen
  0 siblings, 1 reply; 8+ messages in thread
From: Ted Zlatanov @ 2015-11-05 20:30 UTC (permalink / raw)
  To: ding

On Mon, 18 May 2015 07:46:00 -0400 Eric Abrahamsen <eric@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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: deffoo?
  2015-11-05 20:30   ` deffoo? Ted Zlatanov
@ 2015-11-06  9:12     ` Eric Abrahamsen
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2015-11-06  9:12 UTC (permalink / raw)
  To: ding

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Mon, 18 May 2015 07:46:00 -0400 Eric Abrahamsen <eric@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.

Someday (someday), I will manage this. I'm practicing on BBDB first!




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-11-06  9:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18  1:11 deffoo? Nikolaus Rath
2015-05-18  1:36 ` deffoo? Emanuel Berg
2015-05-18  2:16 ` deffoo? Nikolaus Rath
2015-05-18  2:28   ` deffoo? Emanuel Berg
2015-05-18 16:02     ` deffoo? Nikolaus Rath
2015-05-18 11:46 ` deffoo? Eric Abrahamsen
2015-11-05 20:30   ` deffoo? Ted Zlatanov
2015-11-06  9:12     ` deffoo? Eric Abrahamsen

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).