From 60e4c762058753708dff3547e596766e3dac026a Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sat, 15 Aug 2015 00:10:58 -0700 Subject: [PATCH] Set prompt and pager differently when inside emacs --- dotfiles/gitconfig | 2 +- dotfiles/lib/shellenv/emacs.sh | 7 +++++++ dotfiles/lib/shellrc.sh | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dotfiles/gitconfig b/dotfiles/gitconfig index 247c3601..b9bb2c67 100644 --- a/dotfiles/gitconfig +++ b/dotfiles/gitconfig @@ -49,7 +49,7 @@ # Use custom `.gitignore` and `.gitattributes` excludesfile = ~/.gitignore attributesfile = ~/.gitattributes - pager = less -FXr + # pager = less -FXr # set with environment variable so that pager can be different when inside emacs [color] # Use colors in Git commands that are capable of colored output when diff --git a/dotfiles/lib/shellenv/emacs.sh b/dotfiles/lib/shellenv/emacs.sh index 063e5607..6be1c1ce 100644 --- a/dotfiles/lib/shellenv/emacs.sh +++ b/dotfiles/lib/shellenv/emacs.sh @@ -116,3 +116,10 @@ export EDITOR="$HOME/.lib/editor.sh" export ALTERNATE_EDITOR="" export VISUAL="$EDITOR" export GIT_EDITOR="$EDITOR" + +# This actually gets executed in dotfiles/lib/shellrc.sh to make sure that it takes precedence over other settings +function inside_emacs_hook { + export PAGER="$EDITOR" + export GITPAGER="$EDITOR" + export MANPAGER="$EDITOR" +} diff --git a/dotfiles/lib/shellrc.sh b/dotfiles/lib/shellrc.sh index d60bc57c..96643921 100644 --- a/dotfiles/lib/shellrc.sh +++ b/dotfiles/lib/shellrc.sh @@ -1,3 +1,4 @@ for filename in ~/.lib/shellrc/*; do source $filename done +environment_variable_exists INSIDE_EMACS && inside_emacs_hook