help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to tame compiler?


From: Stefan Monnier
Subject: Re: How to tame compiler?
Date: Fri, 30 Apr 2021 18:50:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> Here, as in your other example, you have to use `eval`,
>> because `command-history` was defined to contain a list of
>> ELisp expressions and those can't be used other than via
>> `eval`.
>>
>> So I'll grant you a pass for this time.
>>
>> If you were in a position to control the format of history
>> variable, then you wouldn't have to use `eval` here, OTOH:
>> you could define that variable to hold a list of *functions*
>> and you'd just use `funcall` instead of `eval`.
>
> OK, clear...

Of course, you can't "search" for functions the way you do with the
`cl-find-if`, and functions can't be printed in a user-friendly way, so
there's a good reason for `command-history` not to contain
just functions.

So if you wanted to replace it with a history that can be used without
`eval`, you'd probably make the new variable contain a list where every
element is of the form (FUNCTION . ARGS), so that you'd replace `eval`
with `apply`, and you'd recommend that the FUNCTION be a symbol rather
than an anonymous function, to be sure that it can be compared and
printed in a useful way.


        Stefan




reply via email to

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