I work on Mac OS X 10.5.8. I am trying to learn emacs. I am very new to it and today tried to enter shell commands from within emacs. I entered pdflatex filename
. H
According to the following article. If you launch emacs from a shell, it will inherit the shell's environment variables. Therefore, just launch emacs from whatever shell you are most comfortable with to automatically set the environment variables. For example:
cd /file_path
emacs file_name
It's possible that the Emacs shell is working in a different environment from the one you have at the terminal command line. Compare the output of env
when run inside the Emacs shell and when run in the terminal. Pay particular attention to the values of PATH
.
From help for shell
command:
Program used comes from variable ‘explicit-shell-file-name’, or (if that is nil) from the ESHELL environment variable, or (if that is nil) from ‘shell-file-name’. If a file ‘~/.emacs_SHELLNAME’ exists, or ‘~/.emacs.d/init_SHELLNAME.sh’, it is given as initial input (but this may be lost, due to a timing error, if the shell discards input when it starts up). The buffer is put in Shell mode, giving commands for sending input and controlling the subjobs of the shell. See ‘shell-mode’. See also the variable ‘shell-prompt-pattern’.
So you can just create symlink ~/.emacs_bash
(for bash) or ~/.emacs_zsh
(for zsh). Alternatively set variable explicit-shell-file-name
to point to ~/.bash_profile
or ~/.bashrc
or ~/.zshrc
whichever you use or you can play which ESHELL
environment variable as well.