Hot answers tagged

47 votes
Accepted

Weird shell output when using IPython 5

IPython 5 has a new terminal interface, which is not compatible with Emacs' inferior shells. To fix it, add the --simple-prompt flag to the IPython command: (setq python-shell-interpreter "ipython" ...
user avatar
32 votes
Accepted

What are all the ways of launching a shell from inside emacs and what are their various properties?

M-x shell is the standard interface to OS's shell. On linux, it calls bash (or whatever your default), on Windows, it calls cmd.exe. M-x shell is the most frequently used. M-x eshell is a shell ...
user avatar
  • 1,706
26 votes

Emacs and command line $PATH disagreements on OSX

You can also install exec-path-from-shell package and add this to your init file: (exec-path-from-shell-initialize)
user avatar
  • 431
22 votes
Accepted

How can I run an async process in the background without popping up a buffer?

You can start background processes with start-process, which shouldn't pop up a buffer: (start-process "process-name" "buffer-name" "program") Process names are modified to avoid duplication as ...
user avatar
18 votes
Accepted

Tramp mode is much slower than using terminal to ssh

Turns out it was projectile that was causing the problems. As soon as I disabled projectile-mode TRAMP was buttery smooth and I began to understand the hype behind it. Hopefully this helps out ...
user avatar
  • 683
16 votes
Accepted

Any way to make prompts and previous-output uneditable in shell/term-mode?

comint-derived modes (like shell, ielm, ...) support filter functions, the following snippet makes the output and prompt read-only: (setq comint-prompt-read-only t) (defun my-comint-preoutput-turn-...
user avatar
  • 21k
16 votes

Flush all output in shell buffer (and *Messages* too)

You can clean up the *Messages* buffer the same way you always could, with the kill-buffer command. The next time a message is signaled, the buffer will be recreated anew. The reason that this buffer ...
user avatar
  • 22.4k
16 votes
Accepted

How to prevent backspace from deleting my shell prompt?

I think you're looking for comint-prompt-read-only. E.g. (setq comint-prompt-read-only t) should take care of it.
user avatar
  • 25.3k
15 votes
Accepted

How to prevent Emacs from showing passphrase in `M-x shell`?

In Shell mode, Emacs detects password prompts based on the prompt. If it sees Password: (or Enter new password:, or Passwort:, or Wachtwoord: or a number of variations), it assumes that you're ...
user avatar
15 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 .....
user avatar
14 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 ...
user avatar
  • 19.2k
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: ...
user avatar
  • 20.3k
12 votes
Accepted

Async shell process buffer always clobbers window arrangement

Since mention that the command is running asynchronously I am assuming you mean the command async-shell-command bound to M-&. You can follow the advice in documentation of async-shell-command (you ...
user avatar
  • 7,298
12 votes

how to name buffers (*shell*)

Go to the buffer you want to rename, in your case *shell*. Then type M-x rename-buffer and enter the new name for this buffer.
user avatar
12 votes

fix or workaround: "Terminal is not fully functional"

Quick answer That's not an issue, it's a statement of fact. M-x shell isn't a fully functional terminal - it simply can't do what you want it to do. If you want a full terminal emulator in emacs, you ...
user avatar
  • 20.3k
10 votes
Accepted

Emacs and command line $PATH disagreements on OSX

This is an OSX annoying environment issue, the $PATH appearing in Emacs is coming from /etc/paths file, which then gets appended with whatever I've set in the shell. I added /Users/g/Library/Haskell/...
user avatar
10 votes
Accepted

How to make a shell command totally silent (preventing it to split window or to open a new frame/window etc)

save-window-excursion is a macro for running a piece of code without altering the window configuration. Something like this should work: (defun my-view-pdf () (interactive) (save-window-excursion ...
user avatar
  • 5,834
10 votes

How to make a shell command totally silent (preventing it to split window or to open a new frame/window etc)

If you just would like to spawn a process in the background you don't need all the bells an whistles that shell command functions provide. Instead, you can use the function call-process. For example: ...
user avatar
  • 5,765
10 votes

Tramp mode is much slower than using terminal to ssh

I have also found the solutions on the tramp FAQ that address speeding tramp up to work pretty well. From the page, here is what I added to my configuration: (setq remote-file-name-inhibit-cache nil)...
user avatar
10 votes
Accepted

How do i change the default shell for shell-command

You need to change the option shell-file-name. (setenv "SHELL" "/bin/bash") This doesn't work since Emacs is already running thus it's too late, Emacs initializes shell-file-name according to ...
user avatar
  • 13.6k
10 votes
Accepted

Org Src Block does not return any output

Rephrasing and shortening, I guess the question is roughly: "how to obtain stderr output without changing the source block content?" By skimming the comments section of the John Kitchin's ...
user avatar
9 votes
Accepted

“terminal is not fully functional” over ssh in a *shell* buffer

The "problem" is that with M-x shell (or M-x eshell btw), Emacs uses a very limited terminal emulator, so that TERM is correctly set to dumb Fancy pagers cannot operate under such limited constraints,...
user avatar
  • 4,440
9 votes
Accepted

M-x shell doesn't know about installed apps

Well, as @dshepherd mentioned, you are missing /usr/local/bin in PATH. git is working probably only because there is symlink in /bin. Try export PATH=$PATH:/usr/local/bin in emacs terminal. You can ...
user avatar
  • 278
8 votes

How can I run an async process in the background without popping up a buffer?

Like Tikhon mentioned, (start-process) is the way to go. In case you don't want to create a buffer but would still like to react to the background process status, you can also employ (set-process-...
user avatar
  • 1,344
8 votes
Accepted

Difference between shell and term

shell is the oldest of the two. It uses Emacs's comint-mode to run a subshell (e.g. bash). In this mode, you're using Emacs to edit a command line. The subprocess doesn't see any input until you ...
user avatar
  • 6,564
8 votes

How to open `shell` or `eshell` in a new window or frame

The canonical way of altering the display behaviour for a buffer is to customize display-buffer-alist: (setq display-buffer-alist '(("\\`\\*e?shell" display-buffer-pop-up-window))) (setq display-...
user avatar
  • 21k
8 votes

How to make a shell command totally silent (preventing it to split window or to open a new frame/window etc)

Use display-buffer-alist with the display-buffer-no-window if you're on Emacs 24.4 or later. (setq display-buffer-alist '(("\\`\\*Async Shell Command\\*\\'" display-buffer-no-window))) Alternatively,...
user avatar
  • 21k
8 votes

Can emacs commands be called from a shell script?

You can run emacs --batch f htmlize-my-org --kill where htmlize-my-org is a function you've written that runs htmlize on those files. You can also pass files on the command line, e.g. emacs --batch -...
user avatar
  • 1,045
8 votes
Accepted

Org-babel invoking cmd.exe

In spite of what I wrote in the comments one can set cmd as shell in ob-sh! The only thing to be aware of is that one needs to use cmdproxy.exe instead of cmd.exe to get the output to stdout right. ...
user avatar
  • 30.3k
8 votes
Accepted

weird characters in shell mode with zsh

The control sequences ^[[?2004h and ^[[?2004l turn bracketed paste mode on and off. Shell mode doesn't support bracketed paste mode (with these or any other control sequences), so zsh shouldn't try ...
user avatar

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