GNU bug report logs - #8340
23.2; recompile does not retain compilation-environment needed by vc-git-grep

Previous Next

Package: emacs;

Reported by: Trevor Spiteri <tspiteri <at> ieee.org>

Date: Thu, 24 Mar 2011 19:11:02 UTC

Severity: normal

Found in version 23.2

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 8340 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Trevor Spiteri <tspiteri <at> ieee.org>
Cc: 8340 <at> debbugs.gnu.org
Subject: Re: 23.2; recompile does not retain compilation-environment needed by
	vc-git-grep
Date: Mon, 05 Sep 2011 12:10:05 +0300
> 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))))




This bug report was last modified 13 years and 317 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.