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: Mon, 05 Sep 2011 12:10:05 +0300 Organization: JURTA Message-ID: <871uvvtkwi.fsf@mail.jurta.org> References: <4D8B9138.5070701@ieee.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1315214145 9020 80.91.229.12 (5 Sep 2011 09:15:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 5 Sep 2011 09:15:45 +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 Mon Sep 05 11:15:35 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 1R0VHC-0002Jy-74 for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Sep 2011 11:15:34 +0200 Original-Received: from localhost ([::1]:54701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0VHB-0007QE-LM for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Sep 2011 05:15:33 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:38456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0VH6-0007OW-Al for bug-gnu-emacs@gnu.org; Mon, 05 Sep 2011 05:15:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0VH0-0001jG-7S for bug-gnu-emacs@gnu.org; Mon, 05 Sep 2011 05:15:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0VGz-0001j3-QP for bug-gnu-emacs@gnu.org; Mon, 05 Sep 2011 05:15:21 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R0VKX-0000OR-HV; Mon, 05 Sep 2011 05:19:01 -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: Mon, 05 Sep 2011 09:19: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.13152142831438 (code B ref 8340); Mon, 05 Sep 2011 09:19:01 +0000 Original-Received: (at 8340) by debbugs.gnu.org; 5 Sep 2011 09:18:03 +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 1R0VJX-0000Mp-4l for submit@debbugs.gnu.org; Mon, 05 Sep 2011 05:18:03 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R0VJR-0000Md-8h for 8340@debbugs.gnu.org; Mon, 05 Sep 2011 05:17:57 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id EE2696E8054; Mon, 5 Sep 2011 02:14:11 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id A0D69451C356; Mon, 5 Sep 2011 02:14:09 -0700 (PDT) In-Reply-To: <4D8B9138.5070701@ieee.org> (Trevor Spiteri's message of "Thu, 24 Mar 2011 18:45:12 +0000") 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: Mon, 05 Sep 2011 05:19:01 -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:50605 Archived-At: > In the function vc-git-grep inside vc-git.el, the compilation environment > is set as > > (compilation-environment '("PAGER=")) > > because git grep needs that. If I use M-x recompile in the *grep* buffer > after using M-x vc-git-grep, compilation-environment is not set, and > a warning that the "terminal is not fully functional" is displayed, one > page of results is shown, and git grep blocks waiting on standard input, > since it is using more as a pager. > > To fix this, I applied the following patch to compile.el that stores > compile-environment in a similar way to default-directory. It works for me, > but I do not really know elisp. 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. I don't know whether it's good for defcustom to be buffer-local. But this should fix both problems when `vc-git-grep' will add "PAGER=" to the default or customized value of `compilation-environment' like (let ((compilation-environment (cons "PAGER=" compilation-environment))))