all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8340: 23.2; recompile does not retain compilation-environment needed by vc-git-grep
@ 2011-03-24 18:45 Trevor Spiteri
  2011-09-05  9:10 ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Trevor Spiteri @ 2011-03-24 18:45 UTC (permalink / raw)
  To: 8340

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))






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-09-08 12:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-24 18:45 bug#8340: 23.2; recompile does not retain compilation-environment needed by vc-git-grep Trevor Spiteri
2011-09-05  9:10 ` Juri Linkov
2011-09-06  9:27   ` Juri Linkov
2011-09-06 18:39     ` Stefan Monnier
2011-09-07 12:19       ` Juri Linkov
2011-09-07 13:36         ` Stefan Monnier
2011-09-08 12:12           ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.