From: Eshel Yaron <me@eshelyaron.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Question about eval and compile-command
Date: Thu, 03 Aug 2023 19:23:34 +0300 [thread overview]
Message-ID: <m1msz89jsp.fsf@eshelyaron.com> (raw)
In-Reply-To: <jwvbkfo88ij.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 03 Aug 2023 11:14:35 -0400")
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).
next prev parent reply other threads:[~2023-08-03 16:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-03 9:29 Question about eval and compile-command Eshel Yaron
2023-08-03 9:56 ` Eli Zaretskii
2023-08-03 15:14 ` Stefan Monnier
2023-08-03 16:23 ` Eshel Yaron [this message]
2023-08-03 17:24 ` Stefan Monnier
2023-08-03 20:02 ` Philip Kaludercic
2023-08-03 20:39 ` Stefan Monnier
2023-08-03 21:14 ` Andreas Schwab
2023-08-03 21:35 ` [External] : " Drew Adams
2023-08-04 5:40 ` Eli Zaretskii
2023-08-04 6:51 ` Andreas Schwab
2023-08-04 7:00 ` Philip Kaludercic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1msz89jsp.fsf@eshelyaron.com \
--to=me@eshelyaron.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).