Questions tagged [process]

A process is a running instance of a program. Use this tag for how Emacs interacts with programs that it runs (compilers, viewers, network backends, etc.)

23
votes
3answers
3k views

How can I run an async process in the background without popping up a buffer?

I have defined some functions to run async background process using async-shell-command in my .emacs, but everytime I run the commands a new window (not frame) is created and the process' buffer is ...
17
votes
2answers
2k views

Kill process buffer without confirmation?

I have C-x C-k bound to kill-this-buffer. But when I enter into a buffer which is running a process like Python or MySQL, if I do C-x C-k it asks Buffer "*Python*" has a running process; kill it (...
14
votes
1answer
113 views

Turning active M-! into M-& (a'ka emacs equiv to bash Ctrl-Z)

From time to time I happen to M-! some_command just to find that the command runs longer than I expected and keeps my emacs frozen for long seconds. So I glaze at my frozen emacs and kick myself for ...
12
votes
5answers
3k views

Does emacs have a process viewer (resource manager) or equivalent?

Occasionally emacs will hit 100% cpu usage. Obviously when this occurs there is an issue with a runaway process. Just wondering if there is a way to view all running processes in emacs? Kind of ...
10
votes
2answers
679 views

Possible to “detach” a child process?

I use browse-url/browse-url-firefox to open links in Firefox from within Emacs 24.5.1 under Linux (Fedora 23) which in essence executes the firefox executable with the URL by start-process. If there ...
9
votes
4answers
2k views

How to make shell-command run using shell profile and current directory hooks (ex. direnv)

I am trying to get shell-command and async-shell-command to integrate seamlessly with a couple of programs in my .bashrc file, specifically direnv in this example. I found that if I customized shell-...
9
votes
3answers
1k views

Send process output to *Messages* buffer, but bypass the echo area

Is it possible to send the output from a process-filter to the *Messages* buffer and suppress that message output from appearing in the echo area, such that I am able to simultaneously use interactive ...
8
votes
3answers
796 views

Persistent environment for M-x compile

When I run M-x compile it spawns a new subshell to execute my compile command. As soon as the compile command returns, the shell process is killed. I can see why this would be desirable in most cases, ...
7
votes
2answers
647 views

Applying a timeout on call-process/shell-command?

In some cases, when delegating work to an external process, it's useful to set a timeout on the command to prevent Emacs from hanging indefinitely. Unfortunately, the following does not work. (with-...
6
votes
1answer
253 views

Process input seems buggy in Emacs on OS X

I have a process that I'm trying to send input to on OS X. I'm using Emacs' builtin functions for doing this: process-send-string and process-send-region. However, it seems that there are issues when ...
6
votes
1answer
448 views

How to run a process without Emacs freezing?

When editing TeX files, programming, upgrading packages, etc. we often need to perform tasks - such as compiling code or downloading files from internet - that take a long time to achieve. We can do ...
5
votes
2answers
2k views

how to set environment variables={EDITOR, VISUAL} to prefer running emacs?

my usecase I'm currently running GNU Emacs version=24.3.1 graphically (i.e., under GNOME/X though started from a script invoked from a gnome-terminal running bash) on a Debian Linux. Just now I was ...
5
votes
1answer
549 views

Capturing stderr of subprocesses

I'm trying to capture stderr separately from stdout for a (synchronous) process run from emacs. I've found one way of doing it based on some code copied from emacs' shell-command function (I don't ...
5
votes
1answer
439 views

How do I pass all the output of process to a function?

I want to call a command asynchronously, and define a function that handles output from that command. I don't want to simply write output to a buffer. According to the Elisp info (36.9.2 Process ...
5
votes
2answers
222 views

Set environment variables for spawned subprocesses

I would like to set the environment variables for a spawned subprocess only. They are controlled by process-environment. The documentation says: binding that variable with let is also reasonable ...
5
votes
1answer
89 views

How to attach/connect two subprocesses?

The general case: Simply put, given that I start two processes (Aand B) with, e.g., async-start-process, what is best way of killing B if A terminates? My specific usecase: I'm debugging embedded ...
5
votes
1answer
132 views

Asynchronous version of shell-command-on-region?

I have a problem which is very similar to this one. I have some text that I'd like to listen to with macOS's say utility. Unfortunately, Emacs locks up when I use shell-command-on-region because it is ...
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 ...
4
votes
2answers
393 views

Pass an argument to a sentinel

From the Elisp manual at the Sentinels chapter: The sentinel receives two arguments: the process for which the event occurred, and a string describing the type of event. But I need it to receive ...
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 ...
4
votes
1answer
644 views

Efficiently call remote processes

I would like to be able to manage external processes from Emacs, in a way that is: (a) safe w.r.t. arguments escaping for the shell, (b) efficient both for local and remote processes (using TRAMP w/ ...
4
votes
2answers
233 views

How to pass messages between emacs and a Python program? (goal: trying to use emacs as a UI)

The situation. Say I have opened up a file in emacs, and I type in something like: x \and \top Then, a Python program reads that file, and: replaces all \and to ∧ replaces all \top to T it does ...
4
votes
1answer
213 views

How does one create back and forth communication to a process

I am writing an emacs mode that interfaces with a shell process. The shell process is expensive to start which means that I would like to do it once and then send commands to it from emacs as need be. ...
4
votes
1answer
56 views

How to partially block user input while Emacs subprocess is running

I have a custom function that updates the etags file before prompting the user to input a desired tag to be located. Although I am pretty good about setting the current buffer to read-only before ...
4
votes
1answer
818 views

Exiting emacs without confirmation to kill running processes

It turned out not to be the same problem as Kill process buffer without confirmation?: emacs asks for different kind of confirmations when exiting and when just killing a buffer. How to specify for ...
4
votes
2answers
238 views

start-process output processed too slowly

When start a command asynchronously, using (start-process ...), the output is added to the buffer 3-5 times more slowly than if I had used (async-shell-command ...). I don't have any output filters, I ...
4
votes
0answers
426 views

How do I reliably get output from a process?

I have created a comint mode for using mongo. The mode works fine in the buffer, and now I am trying to use it programmatically where I need to get the output from commands. Getting input to the ...
3
votes
2answers
251 views

Temporarily set the `default-directory` for `start-process`

Is it possible to set the default-directory temporarily (e.g., let-bound) when using start-process? If so, how please. (let ((default-directory "/Users/HOME/Desktop/tmp")) (start-process "touch-...
3
votes
1answer
369 views

Control of garbage collection?

I'm curious about this. The author seems to talk about "processes" and whole buffers that hang around past their welcome. I'm hearing in this article that Emacs elisp can start a process, (this ...
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 ...
3
votes
1answer
45 views

Send content of region or current line to a tmp file, then execute shell script with filename as argument

I am transitioning to Emacs with evil-mode after years of Vim. For work reasons I have to use a GUI statistics program (Stata) frequently. This program does not integrate well with external editors. ...
3
votes
1answer
68 views

Show top of *Async Shell Command* buffer

Is there a way to get to the top of a buffer that is not necessarily active? What I want to do is run a shell command on the word at point and then show the top of the output in the *Async Shell ...
3
votes
2answers
231 views

Can emacs be used for the same purpose of GNU Screen and Tmux?

GNU Screen and Tmux can make processes survive user's logging out, and resume when logging back again. Can Emacs be used for the same purpose, and how?
3
votes
0answers
454 views

Run interactive shell script in new buffer using elisp

I am looking for a way to display and interact with long running shell scripts in a separate buffer. While using eshell works, I'd like to automate most shell tasks using elisp. The best way I came ...
3
votes
0answers
153 views

Shell coding system

If, before M-x shell, I run C-x RET c (universal-coding-system-argument) I can change the coding system used by the shell. Therefore, given echo Straße > foo foo will be encoded in the related ...
3
votes
0answers
59 views

Return System Notification When Long-running Comint Process Completes?

I often have long-running processes in comint shells (e.g. SQL or fitting statistical models, both usually via an R/ESS shell). While they're running I navigate away and do something in another ...
3
votes
0answers
180 views

Shutting down computer from emacs killing gracefully emacs itself

I am using EXWM on Arch as my windows manager. Substantially my startx launches exec dbus-launch --exit-with-session emacs so I am running only emacs and living inside it. I would like to define a ...
2
votes
2answers
341 views

how to properly capture `diff` output in buffer (without first opening a file)?

summary If one captures diff output to a file name=*.diff and opens that file in a buffer, one gets nicely-formatted mode=Diff. How to get that directly, without first capturing to a file? details ...
2
votes
1answer
161 views

getting a process buffer for an eshell buffer

To get a process buffer an eshell buffer I thought I used to be able to run: (get-buffer-process (current-buffer)) In Emacs 25 this no longer works. Specifically "GNU Emacs 25.1.50.2 (x86_64-...
2
votes
1answer
370 views

Help with `call-process-region`: Searching for program: no such file or directory

I have the following snippet: (call-process-region (point-min) (point-max) "python /Users/myname/code/move_imports/moveimports.py") Incredibly, it tells me that it cannot find the file, even ...
2
votes
2answers
260 views

Kill inferior python in python.el mode

At the moment I am killing the Python interpreter with C-d each time I want to quit Python interpreter. What is the name of the function to kill the Python interpreter in Python mode (the one which ...
2
votes
1answer
528 views

Error in process filter

I am trying to play with the make-process function and get information from it. I am getting some errors in my process filter that I am having trouble understanding. When I run my ceedling-version ...
2
votes
1answer
170 views

Interpolate environment variables in string

I am trying to write a function that will interpolate the enviroment variables stored in process-environment in a string. For example, if I have the string "This is $Foo and ${Bar}_none and '$skip'" ...
2
votes
1answer
204 views

Size of process output sent to filter functions

I'm using comint to communicate with a REPL. From time to time the REPL sends large amounts of data. This causes a significant lag (about one second), because my filter function gets called on a ...
2
votes
1answer
49 views

Running process interactively (like compilation) but without parsing

Is there any command which let me observe output of async-called process (just like M-x compile), but does not try to parse output buffer? Background: for quite a lot of non-compilation tasks (hg ...
2
votes
1answer
253 views

Using ESS in console Emacs

When I start Emacs 24.4.1 for Windows with the -nw option, I am unable to start R via Meta+R. Emacs becomes unrensponsive and I have to kill the process. The problem seems connected with the call ...
2
votes
1answer
335 views

Differences between cmdproxy.exe and cmd.exe

What is the difference between: (call-process "cmdproxy" nil "foo" nil "/c" "dir") (call-process "cmd" nil "foo" nil "/c" "dir") ? I seem to get exactly the same results in Emacs 25.1 on ...
2
votes
2answers
186 views

Run a process synchronously and obtain stdout and stderr in different buffers?

I'm using emacs version 25.1.1. I would like to run a process synchronously and have its stdout and stderr end up in two different buffers. I know I can use make-process to separate stdout and stderr ...
2
votes
1answer
47 views

What's the idiomatic way of writing an Emacs front-end to a command which supports streaming input and output like Telnet?

I would like to write an Emacs front-end to a server which supports Telnet connections, and I was wondering if there is an idiomatic way of doing this. Specifically, the program will work like this: ...
2
votes
2answers
227 views

Make shell-command / async-shell-command respect carriage return?

Say I have a simple perl program: for my $i (0..10) { print "$i\r" } print "\n" Now if I run the program through shell-command, instead of getting a single line with 10, I will see the ...