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.

Filter by
Sorted by
Tagged with
1
vote
1answer
63 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
782 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
652 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 ...
14
votes
2answers
5k 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
413 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
873 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-...
5
votes
2answers
367 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
3k 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
193 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 ...
9
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
701 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
1k 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
146 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
242 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
59 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
619 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
2k 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
60 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
587 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
848 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
681 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
291 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 &...
5
votes
1answer
231 views

M-x shell doesn't know about installed apps

I have to launch almost any application by specifying the whole path which is annoying. For example, git works fine, but lua does not. Both are installed in the same place: $ which git /usr/local/...
4
votes
1answer
642 views

How to sort file list in helm-find-files by date

How to sort file list in helm-find-files asks how to sort the file list so that directories float to the top. My question is different: Is it possible to sort the files returned by helm-find-files ...
1
vote
0answers
50 views

Can I have a separate shell switch when compiling?

Whenever I use M-x compile, I like to have the shell that's running to be configured with bash -ic so that I can easily type the compilation command (I switch between languages often, so the building ...
3
votes
1answer
1k views

Why does the Emacs ansi-term and Emacs shell PS1 prompt not match my system PS1?

I'm running Mac OS 10.10.3; Emacs is complied and installed via Homebrew; I run it as a GUI application and it reports This is GNU Emacs 24.4.1 (x86_64-apple-darwin14.1.0, NS apple-appkit-1344.72) ...
2
votes
1answer
955 views

Setting up company for shell autocompletion

When I use company-mode in shell-mode, by default company seems to pull candidates from tokens in open buffers. How can I set up the backend to get candidates from shell commands, directory names, and ...
18
votes
6answers
12k views

Emacs and command line $PATH disagreements on OSX

Having some issues with PATH settings on Emacs that are affecting my Haskell environment: I'm using ZSH, and when I go to the command line and call echo $PATH, it returns: /Users/g/Library/Haskell/...
2
votes
2answers
523 views

Sentence in text is read only even though the buffer is not, how to fix this?

I am running emacs 24 with the Inferior Python mode for the interpreter. See below for all the minor modes in effect. Basically the problem is that particular lines (say at the prompt) remain read-...
1
vote
1answer
129 views

Translating editing actions to keypresses for ansi-term?

For the speech recognition mode for emacs I'm working on I'd like to have support for working with the shell. I have shell-mode working fine but I'd really like to get ansi-term working since some ...
1
vote
2answers
234 views

What's a good workflow for having a few dedicated shell sessions?

At present I use a screen session in the terminal (outside of emacs), with window 0 devoted to running my web server, window 1 to running tests, and window 2 for general hacking. I like this flow and ...
1
vote
0answers
120 views

How to make dired-do-async-shell-command wait for all sub processes to finish

I'm trying to run the bash script, ~/bin/xlda, ... #!/bin/sh # ~/bin/xlda old_filename="$1" new_filename=`echo $old_filename | sed 's/\(.*\.\)flac/\1m4a/'` ~/bin/xld -f alac -o "$new_filename" "$...
8
votes
1answer
1k views

How do I start a shell automatically after starting emacs

One of my main reasons for using Emacs is to get a powerful environment after sshing into a remote machine. The first thing I do after starting Emacs is to run M-x shell to get a command line. As it ...
10
votes
1answer
140 views

How do I prevent one subprocess from starving others?

To be clear, I'm not talking about anything that should require emacs to be multithreaded (though that would probably also solve this). To reproduce: emacs -Q # I'm running 24.4.1 Make a second frame ...
4
votes
2answers
513 views

What is the syntax for a subshell in eshell?

How to write the analogue of a bash-command like: (cd ../repo && git fast-export master) | darcs convert import repo_master in eshell? Here a subshell is employed to restrict the effect of ...
1
vote
1answer
213 views

shell-mode prompt?

I have set in my ~/.emacs.d/init_bash.sh: export PS1='\h:\w$ ' without it, my prompt is bash-3.2$ but now it is bash-3.2$ computername:~/path/to/directory$ How do I make it just be ...
4
votes
1answer
2k views

transparently find file over ssh in *shell* directory

I ssh'd into a remote server from shell and tried to open a file on a directory path that also exists on my local system. The list of files I was able to open using helm-find-files was the list on my ...
0
votes
1answer
263 views

How to define custom compile commands in auctex?

I'm using TeXLive 2014 on MacOS X 10.6 and I'm currently working with Aquamacs 2.5. I'm currently using two different shell scripts for compiling my LaTeX document (thesis), which are located in ~/...
6
votes
1answer
457 views

How can I keep dired in sync with a shell buffer?

I have some work that requires I move around between various sub-directories. Thus, the easiest way I have found to do that is to use dired. I also have to view some files (plain text or code), so ...
8
votes
4answers
864 views

Async shell process buffer always clobbers window arrangement

I frequently launch external programs from emacs using M-!, such as Firefox or Evince, etc. Whenever I do, a buffer pops up full of results for the process, which clobbers whatever else I've got going ...
5
votes
1answer
1k views

Unwanted escape sequences in shell mode

Post title: Unwanted escape sequences in shell mode that are NOT due to colorizing-attempts (see update below) Any idea what can cause (unwanted) escape sequences to continue showing up in the ...
1
vote
1answer
808 views

IPython shell theme

I'm using solarized theme in emacs-24.3. While I'm quite happy with it generally, the IPython shell is blindingly ugly. It is quite clear that the font colors within it are not using solarized values. ...
1
vote
1answer
178 views

Green lines are invisible in diff output for some files in *shell*

I use Emacs a lot including for most terminal sessions. One of activities includes typing git commands inside a shell buffer. I found a very interesting color puzzle. After downloading forked ...
3
votes
3answers
2k views

How to run interactive bash command from Emacs?

I have a command my_cmd that is aliased to another command in my ~/.bashrc. From Perl and Python, I can run this command as bash -ic "my_cmd" (this also works from the terminal window, but here it is ...
8
votes
2answers
1k views

How to force an org-babel session to reset or initialize?

If I run the following babel shell blocks #+BEGIN_SRC sh :session one :results output ssh staging #+END_SRC #+BEGIN_SRC sh :session one :results output hostname #+END_SRC Org creates a shell ...
7
votes
2answers
2k views

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

Is there any easy way to flush all output in the shell buffer? Since recently (I believe Emacs 24.4 already has this) *shell* buffers aren't editable, they behave similar to how typical terminal would ...
1
vote
1answer
161 views

Where is this cruft coming from in shell-mode and term-mode?

tcsh$ cd ~ ^[]0;sallred@calamity:/home/sallred^G tcsh$ cd bin ^[]0;sallred@calamity:/home/sallred/bin^G tcsh$ What is this cruft that is appearing before my prompt (or perhaps more appropriately, ...
9
votes
3answers
1k views

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

This is admittedly a superficial question. Although ansi-term starts out behaving correctly when I first open it, it seems to degrade into an 'editable' mode after a few commands, e.g., when I do C-a ...
6
votes
1answer
284 views

Difference between shell and term [duplicate]

I would like to understand what is the difference between M-x shell and M-x term? Also under which circumstances should be used the first and under which the second?