Skip to main content
48 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" ...
Ricardo Lima's user avatar
18 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
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.
Stefan's user avatar
  • 26.4k
16 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 ...
Gilles 'SO- stop being evil''s user avatar
14 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.
user2739472's user avatar
14 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 ...
Tyler's user avatar
  • 22.3k
13 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)...
colelemonz'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.3k
12 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 ...
Firmin Martin's user avatar
11 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 ...
xuchunyang's user avatar
  • 14.6k
11 votes

The elisp function to run the shell command in specific file path

From elisp you can set default-directory temporarily and then run your shell command: (let ((default-directory "/tmp")) (shell-command "ls"))
amitp's user avatar
  • 2,541
8 votes

Run a shell command as lisp

Interactively, C-u M-! (i.e., shell-command with the universal argument prefix) will prompt you for a shell command and insert the output in the current buffer. To do this from elisp code, see the ...
Tyler's user avatar
  • 22.3k
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.1k
7 votes

Should I have removed `(shell . t)` to clear an ob-shell initialization error?

Did you successfully fix the problem? Sure! ob-shell was flipping out and you stopped loading it. That is, in some sense, a fix! That said: the chunk of code you found and commented out controls ...
Gastove's user avatar
  • 1,551
7 votes
Accepted

Error running Emacs from a Terminal window: "Symbol's function definition is void: package-initialize"

This is an ancient version of emacs that came preinstalled with macOS. To find out where the version of emacs that you installed is, start it by clicking on the icon and then evaluate (expand-file-...
tarsius's user avatar
  • 25.7k
7 votes

Send region to shell in another buffer

Emacs provides the function process-send-region to do this. If your buffer always has the same name, you can hard-code it in: (defun my-send (beg end) (interactive "r") (process-send-region "...
Tyler's user avatar
  • 22.3k
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

Emacs is garbled by output of a background process running in the same terminal emulator

No, there isn't, if you don't want to silence your background processes. You could use something like tmux or GNU Screen for your background processes. Or you could run them in another terminal. ...
asjo's user avatar
  • 1,077
6 votes

TERM, terminfo, termcap. What are they how does Emacs use it?

TERM is an environment variable, you set it in your environment. This could be the environment of a particular shell that you've opened, by running export TERM=foo, or all of your shells by adding the ...
db48x's user avatar
  • 18.1k
6 votes
Accepted

How i can open shell in current buffer?

I am assuming that the original poster means targeting the currently selected window in the same frame. In the event the original poster is desirous of targeting a specific window in a different ...
lawlist's user avatar
  • 19.1k
6 votes

fix or workaround: "Terminal is not fully functional"

If you don't care about whether Emacs is a "fully-functional" terminal or not and you just want it to work without making you press enter, then run the psql command \pset pager off. This ...
db48x's user avatar
  • 18.1k
6 votes
Accepted

Using pipe in a shell command

By default, dired-do-shell-command inserts the file name at the end of the command you enter. In effect, you are doing this: tac | head -n 2 test Without an argument, tac doesn't produce any output ...
Tyler's user avatar
  • 22.3k
6 votes

How disable show warning message in shell?

To suppress the warning first make sure the warnings library is loaded by entering M-x load-library RET warnings RET. Then add the listed option to warning-suppress-types. Load the customization ...
martin_joerg's user avatar
6 votes
Accepted

Setting :stdin with #+call in org-mode shell code block

:stdin isn't a argument as far as a function call is concerned. It's a special header argument which uses a slightly funky #+CALL syntax. Try: #+CALL: my-shell-block[:stdin example-block1]() ...
stsquad's user avatar
  • 4,661
6 votes
Accepted

Need emacs lisp function to execute command in *shell* buffer

comint-send-string is the function you're looking for. (shell is built on top of the comint library.) It takes a PROCESS and a STRING. You can get the process from the shell buffer, and ...
phils's user avatar
  • 51.3k
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,310
6 votes
Accepted

How to determine which program is running inside an emacs shell buffer?

Here's a simple function that gets the pid of the process running in the current buffer and then calls the pstree command to get the process tree of that process: (defun iproc () (interactive) (...
NickD's user avatar
  • 29.8k
5 votes
Accepted

How to discard stderr when running a shell function?

Use the following form instead of (shell-command-to-string some-command): (with-output-to-string (with-current-buffer standard-output (process-file shell-file-name nil '(t nil) nil ...
Tobias's user avatar
  • 33.2k
5 votes

Should I have removed `(shell . t)` to clear an ob-shell initialization error?

I encountered the same problem. I got my fresh new Emacs 25.3 with a built-in org-mode of version 8.2.10. When I started Emacs with my old init file, I got the exactly same thing. File error: ...
Lei Zhao's user avatar
  • 421

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