emacs-devel
[Top][All Lists]
Advanced

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

Re: Question about eval and compile-command


From: Eshel Yaron
Subject: Re: Question about eval and compile-command
Date: Thu, 03 Aug 2023 19:23:34 +0300
User-agent: Gnus/5.13 (Gnus v5.13)

Thanks Eli, Stefan,

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> It looks like Stefan added the 'eval' calls as a minor cleanup and not
>> as part of the change itself.  Stefan, any chance you remember why you
>> added the 'eval' calls?
>
> I added it to allow the `compile-command` to be
> (re)computed dynamically.

I have two followup questions in that case:

1. Given that this is meant to allow recomputing `compile-command`
dynamically, why does `compile` set `compile-command` to its `command`
argument (which is a string, not an expression)?  This potentially
causes `compile-command` to only be dynamically evaluated in the first
invocation of `compile`, before being set to a plain string.  Consider:

--8<---------------cut here---------------start------------->8---
(let ((compilation-read-command nil)
      (compile-command '(concat "echo " (int-to-string (random 100)))))
  (call-interactively #'compile)
  compile-command)
  => "echo 38"
--8<---------------cut here---------------end--------------->8---

We see that `compile` had the side effect of setting `compile-command`
to a string.

2. Should the manual/docstrings reflect that `compile-command` can be
computed dynamically in this manner?  I'd be happy to contribute a patch
documenting this feature, expect I'm not totally sure how users should
best leverage it (see previous question).



reply via email to

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