Hot answers tagged

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
20 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 ...
m0meni's user avatar
  • 753
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.4k
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 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
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.3k
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
  • 21.9k
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
  • 21.9k
12 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
11 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 ...
Gilles 'SO- stop being evil''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.4k
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,461
11 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
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. ...
Tobias's user avatar
  • 32.8k
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
  • 21.9k
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
  • 16.7k
7 votes
Accepted

/bin/ls --color=always fails to produce colorized output in shell-mode

My Emacs (GNU Emacs 24.5.1) sets TERM=dumb in startup.el and my ls from GNU coreutils 8.24 checks TERM even with --color=always. dumb is not a terminal type recognized by dircolors (the utility used ...
Constantine's user avatar
  • 9,082
7 votes

Key binding with an argument

As you seem to have already noticed, a function need the interactive form before it can be bound to a key. interactive doesn't just tell Emacs the function is a command, it is also tells Emacs where ...
erikstokes's user avatar
  • 12.8k
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,521
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.4k
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
  • 21.9k
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

Is it possible to read user input from STDIN while tangling a source block?

Try this Note: Made following minor changes to your code block: Moved #!/bin/bash into code block header :shebang #!/bin/bash to automatically set executable file permissions when block is ...
Melioratus's user avatar
  • 4,564
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,047
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
  • 16.7k
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
  • 18.9k
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
  • 16.7k
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
  • 21.9k
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

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