[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8340: 23.2; recompile does not retain compilation-environment needed

From: Trevor Spiteri
Subject: bug#8340: 23.2; recompile does not retain compilation-environment needed by vc-git-grep
Date: Thu, 24 Mar 2011 18:45:12 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv: Gecko/20110303 Thunderbird/3.1.9

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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]