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 #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Trevor Spiteri <tspiteri <at> ieee.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; recompile does not retain compilation-environment needed by
	vc-git-grep
Date: Thu, 24 Mar 2011 18:45:12 +0000
Version 23.2.

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.

--- a/compile.el    2011-03-24 18:24:01.000000000 +0000
+++ b/compile.el    2011-03-24 18:27:44.000000000 +0000
@@ -511,6 +511,9 @@
 (defvar compilation-directory nil
   "Directory to restore to when doing `recompile'.")

+(defvar recompilation-environment nil
+  "Environment to restore when doing `recompile'.")
+
 (defvar compilation-directory-matcher
   '("\\(?:Entering\\|Leavin\\(g\\)\\) directory `\\(.+\\)'$" (2 . 1))
   "A list for tracking when directories are entered or left.
@@ -1106,7 +1109,8 @@
 If the optional argument `edit-command' is non-nil, the command can be 
edited."
   (interactive "P")
   (save-some-buffers (not compilation-ask-about-save) nil)
-  (let ((default-directory (or compilation-directory default-directory)))
+  (let ((default-directory (or compilation-directory default-directory))
+        (compilation-environment (or recompilation-environment 
compilation-environment)))
     (when edit-command
       (setcar compilation-arguments
               (compilation-read-command (car compilation-arguments))))
@@ -1236,6 +1240,7 @@
         ;; 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 'recompilation-environment) 
compilation-environment)
     (if highlight-regexp
         (set (make-local-variable 'compilation-highlight-regexp)
          highlight-regexp))





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.