GNU bug report logs - #25294
26.0.50; Allow more catch-all values for cl-defmethod's &context plus major-mode specializer

Previous Next

Package: emacs;

Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Date: Thu, 29 Dec 2016 19:14:02 UTC

Severity: wishlist

Tags: moreinfo

Found in version 26.0.50

Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Bug is archived. No further changes may be made.

Full log


Message #21 received at 25294 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: 25294 <at> debbugs.gnu.org
Cc: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Subject: Re: bug#25294: 26.0.50;
 Allow more catch-all values for cl-defmethod's &context plus
 major-mode specializer
Date: Mon, 11 Dec 2017 20:39:28 -0500
[Message part 1 (text/plain, inline)]
[forwarding to list]

[Message part 2 (message/rfc822, inline)]
From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Subject: Re: bug#25294: 26.0.50; Allow more catch-all values for cl-defmethod's &context plus major-mode specializer
Date: Mon, 11 Dec 2017 16:49:14 -0800
On 12/11/17 19:08 PM, Noam Postavsky wrote:
> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
>> Ahem, I only just noticed (a year later) that there was a response to
>> this when I searched for bug reports I'd opened -- sorry about that.
>
> It's had lots of time to rest then :)
>
>>> If you want to ignore the major mode, why do you want to use the
>>> major-mode specializer?
>>
>> It's the equivalent of the "t" branch in a `cond' statement. You write
>> methods to handle specific major modes, and write another method to
>> handle the catch-all case of "all other modes".
>
> Still not really convinced by this, what's wrong with the last way you
> put in your OP:
>
>     (cl-defmethod example-method ())

A year later, older and wiser, I agree that maybe all that's needed is
more documentation. I just noticed that, at some point in the interim,
the documentation for generic functions has been greatly expanded, which
is nice!

I'd like to add the following to the docs:

1. The &context thing has to come after the required arguments, but
   before any &optional or &rest things.
2. You can have an arbitrary number of forms following &context.
3. The &context arguments don't have to match the declared arguments in
   `cl-defgeneric'.
4. Ergo they can be left off altogether without needing to be
   specifically declared as nil or what have you, ie, my original bug
   report isn't really a bug.

If this looks okay, I'll have at the docs.

Eric

This bug report was last modified 7 years and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.