Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

3
votes
1answer
277 views

Wrong indent with emacs 24 and 25 in shell-script-mode?

I get the following indentation for my bash script for i in *; { echo $i } echo done The last indent is wrong and should be zero spaces. How can this be fixed?
0
votes
3answers
390 views

What does trailing dash mean in the shell command parameter list?

This question is related to the solution nanny provides to the xml beautifying problem on this answer: How to prettify/format an XML buffer? This works for me on Emacs 24.5 on Windows, but I want to ...
1
vote
1answer
278 views

Startup script for term-mode

In the documentation for shell-mode: 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 ...
0
votes
2answers
208 views

How can I start a server in the background from a source code block without freezing emacs?

I am creating several org-mode documents to track code example and would like to be able to view the results of tangling or executing these code blocks in a browser. In the example below, I've created ...
0
votes
0answers
26 views

dired function i wrote passes only current marked folder at point, can i send all marked folder?

i have this simple function i wrote (tbh i have zero coding skills.i gathered stuff from the web :)): (defun z/dired-media-filebot (file) (interactive (list (expand-file-name (dired-file-name-at-...
2
votes
1answer
313 views

How to send *shell* stdout directly to kill-ring?

Suppose that I have a *shell* buffer (i.e. a subordinate shell, started with M-x shell). Suppose also that at this shell's prompt, I can execute some command foo that sends some output to stdout. I ...
1
vote
0answers
253 views

ansi-term changes in line-mode not registered after char-mode

Here's the situation. I start M-x ansi-term, which launches it in term-char-mode. I type the following: echo "hello world" and press RET, which outputs on the next line the expected output hello ...
0
votes
1answer
87 views

How to run rspec from the emacs shell?

I'm following an entry-level tutorial on rspec here, and I've created a very simple test at spec\lib\zombie_spec.rb: require "spec_helper" describe "A Zombie" do #Your 'examples' (tests) go here. ...
3
votes
0answers
739 views

How to get Powerline colours working in Emacs Shell/Term mode?

I have recently started using Spacemacs instead of VIM, because of great VHDL mode. In vim (neovim) I used to use VIM as terminal emulator. In Emacs I have encountered a bit of strange colour ...
0
votes
1answer
353 views

Run 'TERM=ansi' when shell starts

I use shell inside emacs but by default it prints output in 1 color. However, when I use grep, I would like to see substring I'm searching highlighted. To see colors, I can manually type TERM=ansi ...
0
votes
1answer
109 views

Autocompletion of filename doesn't work in a shell in a buffer, when the current working directory is moved

In emacs, I press M-x shell to create a shell in a buffer. In the shell, I can use autocomplete file names with respect to the current working directory. If outside the shell e.g. in Nautilus, I ...
1
vote
1answer
430 views

auto kill a shell buffer when command finishes

i have this function you guys helped me write (defun z/dired-shell-other-window-beets () (interactive) (let ((command (concat "beet import " (format "%S" (dired-get-filename))))) (switch-...
-1
votes
2answers
326 views

How to run the last shell command from an python window?

I split the emacs into 2 windows, one window is used to edit the python code, say test.py, and another shell window to run shell command "python test.py", so each time after I edit the python, I need ...
0
votes
2answers
380 views

What is the proper way to pass variable strings to `shell-command-to-string`?

I have a shell script $ cat ~/foo.sh #!/bin/bash echo $1 $2 I'm trying to call this from emacs. My elisp function is (defun foo (word1 word2) "Print these two words." (interactive (list ...
2
votes
0answers
74 views

Evaluation of .dir-locals.el in shell?

I observed that directory local variables, defined in .dir-locals.el, are set for files, dired-buffers, new buffers, but not for shell or eshell buffers (well, that is also the case for buffers ...
0
votes
2answers
410 views

python emacs interpreter doesn't pause for input in loops

This looks like Weird shell output when using IPython 5, but it actually is not. I did set (setq python-shell-interpreter-args "--simple-prompt -i --pylab") in .emacs, but I get the following error:...
10
votes
2answers
5k views

.bash_profile or .bashrc for shell in emacs?

I wrote an alias for a huge command and stored it in .bash_profile and to my surprise, emacs didn't pick up the alias that I wrote in .bash_profile. After some searching in the internet, I created a ....
8
votes
2answers
2k views

How i can open shell in current buffer?

In function "shell" this line display shell buffer and almost always its open new shell in random frame. And I have to swap the buffers, it's annoying. ... (pop-to-buffer buffer) ... In docs says: ...
2
votes
3answers
619 views

How can Emacs set an environment/shell variable in a subordinate shell?

I often use subordinate shells within Emacs. (I instantiate these shells with M-x shell.) I put all these shells under auto-save-mode (through my shell-mode-hook; see below). Is there some way that ...
5
votes
3answers
133 views

How can I detect if an elisp script is piped?

I want to be able to tell whether stdout is a pipe in an elisp script. This would allow to distinguish between: $ emacs --script foo.el and $ emacs --script foo.el | cat Is this possible in Emacs ...
2
votes
1answer
5k views

How do i change the default shell for shell-command

I am having an issue with one of the plugins i am running because its trying to use fish and does not like the parameters. Is there a way i can change emacs to use bash for any plugins that use shell-...
1
vote
0answers
43 views

Since when the M-x shell open the shell on the other buffer?

I recently noticed the M-x shell command opens the shell in the other buffer. I used to do Ctrl-x 3 > Ctrl-x o > M-x shell. But recently I found that M-x shell opens the shell in the other buffer. ...
1
vote
1answer
74 views

How to create another instance of (e)shell in a DWIM fashion?

I have seen several proposals to run more than one instance of eshell (or shell) at a time. See here and here. However, they are inconvenient in my view, using peculiar key chords and forcing you to ...
4
votes
1answer
551 views

Directory tracking in remote shell buffer

I use the shell command via C-u M-x shell to open a shell on a remote server by giving as default directory the path to the remote server (e.g /user@myserver.com:/home/user) (which should have the ...
1
vote
2answers
2k views

No such file or directory error on executing script

I use GNU Emacs 24.3.1 on Ubuntu 14.04 and I have a bash script: ~/path/to the/script/test.sh. As you see the path has space character. Script has a simple content: ENTRY=`zenity --password --...
1
vote
1answer
161 views

interactive shell and C compilation inside emacs

I compiled a simple program in C (it does the sum of 2 numbers), by doing : M-x compile RET gcc -dummy.c -o dummy M-x shell RET ./dummy I get a prompt for the first number I can enter, then nothing ...
0
votes
3answers
126 views

run emacs function in the shell with parameter

Since there is parameter I need to use, so I will not use single quote as the question's answer First, I try emacsclient -q --eval (progn (find-file "ORG/${UN}.org") (org-latex-export-to-pdf)) ...
1
vote
3answers
540 views

How to execute shell command from editor window?

I have two windows open - one in editor mode with some SQL, bash, etc and the other in ansi-term. I want to mark my text and then execute it in the ansi-term window. Yes, I could make a shortcut ...
1
vote
0answers
243 views

byte-recompilation of files under a directory

As I move all my emacs.d between my machines using Git, and, obviously, I don’t version control byte-compiled files (*.elc), I sometimes get into a situation when my .el files are newer then the ...
4
votes
2answers
731 views

Execute current line in shell

I often find myself copying commands line by line from an emacs buffer to my terminal. How do i bind a shortcut which sends the current line/selection in emacs to my gnome-terminal?
1
vote
1answer
60 views

Is there a package to send a piece of text to shell and get the result back?

I want to know if there is a package to send a piece of text to shell commands like sed, awk or other text processing utilities and then get the result back to emacs? Thanks.
2
votes
1answer
112 views

Can't parse the output of manpages in pcmpl-args.el in Emacs 25.1.1

This is a followup to this question, as I originally was uncertain as to how to make this question into a suitable format for this site. So, I'm a user of pcmpl-args.el, which is an Emacs package that ...
2
votes
2answers
873 views

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

I have a few questions about the relationship between TERM, terminfo and termcap and Emacs. I do not know exactly what TERM, terminfo and termcap are. I am on OS X. I do not know what values (and ...
2
votes
3answers
591 views

Open shell on Mac OS X

I'm very new to emacs and am currently using it to edit files on mac os x. How do I open instances of the shell from inside emacs so that I can execute the code I'm working on?
0
votes
1answer
63 views

In a new shell, move to directory of other current buffer being edited?

I am using emacs to edit Latex. My work flow is to open the latex file, open a new buffer in a separate window via C-x 2. Then moving the context into the new windowbuffer via C-x o, I type M x shell ...
2
votes
1answer
280 views

How to console inside of emacs?

I have spacemacs and a problem I have compared to using terminal+vim is that I could do everything in the terminal : create files, directories, whatever and whenever I need to edit a file I just type ...
1
vote
1answer
138 views

Limit virtual memory for all emacs sub-processes

I know I can use ulimit -v ###KiloBytes### to limit the virtual memory of a shell and all subprocesses started by it, but it's annoying to have to open emacs from a shell everytime just for such a ...
1
vote
1answer
80 views

How to get shell mode to properly handle my PS1, which involves user-defined function calls?

My bash_profile includes a couple functions to build the prompt. This is a super-simplified version, which I'm using to try to debug the problem with: custom_git_function () { echo "git" } ...
0
votes
1answer
66 views

Is there a key-binding to move the cursor to the last character in the buffer

Is there a key binding that moves the cursor to the last character in a buffer? I'm asking because I often find myself at a point other than the last character, where I want to be, in the interactive-...
37
votes
2answers
7k views

Weird shell output when using IPython 5

I just upgraded to the latest version of IPython and now something is wrong when using it in emacs. When using it in a regular terminal it works fine (colors, tab-completion, etc.), however either ...
1
vote
1answer
228 views

scilab-mode : how to interpret a .sci file?

I work on ubuntu 14.04 with scilab installed. I put Alexander Vigodner's scilab.el in my init.el load path and I created a scilab-startup.el file loaded by the init file. My question is, how to ...
3
votes
0answers
439 views

FZF broken displaying in emacs terminal

I'm struggling to run fzf in emacs but cannot figure out whats my problem. When I run fzf - and start typing - text gets mess up, similar to this: I tried run fzf in term, eshell, ansi-term, multi-...
1
vote
1answer
143 views

help with dired function i wrote..how to insert current file at point into buffer?

i have zero coding skills but somehow (mainly goggle) managed to write this script (defun z/dired-shell-other-window-beets () "Open a shell with dired path in a new window and issue beet import on ...
6
votes
2answers
370 views

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

My Emacs is running in foreground in terminal emulator, where I am also running some background processes. My Emacs is garbled by the stdout and stderr output of the background process. Besides ...
2
votes
0answers
243 views

Custom Bash prompt doesn't display correctly in shell mode [closed]

In my .bashrc file I've set the PS1 variable to this to customize my prompt: export PS1='[\D{%Y-%d-%m} \t \u@\h \W]\n$ ' The format strings are explained in the Bash manual. This one gives me a ...
0
votes
1answer
162 views

Emacs shell send ^] (hat-right-sqare-bracket)

Trying to run telnet in Emacs shell I cannot figure out how to send ^] to terminate it.
3
votes
2answers
111 views

How to launch terminal.app from elisp

I've been using shell-pop recently, and it's nice how I can pop to default-directory in term immediately. For the times I'd rather use a dedicated terminal, is it possible to create an equivalent for ...
2
votes
1answer
470 views

Run a shell command as lisp

When I write, for example, (format "The value is %d." fill-column) and type C-c p after it, it outputs a result. How could I do the same with a shell command? That is, to run a shell command within a ...
0
votes
2answers
67 views

`M-! enter shell command enter` in org mode does not insert output in current buffer

When I run M-! enter shell command enter in org mode, I expect the output to be inserted into the buffer I have active. Instead, emacs opens a second buffer (splitting the window in two) and inserts ...
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 ...