[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38252: 27.0.50; Gnus server definitions and generic function special
From: |
Eric Abrahamsen |
Subject: |
bug#38252: 27.0.50; Gnus server definitions and generic function specializers |
Date: |
Mon, 18 Nov 2019 12:43:37 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
On 11/17/19 23:36 PM, Stefan Monnier wrote:
>> But just so I don't feel like I wasted my afternoon: how *would* one
>> write the generalizer I'm talking about?
>
> Ah, that part.
> I guess It could look like (guaranteed 100% untested):
>
> (defvar gnus--legacy-server-tag (make-symbol "gnus-legacy-server"))
> (cl-generic-define-generalizer gnus-legacy-server-generalizer
> 90 (lambda (varname &rest _)
> `(and (consp ,varname)
> (symbolp (car ,varname))
> (assq (car ,varname) nnoo-definition-alist)
> (stringp (cadr ,varname))
> gnus--legacy-server-tag))
> (lambda (tag &rest _)
> (when (eq tag gnus--legacy-server-tag) (list tag))))
>
> (cl-defmethod cl-generic-generalizers ((_ (eql gnus-legacy-server)))
> "Dispatch on old-style Gnus server definitions."
> (list gnus-legacy-server-generalizer))
That's perfect, thanks. I don't need tested code, I just needed to
understand the logic of which bit is responsible for what. I wonder if
it would be useful to have an example of this, either in the manual or
cl-generic.el code comments?
There's still a lot of work to do before struct servers and cons servers
can coexist within Gnus, but it's nice to have this piece of the puzzle
solved.