Questions tagged [shell]

Questions relating to commands for passing single command lines to shell sub-processes, running a shell interactively with input and output to an Emacs buffer, and for running a shell in a terminal emulator window.

2
votes
1answer
135 views

How to call “echo ${GOPATH}” with call-process?

I try to execute echo ${GOPATH} with call-process as below: (call-process "echo" nil t nil "${GOPATH}") But it only output "${GOPATH}" not the value of that value. Would anyone please let me know ...
0
votes
1answer
71 views

shell-command and C-h

If I create a string from the output of a shell command, using shell-command-to-string, I sometimes see ^H characters in the string, when I guess those characters were supposed to result in ...
9
votes
3answers
6k views

Git Bash in emacs on Windows

I can run the Bash shell that comes with Git for Windows. I put this in my .emacs: (defun git-bash () (interactive) (let ((explicit-shell-file-name "D:/Program Files/git/bin/bash")) (call-...
0
votes
2answers
753 views

Can't see pdb output from shell-mode

I'm on Windows, for what it's worth. Just to make sure that it wasn't something that I did, I fired up emacs using -Q to avoid loading my init.el and attempted to run some python with a breakpoint ...
1
vote
0answers
130 views

How to enable control character (e.g. carriage return) handling in emacs shell

I run compilation processes that, in a terminal, list what was built all on the same line. In emacs shell they are all on separate lines, filling my shell buffer with unwanted output. I realize I ...
13
votes
1answer
465 views

How to prevent backspace from deleting my shell prompt?

It is a usual shell display: ME@mycomputer: ~$ echo When I do backspace several times It becomes: ME@mycompu How to prevent the system word from deleting
1
vote
1answer
85 views

Can magit-git-command use Emacs mini-buffer when prompted?

In my company we use a Git extension which has command-line interface that requires interaction (answering prompt). I would like to extend Magit to be able to deal with our extension. Unlike most of ...
1
vote
1answer
883 views

Windows 10 + Emacs shell--can't run processes from eshell; unwanted cmd windows open

I've been upgraded at work to a Windows 10 machine, from Windows 7. Apparently, this has caused problems. First, eshell doesn't seem to be able to launch windows processes anymore. I get "Spawning ...
2
votes
1answer
53 views

Specify and use inferior shell only once

I know you can customize settings or set environmental variables to get emacs to use other shells in shell-mode (1, 2). Is it possible to simply start a shell specifying which shell you want to use ...
2
votes
1answer
201 views

How to discard stderr when running a shell function?

If I run (setq some-variable (shell-command-to-string some-command)) ...and the execution of the command in some-command results in some output sent to stderr, this stderr output ends up in some-...
7
votes
2answers
2k views

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

First post. I'd like to confirmation whether I sucessfully troubleshooted an install of Emacs, and, if I didn't, direction on where and how to proceed. My setup: Emacs 24.5 Macbook Pro Core Duo (mid-...
7
votes
1answer
1k views

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

I tried using attic with a passphrase to backup my files from inside M-x shell. The shell exposed the passphrase as plain text in the buffer and made it available by typing M-r as well as by looking ...
0
votes
1answer
61 views

automatically run command when establishing ssh connection

I often work on remote hosts and I mostly need to be root, but I can't login as root. It would be convenient, if sudo -s is being executed automatically when I establish a connection with shell/eshell....
2
votes
1answer
167 views

How can i use a different shell in Emacs Shell?

I am currently using Zsh in my regular terminal app on my Mac OS X. However, it's heavily customized and colors don't appear properly inside Emacs. So I am thinking, I should probably use shell-mode ...
2
votes
0answers
148 views

Basic process management under Windows

I've got the following elisp: (setq proc (start-process "powershell" "*powershell*" "powershell.exe")) Unfortunately, I can't seem to get proc to do anything. For instance, in an normal shell, I ...
2
votes
1answer
1k views

How to run tmux in Aquamacs

I quite like tmux and Aquamacs. I've recently been interested in how to integrate the two together. As far as I know, one cannot run Aquamacs within a terminal even with the Aquamacs CLI tool, so the ...
2
votes
2answers
40 views

Take path preceding cursor and run a shell command on it

Consider a buffer holding the following contents: foo ... some text /foo/bar/hello.csv𝙸 ... bar where 𝙸 represents the location of cursor. I would like to have an interactive function that ...
9
votes
1answer
867 views

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

Is it possible to read user input from STDIN while tangling a source block with org-babel-tangle? I am aware of this: Org Mode Babel - Interactive code block evaluation. That doesn't help solve this ...
1
vote
2answers
3k views

weird characters in shell mode with zsh

I recently switched to zsh (with oh-my-zsh) as my primary shell, but running the shell from emacs results in some strange (for lack of a better word) "residural" characters; however changing to bash ...
1
vote
0answers
215 views

Send Python Buffer to ansi-term

I recently started using emacs to code in Python. I currently prefer to use python mode (defined in python.el) alongside ansi-term for the python interactive shell. I'm trying to change the behavior ...
5
votes
1answer
2k views

Org-babel invoking cmd.exe

Is there a simple configuration to get org-babel to invoke cmd.exe that doesn't involve modifying the org-babel source? Googling for ["org-babel" sh "cmd"] finds this email list discussion from 2010: ...
5
votes
2answers
416 views

Print process output line by line

Read process output line by line gives some partial ideas about how to deal with sub-process output in an intelligent manner, but no example and no working solution. I have a couple of examples, one ...
0
votes
1answer
36 views

Exports in compile command

I'm using the Anaconda distribution for Numpy, Ipython etc. and during the installation the following was added to my .bashrc: # added by Anaconda2 2.4.0 installer export PATH="/home/matthias/...
0
votes
1answer
69 views

Terminfo does not export the up arrow resource

When I use TRAMP and a remote shell, terminfo doesn't export the kcuu1 (up arrow) resource. How can I get Emacs to provide this?
0
votes
0answers
31 views

UI issues in Spacemacs shell [duplicate]

I'm using Spacemacs and multi-term on OS X 10.11. Preferred shell in zsh with oh-my-zsh installed. In the Spacemacs shell window, there are two weird UI issues: Command line never scrolls to the ...
2
votes
1answer
41 views

Manual pages priority in Emacs

Emacs provides a nice manual viewer which could be used for obtaining documentation for C syscalls (at point with Man-default-man-entry. However, it always starts searching manuals from section 0. How ...
1
vote
1answer
586 views

Remapping Esc to Tab in Spacemacs

I'm accustomed to remapping Esc to Tab in Vim. In Spacemacs this can be done with: (define-key evil-insert-state-map [tab] 'evil-normal-state) (define-key evil-visual-state-map [tab] 'evil-normal-...
1
vote
1answer
61 views

How to know output type

I've got this code: (defun insert-random-uuid () (interactive) (shell-command "uuidgen" t)) which produces a uuid that looks like this ffc715d2-1e10-4faf-b1f6-f85cae88a7d7. However, I believe it'...
7
votes
1answer
658 views

File and directory autocompletion in remote shell

In my local shell, completion-at-point after cd returns a list of directories. However, when I ssh into a remote, Emacs thinks I'm still in my local home directory. How can I configure Emacs to give ...
5
votes
1answer
553 views

Key binding with an argument

Say I have a shell command foo that I want to bind to a key. I could do for example: (global-set-key (kbd "C-c f") (lambda () (interactive) (shell-command "foo"))) I would like to be able to pass an ...
13
votes
2answers
4k views

Tramp mode is much slower than using terminal to ssh

I am using the Macports flavor of Emacs on OSX Yosemite, and have looked through every thread here on Tramp being slow without any solution. Tramp is usable, but there is about a 100ms delay between ...
3
votes
1answer
261 views

How can I connect to a REPL and send and read data?

Let us say I have a command to start a REPL. How do I most easily read output and send input? A minimal example with shell, sending ls and reading the output would be appreciated. The shell should ...
4
votes
1answer
774 views

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

I have run M-x ansi-color-for-comint-mode-on. Also, when I use /bin/ls --color=always (or /bin/ls --color=auto) in a regular terminal, I do see colors in the output. It's only within Emacs' shell-...
4
votes
2answers
311 views

Discard stderr in start-process

I'm using start-process to run mplayer and when playing videos I get a ton of output to stderr from "vdp_...". On the command line I usually just 2>/dev/null but start-process runs it directly without ...
7
votes
3answers
2k views

How to make terminal/shell spawned inside Emacs running on a Mac inherit the environment variables of the native terminal?

The terminal natively on Mac i.e. spawned through Spotlight or Launchpad, adopts the desired environment variables including the customization in ~/.bash_profile. But when I run Emacs (Emacs.app taken ...
0
votes
0answers
173 views

Incorrect Line Spacing in (term-mode, ansi-term, eshell, shell) Output

The output of certain commands in multiple major modes (term-mode, ansi-term, shell, eshell) is incorrectly spaced (see images). This occurs for numerous commands and does not occur in other emulators ...
7
votes
2answers
3k views

How do you configure emacs for julia?

What is a recomended way for making emacs as julia code editor? The things which I would like to have are: autocomplete julia shell in emacs with abbility to send the code from buffer debugging
1
vote
1answer
611 views

How to automatically run inferior process when loading major mode?

Like suggested in this question How to automatically run inferior process when loading major mode for the first time? I want to automatically run run-python when entering python major mode. However, (...
5
votes
2answers
966 views

Binding shell commands to hotkeys

Been scouring the internet for a couple days now trying to figure out the solution to my question with no luck. Hopefully someone here knows how to do this. I'm currently trying to set up my EMACS ...
2
votes
1answer
137 views

How to make the init file compatible with X and console at the same time?

I have customized the .emacs file a little to suit my taste, and it works fine when run in its own window. But when I try to run it in my terminal using the command emacs -nw, it throws up the ...
5
votes
1answer
228 views

Output to magit-process

When I run built-in magit commands, they output to the magit-process buffer. How can I do the same with a custom magit command that generates shell output?
3
votes
1answer
54 views

org hyperlink multiple actions

How do you execute multiple actions on a single org-link? Org-mode has links that can initiate actions, such as elisp: and shell:. It would be nice to initiate several such actions on following a ...
0
votes
2answers
575 views

In shell, eshell and comint-modes, the cursor moves back one chacacter when I switch buffers

When I'm in a shell and I change buffers, if I switch back to the shell buffer, the cursor has moved back a character and I can't start typing new shell commands until I hit -> first. This happens ...
5
votes
1answer
1k views

Why Emacs overrides my PATH when it runs bash?

Why do (shell-command-to-string "echo $PATH") and echo $PATH in eshell differ from echo $PATH from ansi-term and gnome terminal in Ubuntu? Some paths are missing from (shell-command-to-string "echo $...
0
votes
1answer
58 views

Prompt can be be deleted in run-scheme but not in run-python?

Prompt can be deleted when I do a run-scheme but not in run-python. Is there a way to make it standard i.e not to delete the prompts? I checked the comint-mode manual but couldn't find anything that ...
3
votes
1answer
533 views

Inferior Python shell slow/crash on long lines

so I've learned that emacs cannot handle multi-line strings very well, for example printing big data structures in inferior python shell (invoked with run-python) is dangerous and usually ends with ...
8
votes
3answers
709 views

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

Is it possible to run a shell command silently (in background)? When I use async-shell-command, emacs split the windows. I would like that an specific shell command to be totally in background (...
5
votes
2answers
3k views

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

By M-x eshell or M-x shell Emacs opens a shell or an eshell in the current window. How to open this shell or eshell in a new window?
4
votes
3answers
633 views

dirtrack mode with fish-shell

I recently started using the fish shell. I tried using it in term-mode in Emacs. One characteristic of this shell is that it shortens the current working directory before printing it as the prompt. ...
1
vote
1answer
254 views

Repeat last shell command shortcut

How can you repeat last shell command with a single shortcut (and no y/n prompts)? How to replace this sequence: C-u C-x s (or equivalent) to save all buffers M-! for (shell-command COMMAND &...