Skip to main content
19 votes
Accepted

Git Bash in emacs on Windows

The ^[] noise is coming from various terminal control characters in your shell prompt. Try echo $PS1 to see the full sequence, and try e.g. export PS1='$ ' to see that a simpler prompt string removes ...
glucas's user avatar
  • 20.6k
17 votes
Accepted

.bash_profile or .bashrc for shell in emacs?

This is the correct behaviour. .bash_profile is for so-called login shells. Like when you log in to your computer in text mode, or in a terminal emulator to a different computer via ssh or telnet or .....
Vera Johanna's user avatar
14 votes

Emacs can't find Node when Node was installed using NVM

Best solution: Install exec-path-from-shell. From the documentation, after calling (package-initialize), add the following to your .emacs file: (when (memq window-system '(mac ns x)) (exec-path-...
user2245766's user avatar
13 votes

.bash_profile or .bashrc for shell in emacs?

In addition to the points made by @pingi, you can also use a separate configuration file that will be loaded only for the emacs shell (M-x shell): From the manual page (emacs) Interactive Shell: ...
Tyler's user avatar
  • 22.4k
12 votes
Accepted

Set indentation for shell script function

Setting sh-basic-offset to the required indentation is what is needed - but what I didn't realise is, it's also necessary to close and reopen all shell script files before the customisation takes ...
Robin Green's user avatar
12 votes

How to fix "Symbol's function definition is void: org-babel-get-header"

According to https://lists.gnu.org/archive/html/emacs-orgmode/2015-11/msg00425.html ob-sh was renamed ob-shell in org 8.2 ... and I cite from there: org-babel-get-header was removed in 0d000f5 (...
Tobias's user avatar
  • 33.3k
12 votes
Accepted

Help me avoid "|| true" in org babel bash statements

You're nearly there; you have a :prologue set, via exec 2>&1, to capture both stdout and stderr. To finish this, you just need two things: :results: output to inform Babel that you want the ...
Trey's user avatar
  • 905
11 votes

Tramp: Waiting for prompts from remote shell

I had this exact same problem but it had nothing to do with RVM on ( which I also have ) on my Ubuntu-16.10 machine. It was related to by custom prompt (PS1) The issue was the prompt PS1. This fix :...
Jimi 's user avatar
  • 111
10 votes
Accepted

copy from shell and paste in terminal-emacs

You can't copy-paste between Emacs and a shell without using a system-wide copy-paste facility. Text terminals in general do not provide a copy-paste facility. It seems that you're running this ...
Gilles 'SO- stop being evil''s user avatar
8 votes
Accepted

How to get the PATH from the SHELL

No, you don’t want to use -i because you’re not launching an interactive shell. That is, this shell will not be connected to a terminal that the user can type in. It is instead going to be connected ...
db48x's user avatar
  • 18.4k
7 votes
Accepted

How do you run Emacs on mac?

Just to expand on @ghoetker's answer: Install Emacs into your application folder from https://emacsformacosx.com/ Using the terminal, open the file ~/.zshrc in your favorite text editor. Somewhere ...
Raydot's user avatar
  • 186
6 votes
Accepted

How to get bash source code blocks to execute .profile / .bashrc

You can find out how your code is executed by checking ob-shell.el. As for your particular example, your code is passed to bash as stdin, something like the following $ echo 'echo $...
xuchunyang's user avatar
  • 14.6k
6 votes
Accepted

Spawn a bash outside emacs?

Because bash it is not the GUI program. Start your terminal emulator instead like (start-process "xterm" nil (executable-find "xterm"))
muffinmad's user avatar
  • 2,320
6 votes
Accepted

Noweb references in sh blocks breaks the syntax highlighting

You can define the delimiters babel use for noweb references, by setting org-babel-noweb-wrap-start and org-babel-noweb-wrap-start. For instance, in org mode document where I dabble in bash, I insert ...
Dreammm's user avatar
  • 76
6 votes
Accepted

How can I open an org file at a specific header postion via a command line?

Perhaps something along the following lines: emacs -Q --eval='(progn (find-file "/path/to/file") (goto-char (org-find-exact-headline-in-buffer "org-headline")))'
aadcg's user avatar
  • 1,248
6 votes
Accepted

eshell should use bash_aliases

eshell should not use your bash aliases because, other than them both being shells, eshell has nothing to do with bash. eshell is a shell written entirely in elisp. It's not bash, sh, ksh, csh, zsh, ...
phils's user avatar
  • 51.7k
5 votes

Flycheck gives errors, when I use shellcheck as linter for bash scripts

apt installs an old version of flycheck, https://github.com/koalaman/shellcheck/issues/704 that does not support --external-sources, this particular commit has been merged at flycheck recently https://...
CESCO's user avatar
  • 374
5 votes

Tramp: Waiting for prompts from remote shell

It looks like you've run the exec-path-from-shell from a Tramp buffer, so when it runs the shell, it attempts to do its magic on the remote server and then set the environment variables in your local ...
sanityinc's user avatar
  • 2,931
5 votes

How do you abort an emacs M-x compile compilation

Know that you can use M-x compile to compile from within Emacs. If you do that then, in your compilation output buffer, use C-h m to see information about the mode. For example, it might tell you ...
Drew's user avatar
  • 78k
5 votes
Accepted

How to change shell-script-mode indentation not to use tabs?

Shell script mode does not have any setting that relates to using tabs vs spaces (at least as of Emacs 25.2). It obeys the default Emacs setting which is given by indent-tabs-mode and tab-width: 8 ...
Gilles 'SO- stop being evil''s user avatar
4 votes
Accepted

sh-script alignment issues

For the indentation after the | you should be able to get the right result by going to the incorrect line (i.e. the one that starts with grep) and then do M-x smie-config-set-indent RET before "|" RET ...
Stefan's user avatar
  • 26.5k
4 votes

Set indentation for shell script function

I set-basic-offset to 2 but that didn't seem to work, I went back pressed C-h v sh-<TAB> and realized that there was a sh-indentation I set that variable to 2 and everything seems to work like a ...
Albaro Pereyra's user avatar
4 votes

How do you run Emacs on mac?

Yes. An alias to the binary within Emacs.app is useful and will allow to call an up-to-date version of emacs from the terminal via “emacs”. I have the following set up alias emacs='$(/Applications/...
ghoetker's user avatar
4 votes

How do you run Emacs on mac?

Applying Dave Kanter's recipe, I still run into trouble: "Emacs" can't be opened because Apple cannot check it for malicious software. To get it to run, I had to open Settings, Settings, ...
Thomas Schietinger's user avatar
4 votes

Noweb references in sh blocks breaks the syntax highlighting

I liked @Dreammm's idea of using the « and » characters but didn't like having to declare file local variables. I also did not want to always use « and ». I just overwrote the org-babel-noweb-wrap ...
Chris's user avatar
  • 153
3 votes
Accepted

External command doesn't run in GUI mode

exec-path is how Emacs finds executables, but you're not asking Emacs to find pdflatex, you're only asking it to find a shell, and the shell is then trying to run pdflatex. The shell will be using ...
phils's user avatar
  • 51.7k
3 votes
Accepted

how to automatically open .ics file after org-icalendar-export-to-ics?

In conjunction with the assistance of the original poster in the comments above, here is the final solution: (defun org-icalendar-open-ics-file (file) (start-process "org-icalendar-open-ics-file-...
lawlist's user avatar
  • 19.2k
3 votes
Accepted

Bash command to see a list of all open buffers

Try this: emacsclient -e '(buffer-list)'
Emacs User's user avatar
  • 5,663
3 votes

Remote shell path - env: No such file or directory

Emacs / Tramp don't know your login shell. You could teach them, by setting (setq explicit-shell-file-name "/bin/bash") See also the discussion in the Emacs manual at (info "(emacs) Interactive ...
Michael Albinus's user avatar
3 votes

sh-script-mode: get [[ ... ]] pair expansion to automatically include whitespace?

You could try smartparens. With the settings below: Pressing [ SPC becomes [ | ] Pressing [ [ SPC becomes [[ | ]] Selecting foo and pressing [ becomes [ foo ] Pressing [ a second time becomes [[ foo ]...
jagrg's user avatar
  • 3,954

Only top scored, non community-wiki answers of a minimum length are eligible