[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with Eshell and grep.
From: |
Juri Linkov |
Subject: |
Re: Problem with Eshell and grep. |
Date: |
Wed, 13 Oct 2004 16:36:33 +0300 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
Matt Hodges <address@hidden> writes:
> After starting Eshell, M-x grep modifies the global value of
> process-environment if called from an Eshell buffer, initially
> prepending "GREP_COLOR=01;41" and "GREP_OPTIONS= --color=always", and
> adding another " --color=always" to GREP_OPTIONS for each subsequent
> call to grep. (To reproduce this, it is sufficient to eval
> (make-local-variable 'process-environment) and then M-x grep from the
> same buffer.)
That is because rebinding occurs after switching the buffers. This can
be fixed by binding `process-environment' locally later, after setting
the grep output buffer (patch is below).
> Also, the binding of compilation-process-setup-function in eshell-grep
> may now be obsolete.
I know nothing about `eshell-grep' and why it binds
`compilation-process-setup-function'. Perhaps, its maintainer
should fix `eshell-grep'.
Index: lisp/progmodes/compile.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.330
diff -u -r1.330 compile.el
--- lisp/progmodes/compile.el 12 Sep 2004 18:08:12 -0000 1.330
+++ lisp/progmodes/compile.el 13 Oct 2004 13:18:31 -0000
@@ -866,20 +866,6 @@
(if (eq mode t)
(prog1 "compilation" (require 'comint))
(replace-regexp-in-string "-mode$" "" (symbol-name mode))))
- (process-environment
- (append
- compilation-environment
- (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
- system-uses-terminfo)
- (list "TERM=dumb" "TERMCAP="
- (format "COLUMNS=%d" (window-width)))
- (list "TERM=emacs"
- (format "TERMCAP=emacs:co#%d:tc=unknown:"
- (window-width))))
- ;; Set the EMACS variable, but
- ;; don't override users' setting of $EMACS.
- (unless (getenv "EMACS") '("EMACS=t"))
- (copy-sequence process-environment)))
cd-path ; in case process-environment contains CDPATH
(thisdir (if (string-match "^\\s *cd\\s +\\(.+?\\)\\s *[;&\n]" command)
(substitute-in-file-name (match-string 1 command))
@@ -923,6 +909,20 @@
;; Pop up the compilation buffer.
(setq outwin (display-buffer outbuf nil t))
(with-current-buffer outbuf
+ (let ((process-environment
+ (append
+ compilation-environment
+ (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
+ system-uses-terminfo)
+ (list "TERM=dumb" "TERMCAP="
+ (format "COLUMNS=%d" (window-width)))
+ (list "TERM=emacs"
+ (format "TERMCAP=emacs:co#%d:tc=unknown:"
+ (window-width))))
+ ;; Set the EMACS variable, but
+ ;; don't override users' setting of $EMACS.
+ (unless (getenv "EMACS") '("EMACS=t"))
+ (copy-sequence process-environment))))
(if (not (eq mode t))
(funcall mode)
(with-no-warnings (comint-mode))
@@ -986,7 +986,7 @@
;; fontified, so fontify it now.
(let ((font-lock-verbose nil)) ; shut up font-lock messages
(font-lock-fontify-buffer))
- (message "Executing `%s'...done" command)))
+ (message "Executing `%s'...done" command))))
(if (buffer-local-value 'compilation-scroll-output outbuf)
(save-selected-window
(select-window outwin)
--
Juri Linkov
http://www.jurta.org/emacs/