From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#8340: 23.2; recompile does not retain compilation-environment needed by vc-git-grep Date: Tue, 06 Sep 2011 12:27:19 +0300 Organization: JURTA Message-ID: <87ehzukolk.fsf@mail.jurta.org> References: <4D8B9138.5070701@ieee.org> <871uvvtkwi.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1315301787 24193 80.91.229.12 (6 Sep 2011 09:36:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Sep 2011 09:36:27 +0000 (UTC) Cc: 8340@debbugs.gnu.org To: Trevor Spiteri Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 06 11:36:22 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R0s4r-0003Vq-Cp for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Sep 2011 11:36:21 +0200 Original-Received: from localhost ([::1]:57260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0s4q-0003Pr-Tv for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Sep 2011 05:36:20 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0s4o-0003Pf-8G for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 05:36:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0s4m-0004H4-EU for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 05:36:18 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36048) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0s4m-0004H0-96 for bug-gnu-emacs@gnu.org; Tue, 06 Sep 2011 05:36:16 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R0s8Q-0006TX-1g; Tue, 06 Sep 2011 05:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Sep 2011 09:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8340 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8340-submit@debbugs.gnu.org id=B8340.131530197824848 (code B ref 8340); Tue, 06 Sep 2011 09:40:01 +0000 Original-Received: (at 8340) by debbugs.gnu.org; 6 Sep 2011 09:39:38 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0s82-0006Sj-E6 for submit@debbugs.gnu.org; Tue, 06 Sep 2011 05:39:38 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0s80-0006SZ-59 for 8340@debbugs.gnu.org; Tue, 06 Sep 2011 05:39:37 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id F026D6E805B; Tue, 6 Sep 2011 02:35:48 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 9DCE3451C45D; Tue, 6 Sep 2011 02:35:47 -0700 (PDT) In-Reply-To: <871uvvtkwi.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 05 Sep 2011 12:10:05 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 06 Sep 2011 05:40:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50628 Archived-At: > Generally it would be better to reuse `compilation-environment' and set > it buffer-locally in the *compilation* buffer, but there is another problem. > Some users might want to set `compilation-environment' in .emacs like: > > (add-hook 'compilation-mode-hook > (lambda () > (setq compilation-environment '("LANG=C")))) > > See more in http://thread.gmane.org/gmane.emacs.devel/108353 > > But then let-binding (let ((compilation-environment '("PAGER=")))) > in `vc-git-grep' is ineffective because `compilation-mode-hook' > overrides it. So `compilation-environment' should be defcustom > to avoid this problem. The following patch fixed all these problems: === modified file 'lisp/progmodes/compile.el' --- lisp/progmodes/compile.el 2011-09-02 16:38:40 +0000 +++ lisp/progmodes/compile.el 2011-09-06 09:23:31 +0000 @@ -637,11 +637,15 @@ (defvar compilation-exit-message-functio and exit message; it returns a cons (MESSAGE . MODELINE) of the strings to write into the compilation buffer, and to put in its mode line.") -(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") ;; 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))