I want to set PAGER to
cat in shell-mode. For eshell I just add a hook with
setenv. Unfortunately it doesn't seem to work for shell-mode, setenv doesn't set env variable. Is there other way to redefine shell-defined variables (which may be set in ~/.zshrc, so it needs to be redefined after shell is launched and rc file is sourced).
I'm using following code:
(defun my--shell-mode-hook () (setenv "PAGER" "cat") (setenv "EDITOR" "emacsclient") (setenv "BAR" "bar") (message "%s" (getenv "BAR")) ) (add-hook 'shell-mode-hook 'my--shell-mode-hook)
When I run
M-x shell string "bar" is displayed in the messages buffer, so var is being set in emacs. But in shell itself it is not set, neither existing variables are reset:
ineu@rei ~ $ env | grep -i -e pager -e editor -e bar env | grep -i -e pager -e editor -e bar EDITOR=subl3 -w PAGER=less GIT_EDITOR=emacsclient ineu@rei ~ $