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
2answers
253 views

content was split in the functions of comint-preoutput-filter-functions

Consider the following snippet (defun python-shell-filter-long-lines (string) (print string) string) (push 'python-shell-filter-long-lines comint-preoutput-filter-functions) and M-x run-python ...
4
votes
1answer
1k views

how to name buffers (*shell*)

I'm interested in naming Emacs buffers. In particular I'd like to give names to shell buffers that I've started. That way I can easily tell them apart when switching buffers.
0
votes
1answer
649 views

Ansi-Term not reading .profile

my question is very similar to this one. I use my .profile file to set environment variables, such as EDITOR. However, when I run ansi-term and type printenv I can see that that variable is not ...
2
votes
1answer
2k views

Error running Emacs from a Terminal window: “Symbol's function definition is void: package-initialize”

After starting Emacs from a Terminal window, the following message is displayed: An error has occurred while loading '/Users/EvanAad/.emacs': Symbol's function definition is void: package-initialize ...
5
votes
2answers
520 views

How to determine the initial current directory when emacs is run from command line?

How can I determine (from within Emacs) the current directory as it was when the Shell launched emacs from the command line?
3
votes
1answer
647 views

MS Windows Tramp Remote Shell

I'm trying to open a remote shell after connecting to a machine using Tramp with the plink method on MS Windows. However every time I call shell it prompts me for 'Remote shell path' and suggests a ...
2
votes
1answer
263 views

how to print $HISTFILE?

I'm trying to print the path of $HISTFILE in emacs, but it doesn't work with (getenv "HISTFILE") or (shell-command-to-string "echo $HISTFILE"). It is working with $PATH and every other variable I've ...
1
vote
1answer
274 views

Remote shell (tramp) and login script

When I open a file via tramp on a remote machine and then start a shell with M-x shell I get an infinite loop because of my .cshrc file. I want to use a newer gcc version in CentOS so I have: set X="...
1
vote
0answers
393 views

Including pip-installed libraries on emacs python shell

I recently found out you can run python from emacs (Python Mode -> py-shell) and I've been running my scripts through the py-shell due to only needing to C-c C-c, but I've been running into a problem: ...
6
votes
4answers
2k views

How to start python shell in appropriate working directory?

If I am editing a python file, and start a python shell using elpy-shell-switch-to-shell the process appears to set the working directory as the containing directory of the file. However, the file ...
1
vote
0answers
112 views

`pushd` command for shell buffer

In an interactive shell, I have a script I run that changes my directory (via pushd) and then launches an interactive program. At this point I issue M-x cd and provide Emacs with the new directory ...
0
votes
1answer
93 views

How to run `gprolog` under an Emacs sub-process shell?

I'd like to run the gprolog interactive interpreter in an Emacs sub-process shell (started with M-x shell). The interactive interpret starts without a problem, but it does not respond to some ...
3
votes
1answer
279 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
449 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
289 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
216 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
334 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
272 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
96 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
764 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
394 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
115 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
447 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
335 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
411 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
414 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
3k 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
657 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
77 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
583 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
3k 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
167 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
133 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
559 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
252 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
783 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
62 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
113 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
933 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
621 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
292 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 ...
0
votes
1answer
145 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
84 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" } ...