Subject: Re: bug#25294: 26.0.50; Allow more catch-all values for cl-defmethod's &context plus major-mode specializer

From: Eric Abrahamsen <[email-masked]>
Date: Thu, 14 Dec 2017 13:01:00 -0800

close 25294
quit

On 12/12/17 18:58 PM, Noam Postavsky wrote:
> Eric Abrahamsen <[email-masked]> writes:
>
>> +Generic functions provide a new argument-list keyword,
>
> The way you phrased this might lead me to think that the &context
> keyword should go in the cl-defgeneric form (maybe it's not so bad when
> seeing in context under cl-defmethod, in patch form it's a bit
> disconnected).
>
>> +@code{&context}, which can be used to introduce extra specializers
>> +that test the general environment in which the method is run.  This
>> +keyword should appear after the list of required arguments, but before
>> +any @code{&rest} or @code{&optional} keywords.
>
> I wonder if it would be clearer to add this to the @defmac header?
>
>     @defmac cl-defmethod name [qualifier] arguments [&context (expr spec)@dots{}] &rest [docstring] body
>
> Hmm, maybe that ends up being too long.
>  
>>                                                  The @code{&context}
>> +specializers look much like regular argument
>> +specializers---(@var{expr} @var{spec})---except that @var{expr} is an
>> +expression to be evaluated in the current context, and the @var{spec}
>> +is a value to compare against.  For example, @code{&context
>> +(overwrite-mode (eql t))} will make the method applicable only when
>> +@code{overwrite-mode} is turned on.  The @code{&context} keyword can
>> +be followed by any number of context specializers.  Because the
>> +context specializers are not part of the generic function's required
>> +argument signature, they may be omitted in methods that don't require
>> +them.
>
> Otherwise looks fine.
>   

Okay, that's pushed, I ended up adding the bit to the defmac statement
after all, it wraps and shouldn't be too big a deal.

Thanks,
Eric