all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Juri Linkov <juri@jurta.org>
Cc: 8340@debbugs.gnu.org, Trevor Spiteri <tspiteri@ieee.org>
Subject: bug#8340: 23.2; recompile does not retain compilation-environment needed by vc-git-grep
Date: Tue, 06 Sep 2011 14:39:58 -0400	[thread overview]
Message-ID: <jwvbouxa5bz.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ehzukolk.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 06 Sep 2011 12:27:19 +0300")

> -(defvar compilation-environment nil
> -  "*List of environment variables for compilation to inherit.
> +(defcustom compilation-environment nil
> +  "List of environment variables for compilation to inherit.
>  Each element should be a string of the form ENVVARNAME=VALUE.
>  This list is temporarily prepended to `process-environment' prior to
> -starting the compilation process.")
> +starting the compilation process."
> +  :type '(repeat (string :tag "ENVVARNAME=VALUE"))
> +  :options '(("LANG=C"))
> +  :group 'compilation
> +  :version "24.1")

What is this supposed to fix?

>  ;; History of compile commands.
>  (defvar compile-history nil)
> @@ -1482,6 +1491,7 @@ (defun compilation-start (command &optio
>  	      "compilation"
>  	    (replace-regexp-in-string "-mode\\'" "" (symbol-name mode))))
>  	 (thisdir default-directory)
> +	 (thisenv compilation-environment)
>  	 outwin outbuf)
>      (with-current-buffer
>  	(setq outbuf
> @@ -1530,6 +1541,7 @@ (defun compilation-start (command &optio
>          ;; affected by the special handling of "cd ...;".
>          ;; NB: must be fone after (funcall mode) as that resets local variables
>          (set (make-local-variable 'compilation-directory) thisdir)
> +	(set (make-local-variable 'compilation-environment) thisenv)
>  	(if highlight-regexp
>  	    (set (make-local-variable 'compilation-highlight-regexp)
>  		 highlight-regexp))

> === modified file 'lisp/vc/vc-git.el'
> --- lisp/vc/vc-git.el	2011-09-01 07:29:56 +0000
> +++ lisp/vc/vc-git.el	2011-09-06 09:19:48 +0000
> @@ -998,7 +998,7 @@ (defun vc-git-grep (regexp &optional fil
>  	    (add-to-history 'grep-history command))))
>        (when command
>  	(let ((default-directory dir)
> -	      (compilation-environment '("PAGER=")))
> +	      (compilation-environment (cons "PAGER=" compilation-environment)))
>  	  ;; Setting process-setup-function makes exit-message-function work
>  	  ;; even when async processes aren't supported.
>  	  (compilation-start command 'grep-mode))

Mixing defcustom+bufferlocal+letbinding is really asking for trouble,
although I think in this case it might just fall within the limits of
what does work.
The vc-git.el patch looks perfectly good and so does the (set...thisenv).
But I'd prefer to refrain from making compilation-environment a defcustom
for now, until we find a really good use for it.


        Stefan





  reply	other threads:[~2011-09-06 18:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24 18:45 bug#8340: 23.2; recompile does not retain compilation-environment needed by vc-git-grep Trevor Spiteri
2011-09-05  9:10 ` Juri Linkov
2011-09-06  9:27   ` Juri Linkov
2011-09-06 18:39     ` Stefan Monnier [this message]
2011-09-07 12:19       ` Juri Linkov
2011-09-07 13:36         ` Stefan Monnier
2011-09-08 12:12           ` Juri Linkov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvbouxa5bz.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=8340@debbugs.gnu.org \
    --cc=juri@jurta.org \
    --cc=tspiteri@ieee.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.