Skip to content

Instantly share code, notes, and snippets.

@nelhage
Created October 5, 2010 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nelhage/611694 to your computer and use it in GitHub Desktop.
Save nelhage/611694 to your computer and use it in GitHub Desktop.
commit 6297e8bbfa2ef9b870a182c29a26f189297b4b63
Author: Nelson Elhage <nelhage@ksplice.com>
Date: Tue Oct 5 10:57:58 2010 -0400
Don't use a pager when called through M-x grep.
diff --git a/pager.c b/pager.c
index dac358f..32ff2f3 100644
--- a/pager.c
+++ b/pager.c
@@ -51,10 +51,15 @@ static void wait_for_pager_signal(int signo)
const char *git_pager(int stdout_is_tty)
{
const char *pager;
+ const char *term;
if (!stdout_is_tty)
return NULL;
+ term = getenv("TERM");
+ if (term && !strcmp(term, "emacs-grep"))
+ return NULL;
+
pager = getenv("GIT_PAGER");
if (!pager) {
if (!pager_program)
commit e05347e5d73a255f34fcce2d5832e3aea9b55b78
Author: Nelson Elhage <nelhage@ksplice.com>
Date: Tue Oct 5 10:55:10 2010 -0400
emacs M-x shell understands color
diff --git a/color.c b/color.c
index bcf4e2c..4b3d705 100644
--- a/color.c
+++ b/color.c
@@ -159,7 +159,7 @@ int git_config_colorbool(const char *var, const char *value, int stdout_is_tty)
stdout_is_tty = isatty(1);
if (stdout_is_tty || (pager_in_use() && pager_use_color)) {
char *term = getenv("TERM");
- if (term && strcmp(term, "dumb"))
+ if (term && strcmp(term, "dumb") && !getenv("EMACS"))
return 1;
}
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment