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"
python-shell-interpreter-args "--simple-prompt -i")
From the documentation:
The new interface is not compatible with Emacs ‘inferior-shell’ feature. To ...
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 written in emacs lisp entirely. It has a syntax similar to bash, but is integrated with elisp well. e.g. you can eval elisp code right there. Eshell is especially ...
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 necessary, so don't worry about that. Just give it a name useful for debugging in the future!
If you give a "buffer-name", a buffer will be created but not shown ...
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-buffer-read-only (text)
(propertize text 'read-only t))
(add-hook 'comint-preoutput-filter-functions 'my-comint-preoutput-turn-buffer-read-only)
As for ansi-...
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 someone else who has exhausted all other options.
Another solution I found if you don't want to disable projectile constantly is to put this command in your init.el
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 is read-only now, is that it has been granted
its own major-mode, which inherits from
which is read-only. The advantages behind that are several.
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 prompted to enter a password and reads a string from the minibuffer (repeating the prompt); this string is not echoed and is not entered in any history list.
If 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 ...
.bashrc is meant for non-login shells, like when you are already logged in and start a new xterm, or in this case emacs' shell mode.
Usually the ....
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:
Emacs sends the new shell the contents of the file
‘~/.emacs_SHELLNAME’ as input, if it exists, where SHELLNAME is the name
of the file that the shell was ...
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 can read it by doing C-hfasync-shell-commandRET) customize display-buffer-alist as follows
(add-to-list 'display-buffer-alist (cons "\\*Async Shell Command\\*....
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 that particular problem.
For the encoding, you might try making utf-8 your preferred encoding:
Setting up the prompt
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, which is why you have to use cat instead.
Now, when you open an ssh connection from that shell, TERM is still dumb, but PAGER is reset to whatever the other ...
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/bin to the top of the /etc/paths file and it then worked fine.
Going into shell and calling echo $PATH in Emacs shows now: /Users/g/Library/Haskell/bin:/usr/...
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 also check this out: https://stackoverflow.com/questions/8606954/path-and-exec-path-set-but-emacs-does-not-find-executable
In the future, in case of similar ...
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-sentinel). Here's a modified example I'm taking from my projector package:
(set-process-sentinel (start-process "process-name" nil "command") #'output-message-...
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-buffer-alist '(("\\`\\*e?shell" display-buffer-pop-up-frame)))
It's a bit easier with my shackle package though:
(setq shackle-rules '(("\\`\\*e?shell" :regexp t :...
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 ()
(concat "SumatraPDF " (file-name-base (buffer-file-name)) ".pdf"))))
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:
0 ; <- Discard and don't wait
Concretely, this mean that you can ...
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 --insert ~/foo/file1.org -f htmlize-my-org --kill
As a more complete example, here's a way to run M-x delete-trailing-whitespace on all files in a dir:
$ for ...
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.
You can also do this on a per-code-block basis with the following small advice (working with your version GNU Emacs 126.96.36.199 (x86_64-w64-mingw32)). It defines ...
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 to turn it on. Shell mode correctly advertises that it doesn't support these control sequences by declaring TERM=dumb. It seems that zsh blindly assumes that the ...
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 comment from @lawlist
org-mode also has fairly sophisticated methods of its own for evaluating code, including both inline code and code blocks. First, you need ...
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 SHELL during startup. Something like
$ SHELL=/bin/bash emacs
(setq explicit-shell-file-name "/bin/bash")
This is for M-x shell, not M-x shell-...
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 have to use M-x ansi-term instead.
This isn't an Emacs issue per se, but a consequence of how different kinds of terminals process input, and ...
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 press Enter. Emacs is acting like a dumb terminal. It does support color codes, but not things like moving the cursor around, so you can't run curses-based ...
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, use shackle:
(setq shackle-rules '(("*Async Shell Command*" :ignore t)))
As Gilles mentioned in the comment above, emacs does not read the local env settings unless specifically asked to. The easiest way to keep variables in shell terminals inside and outside Emacs is to use a package, such as the Steve Purcell's package exec-path-from-shell.
Once installed, this package ensures each time you start a shell in emacs, it reads ...