emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Always-true predicate?


From: Stefan Monnier
Subject: Re: Always-true predicate?
Date: Fri, 19 Feb 2021 09:42:34 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> And then we have this annoyance from "C-h v" as well:
>>
>>   read-extended-command-predicate is a variable defined in ‘simple.el’.
>>   Its value is
>>   #f(compiled-function
>>   (s b)
>>   #<bytecode 0x5a5068802147c83>)
>>
>> That's not very useful display for a user option.
>
> That's what prompted my query about adding something like `always'.
> (Although I've been missing the predicate for years.)

I love functions, and am in no small part to blame for the use of
functions like `ignore` as default value of variables (more often
`defvar` than `defcustom`, but still), but indeed giving name to those
functions is important: it's not just that `always` saves a few bytes
over `(lambda (&rest _) t)` in the `.el` file (and then again in the
`.elc` and in RAM), but also that `C-h v` gives more readable output
(and if that value ever finds its way elsewhere, you can easily jump to
its definition).

> I think using function values in user options is fine -- the Emacs
> developers can never get cover all behavioural permutations that people
> would like to see, so allowing them to supply their own code is helpful.

I fully agree.  But Eli is right that there's a tension and we should be
careful not to use too often (and we should work at trying to make sure
you don't need to know those functions when working with those vars,
which is already taken care of in `customize-variables` but not in
`set-variable`).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]