unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* locally modifying `compilation-environment'
@ 2013-10-13 20:37 Stephen Leake
  2013-10-14  4:45 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Leake @ 2013-10-13 20:37 UTC (permalink / raw)
  To: emacs-devel

`compilation-start' uses `make-local-variable' to make
`compilation-environment' buffer-local in the created compilation
buffer.

That complains if it is let-bound, like this:

      (let ((compilation-environment ...)
            ...)

	(compilation-start cmd
			   'compilation-mode
			   (lambda (mode-name) (concat mode-name "-gnatinspect-overriding")))
	)

This gives a message:

    Making compilation-environment local to
    compilation-gnatinspect-overriding while let-bound!

I assume `compilation-environment' is made buffer-local so it will have
the same value for a rerun of the compile command in that buffer, which
makes sense.

But I don't see any other way to modify compilation-environment for this
compilation only.

compile-start-hook is run too late, so I can't set
compilation-environment there.

In this particular application, I can let-bind process-environment
instead (it is not made buffer-local); I don't care about re-running the
compile command. But that by-passes the purpose of
compilation-environment in general.

It seems compilation-start needs another parameter, for a local value of
compilation-environment. 

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: locally modifying `compilation-environment'
  2013-10-13 20:37 locally modifying `compilation-environment' Stephen Leake
@ 2013-10-14  4:45 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2013-10-14  4:45 UTC (permalink / raw)
  To: Stephen Leake; +Cc: emacs-devel

> That complains if it is let-bound, like this:

Actually, it's not a complaint, just a warning, so feel free to ignore
it.  We should probably remove this warning, actually.  IIRC it was
added by yours truly because this catches a rare occurrence, which
seemed like it could lead to bugs, but AFAIK it never caught any bug.


        Stefan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-14  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-13 20:37 locally modifying `compilation-environment' Stephen Leake
2013-10-14  4:45 ` Stefan Monnier

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).