As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [comint]

is the command interpreter mode for interacting with external processes. Using the base comint-mode, Emacs provides derived modes for specific process-in-a-buffer. Common ones are shell, lisp, scheme, cmutex (for TeX and LaTeX). Support for programming languages with REPL interfaces, such as Haskell, are also derived from comint-mode. Such buffers share the same key bindings, shortcuts, and history manipulation facilities.

Filter by
Sorted by
Tagged with
0 votes
1 answer
10 views

OSC 8 links not working in the Comint mode

According to the NEWS for Emacs 28.1 (Ctrl-f "OSC 8, for hyperlinks"), the comint-mode supports the OSC 8 styled links. But when I compile (interpret) a file "test.py" with ...
scribe's user avatar
  • 896
0 votes
1 answer
46 views

At the time of prompting for a password (from a subordinate shell), sometimes Emacs hides the password, sometimes not. Why the inconsistency?

I use shells running under Emacs (via M-x shell) under a variety of settings1. In all these settings, I use the same .emacs file. Nevertheless I observe an inconsistency, as described below. In some ...
kjo's user avatar
  • 3,105
0 votes
0 answers
18 views

How to cleanly copy command output in shell-mode?

I can use following commands to navigate prompts in M-x shell C-c C-p runs the command comint-previous-prompt C-c C-n runs the command comint-next-prompt But if I have multi-line prompt, e.g. user@...
phoxd's user avatar
  • 231
0 votes
0 answers
24 views

How to kill process similar to kill buffer

Whenever I run into infinite loops in a script and it produces a lot of output, C-c C-c (comint-interrupt-subjob) does not reach the process and cannot be killed; being over SSH hangs communication as ...
phoxd's user avatar
  • 231
0 votes
0 answers
18 views

recenter-top-bottom failing to observe bottom target in comint

In emacs-version 28.2, I'm observing my comint managed processes getting into a state when C-l is just doing nothing when it would have previously moved the cursor to the bottom of the window and ...
Michael Norrish's user avatar
0 votes
1 answer
23 views

Enable UTF8 in Python comint processes

I'm trying to fix a Python3 script that breaks while processing a string containing Japanese characters, "出典データ". While debugging, I get the following error when printing the string from an ...
Lorem Ipsum's user avatar
  • 4,267
2 votes
1 answer
53 views

How to execute a command in elisp (startup script) whenever a new term is created?

I tried adding hook to term-mode-hook to call comint-send-string: (add-hook 'term-mode-hook (lambda () (comint-send-string (get-buffer-process (current-buffer)) "alias t='echo test'&...
AhLeung's user avatar
  • 1,063
0 votes
0 answers
48 views

How to change the header and footer of the comint/compilation-mode?

I have a program ~/path/to/program.py. In program.py I run compile (I usually do this with the second arg COMINT=t). I get, -*- mode: compilation; default-directory: "~/path/to/" -*- Comint ...
scribe's user avatar
  • 896
3 votes
1 answer
195 views

Comint input and output text positioning

I'm using Emacs as a TCP client for a remote Python debugger I wrote. I can connect and interact with the server, but I'm not able to get the comint buffer used as the client to align input and output ...
Lorem Ipsum's user avatar
  • 4,267
1 vote
1 answer
182 views

Why jshell doesn't work in comint-mode?

When I try to run jshell using (comint-run "/usr/bin/jshell"), it presents me with the prompt but when I give it some input, the buffer gets frozen and I get no output. Conversely when I try ...
zimio's user avatar
  • 13
0 votes
1 answer
50 views

How to access Erlang shell JCL Mode inside an Emacs inferior-erlang shell?

Inside an Erlang shell one can access the Erlang shell User Switch Command menu (also called Erlang shell JCL Mode) by typing Ctrl-G. When running the Erlang shell inside Emacs (as an inferior-erlang) ...
PRouleau's user avatar
  • 724
0 votes
1 answer
281 views

Clear console output on *R* buffers when using ESS

I have this kbd in my init.el (global-set-key (kbd "C-l") 'comint-clear-buffer) When I use Emacs-ess mode fro programming in R, I use this kbd to clear the R output buffer, this is usually ...
PinkCollins's user avatar
0 votes
0 answers
73 views

Send string to a fully functional REPL in Emacs on Windows?

Summary. Is there a way to get fully functional REPLs on Windows running in Emacs. I want to avoid the maintenance burden associated with comint. Long version. In many cases I dislike how the built-...
kdb's user avatar
  • 1,541
0 votes
1 answer
102 views

How do I specify the window height of the Python interpreter?

Suppose I am editing a file in python-mode. If I start the Python interpreter using M-x run-python (or C-c C-p), the Python interpreter opens in a window (*Python*) in the bottom half of the frame. ...
Flux's user avatar
  • 583
0 votes
0 answers
102 views

Finitizing infinite comint output

Context I'm a teacher and I often want to show “bad” programs; in this case infinite outputting programs. But while I want to show the bad I dont want my laptop crashing in class (nowadays on zoom) ...
Rusi's user avatar
  • 329
1 vote
1 answer
279 views

Create shortcut for interactive compile command

I know that we can start compile interactively using C-u M-x compile. Is there a way to start this whenever I run M-x compile? If that cannot be done, how do I create a shortcut to C-u M-x compile? ...
mle0312's user avatar
  • 295
2 votes
0 answers
17 views

SQL comint history saves spaces are \40

When accessing a database through an inferior process (M-x sql-msql) the history for the current session history (M-p/n) works Ok. But when restoring history entries from a previous session the string ...
PuercoPop's user avatar
  • 396
0 votes
0 answers
59 views

M-x shell truncates commands to 4096 characters

Using M-x shell, I have encountered a problem with commandlines being truncated to 4095 characters. Steps to reproduce: perl -e 'print "0" x 5000 . "\n"' Select output for next command echo <5000 ...
Realraptor's user avatar
  • 1,243
1 vote
0 answers
79 views

Abort output in currently executing command in shell mode

Sometimes in shell I end up executing a command which results in too much output. For example, consider a wrong grep on a huge text file which results in 10,000 matches. The grep command completes ...
Miserable Variable's user avatar
0 votes
1 answer
131 views

Is there a way to connect to a REPL without comint?

The performance of comint is not good when handling outputs of some REPL. Is there a way to connect to some REPL outside Emacs and let result display there, like in a terminal/browser/something else? ...
Saddle Point's user avatar
5 votes
3 answers
138 views

Sending `C-c C-c` to the process window without swithcing to it

In ESS mode, I sometimes send some code to the process buffer and want to cancel it using C-c C-c. Can I do this without actually switching to the process window from the script window?
Arktik's user avatar
  • 912
4 votes
3 answers
540 views

How to determine which program is running inside an emacs shell buffer?

I have an emacs shell buffer which may or may not be running a certain interactive program such as ftp or python. I wish to write a lisp function which will interact with this program, but I would ...
Ruy's user avatar
  • 767
4 votes
2 answers
802 views

Cargo-process does not accept user input

Using the Emacs mode for Cargo, I'm able to build and run Rust code inside Emacs. However, the terminal that opens when executing cargo-process-run does not accept user input. For example, when ...
Safron's user avatar
  • 171
1 vote
0 answers
137 views

Associate a buffer with a process

I am using Python with elpy. I am trying to use a Python shell opened on the remote computer using a shell buffer. I can cheat elpy by renaming the shell buffer with Python running in it to *Python*. ...
Arktik's user avatar
  • 912
0 votes
1 answer
68 views

comint: show the original input when match-cycling through history

Currently, I have bindings for comint-previous-matching-input-from-input and comint-next-matching-input-from-input. My problem is this. Suppose I am on a prompt with some text (say, "x = ") and issue ...
user3496846's user avatar
0 votes
1 answer
294 views

Deleting temporary files left over from inferior-python-mode

I am using emacs on a server so files in /tmp are not automatically cleared down. Every time inferior-python-mode runs, it leaves files in /tmp (e.g. /tmp/py15458epk). I'm looking for a more elegant ...
Kind Stranger's user avatar
4 votes
1 answer
96 views

How to copy output from ess to the kill ring?

Q: how can I automatically copy output from ess to the kill ring? Background I use ess to conduct statistical analysis. On occasion, I need to copy its raw output into another buffer (usually ...
Dan's user avatar
  • 32.3k
0 votes
1 answer
691 views

Shell mode - clear screen but keep scrollback

When using a normal terminal application (like Konsole, for example), I regularly use Control-L or the clear command to clear the terminal's contents, leaving the cursor on the top. When I do this, I ...
Federico's user avatar
  • 177
0 votes
1 answer
72 views

Why isn't the flushed output from my Emacs shell buffer getting into the kill ring?

Following the advice given on p. 121 of Learning GNU Emacs, 2nd Ed., I'm entering the command sequence: C-c C-o, immediately after executing a command in my Emacs shell buffer. And I'm seeing the ...
dbanas's user avatar
  • 101
4 votes
2 answers
261 views

How to get rid of flickers in python shell?

In a fresh emacs session, each time I hit enter in inferior-python-mode, the window flickers. This does not happen in shell-mode. One can see the cursor goes to the middle of current window when ...
Saddle Point's user avatar
1 vote
1 answer
135 views

How can I have comint buffer input histories betweens different comint sessions?

I'm missing the input histories like what's in IPython. But it seems that the defaults do not keep input histories after the comint buffer is killed. Also I'd like to keep them between emacs sessions.
Saddle Point's user avatar
1 vote
1 answer
362 views

Using xonsh as python shell

I'm trying to use xonsh as my python interpreter in Emacs (the one invoked by run-python). I tried to do this by setting python-shell-interpreter to "xonsh". This works, but there are two issues: The ...
Kahr Kunne's user avatar
0 votes
1 answer
85 views

Shell buffer echoes partial long lines

I've written a command that ssh-es to a remote host and runs an interactive command there. Something like: (defun remote-command () (interactive) (pop-to-buffer (get-buffer-create "*remote-...
Sean's user avatar
  • 919
1 vote
0 answers
104 views

comint-input-ring-size ignored in shell-mode

I am trying to change comint-input-ring-size in shell mode in Emacs. The comint-input-file-name is correctly set to ~/.bash_history file which is a big file (around 5000 commands). However, if I set ...
Sundar Venkataraman's user avatar
5 votes
1 answer
779 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 ...
antonio's user avatar
  • 1,752
0 votes
0 answers
129 views

shell-mode C-c C-c kill keybinding

With some regularity, I am using bash with M-x shell, and out of muscle memory I hit C-c C-c, with dramatic results: the comint prompt streams a long error message with a large number of escaped ...
Henry's user avatar
  • 193
0 votes
1 answer
271 views

Error when trying to advice python-shell-send-string

I'm trying to write advice such that each time I eval a python snippet, it automatically output the exception time in the emacs python shell (defun python-send-with-time-record (orig-func string &...
Saddle Point's user avatar
4 votes
1 answer
373 views

(How) can I emulate {eshell,comint}-output-filter-functions in term?

What I want to do from inside a term shell is have a function called when there is new output or a certain regexp (e.g. a prompt) appears in in a term's output. The callback function should then be ...
rocky's user avatar
  • 888
1 vote
2 answers
347 views

Where does the Python shell from `run-python` store its input history?

As in the question title, I want to know where the inferior Python shell stores its command history (the history you cycle through through with the up arrow). I've been searching high and low. I'm ...
Zorgoth's user avatar
  • 810
0 votes
0 answers
55 views

comint-mode problem with C++ style comments (and quotes)?

This is a rephrase of my SO question https://stackoverflow.com/questions/44147993, which didn't receive much attention in SO. Basically, I suspect that I enountered a problem with nodejs-repl.el (...
user avatar
3 votes
1 answer
1k views

How to clear shell in ielm?

I am trying the clear the inferior emacs lisp mode(ielm) buffer. Solutions applicable to shell are not applicable here - the erase-buffer command says "Test is read only"
Draif Kroneg's user avatar
1 vote
2 answers
393 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 ...
Saddle Point's user avatar
6 votes
0 answers
131 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 ...
computer_guy's user avatar
2 votes
0 answers
198 views

Output of ipython shell much slower than python shell

Even turning off font-lock-mode and set (setq python-shell-font-lock-enable nil), the output of an ipython shell (setq python-shell-interpreter "ipython") seems much slow than the python shell (...
Saddle Point's user avatar
6 votes
0 answers
850 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 ...
John Kitchin's user avatar
  • 11.5k
2 votes
1 answer
826 views

I need example of correct using of comint and getting last comand output

I had a problem with execution of (comint-simple-send process command). My previous example would not show the last output because I didn't use the hook and the result was being dispalyed before the ...
ruby_object's user avatar
3 votes
4 answers
1k 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 ...
kjo's user avatar
  • 3,105
0 votes
0 answers
69 views

comint-exec with very large argument list on windows

I wish to start a command that has a very large argument list (10s or 100s of thousand characters) with comint-exec but when I do this on Windows it fails to start. The only error is apply: Spawning ...
fommil's user avatar
  • 1,730
1 vote
0 answers
216 views

do not echo commands to comint-mode buffer

I have a comint managing a subprocess and I want to send a huge text payload to it that the user doesn't need to see (it's a multi-page configuration string that must be provided this way). Text sent ...
fommil's user avatar
  • 1,730
2 votes
1 answer
208 views

How do I filter for IPython prompt characters on Mac OS? [duplicate]

I've debugged to this point: OS X El Capitan (10.11.5) Emacs 24.5.1 with Cocoa (installed from homebrew) python.el 0.24.5 Python 3.5.1 IPython 5.0.0 I've configured IPython to use NoColor mode in ...
purple_arrows's user avatar