Skip to main content

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
1 vote
2 answers
50 views

Combining comint and markdown?

I've recently started using the comint based github chat client https://github.com/chep/copilot-chat.el together with https://github.com/xenodium/chatgpt-shell . It allows a REPL like interaction with ...
Dov Grobgeld's user avatar
0 votes
0 answers
25 views

How to tell comint on start which directory to use?

I am using lua-mode for interacting with the Lua repl, which is built on top of comint. Unfortunately, it does not seem that running a lua repl from a buffer correctly sets the directory of the ...
Julian's user avatar
  • 121
0 votes
0 answers
26 views

Use comint with non-interactive CLI tools

Is it possible to run a CLI tool (via sql-* comint-based mode) that checks isatty() and immediately exits because the stdin is empty? Maybe it is possible to force comint (or SQL mode) to run the tool ...
Max Arnold's user avatar
0 votes
1 answer
14 views

Unable to bind `C-k` in comint / inferior-python mode

I want to use C-k to go to previous input when using the Python REPL. I'm using doom emacs. I have this in bindings/+python.el: (map! :after python :map inferior-python-mode-map "C-j" :i #...
tsorn's user avatar
  • 151
0 votes
1 answer
36 views

How to send newline into comint mode?

I have Scheme REPL written in NodeJS run inside emacs with run-scheme and when I execute Scheme code with C-x C-e I end up with a buffer that looks like this: lips> lips> ... ... ... ... ... ... ...
jcubic's user avatar
  • 783
0 votes
1 answer
26 views

In Python buffer erase large output

Python buffers support comint-delete-output, but if I forget to do it before entering another command, I have a big hunk of text I can't easily erase. In shell mode, I can set the mark and run comint-...
Eric Auld's user avatar
  • 103
0 votes
1 answer
54 views

pyenv vs. homebrew ipython versions and comint

In order to solve various probelms with eglot and completions, I made sure that both python and pip are set respectively within emacs to ~/.pyenv/shims/ipython and ~/.pyenv/shims/pip, as they are in ...
guibor's user avatar
  • 123
0 votes
1 answer
222 views

`completion-at-point-functions` and filesystem path completion

I want to use filesystem path completion in programming modes and their derivatives. To do so, I attempted to add the following code to my init.el: (add-hook 'prog-mode-hook (lambda () ...
Alex's user avatar
  • 155
1 vote
0 answers
46 views

How to get `comint` modes work with long lines?

When I paste a long (not that long) line in inferior-python-mode, the buffer sucks. For example, "[{\"inputs\":[{\"internalType\":\"contract I_StarkwareContract\",\&...
Saddle Point's user avatar
0 votes
0 answers
46 views

How to turn on `read-only-mode` when running a command in `comint` buffers and turn off it when the command is finished?

I'd like to prevent all user inputs when a command is running in comint-like buffers (created by shell, run-python etc.) by enabling read-only-mode when I hit enter to run the command and disabling it ...
Saddle Point's user avatar
0 votes
1 answer
50 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
  • 1,055
0 votes
1 answer
235 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,287
0 votes
0 answers
31 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
  • 241
0 votes
0 answers
24 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
53 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,547
2 votes
1 answer
132 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,103
0 votes
0 answers
54 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
  • 1,055
3 votes
1 answer
332 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,547
1 vote
1 answer
260 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
77 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
  • 831
0 votes
1 answer
401 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
110 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,591
0 votes
1 answer
124 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
  • 653
0 votes
0 answers
125 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
  • 345
1 vote
1 answer
359 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
29 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
82 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,303
1 vote
0 answers
121 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
147 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
152 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
  • 992
4 votes
3 answers
705 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
  • 849
4 votes
2 answers
1k 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
2 votes
0 answers
160 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
  • 992
0 votes
1 answer
91 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
345 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
113 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
  • 33.3k
0 votes
1 answer
732 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
  • 217
0 votes
1 answer
90 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
312 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
2 votes
1 answer
161 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
403 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
107 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
  • 941
1 vote
0 answers
121 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
1k 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,822
0 votes
0 answers
131 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
  • 203
0 votes
1 answer
291 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
397 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
  • 908
1 vote
2 answers
418 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
  • 840
0 votes
0 answers
57 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