[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8340: 23.2; recompile does not retain compilation-environment needed
From: |
Juri Linkov |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) |
> 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))))
- bug#8340: 23.2; recompile does not retain compilation-environment needed by vc-git-grep,
Juri Linkov <=