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
0 answers
11 views

Elpy-shell-send-region-or-buffer fails on tabify

I'm using elpy for python development, and have elpy-shell-send-region-or-buffer bound to C-c C-c. However, when I execute this, it fails to send and I have this error in my logs: elpy-shell--string-...
user avatar
0 votes
0 answers
44 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 ...
user avatar
  • 715
3 votes
1 answer
47 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 ...
user avatar
  • 3,815
0 votes
0 answers
21 views

Shell-mode mapping stopped working after update to emacs 28

I have the following binding commands (define-key shell-mode-map (kbd "C-r") 'helm-comint-input-ring) for my comint shell mode to get command history. After update to emacs 28 this binding ...
user avatar
  • 111
1 vote
1 answer
112 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 ...
user avatar
  • 13
0 votes
1 answer
30 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) ...
user avatar
  • 581
0 votes
0 answers
32 views

Running ssh with comint

To access a shell (whether a language-specific REPL or a generic shell like Bash), I would run: (comint-run "program-name") However, this does not work if I pass an ssh command to the above ...
user avatar
0 votes
1 answer
196 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 ...
user avatar
0 votes
0 answers
42 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-...
user avatar
  • 1,481
0 votes
1 answer
63 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. ...
user avatar
  • 553
0 votes
0 answers
68 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) ...
user avatar
  • 275
1 vote
1 answer
161 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? ...
user avatar
  • 275
2 votes
0 answers
14 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 ...
user avatar
  • 396
0 votes
0 answers
43 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 ...
user avatar
  • 1,163
1 vote
0 answers
47 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 ...
user avatar
0 votes
1 answer
106 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? ...
user avatar
  • 1,086
5 votes
3 answers
129 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?
user avatar
4 votes
3 answers
412 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 ...
user avatar
  • 597
4 votes
2 answers
584 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 ...
user avatar
  • 171
1 vote
0 answers
118 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*. ...
user avatar
0 votes
1 answer
37 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 ...
user avatar
0 votes
1 answer
235 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 ...
user avatar
4 votes
1 answer
87 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 ...
user avatar
  • 31k
0 votes
1 answer
620 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 ...
user avatar
  • 157
0 votes
1 answer
56 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 ...
user avatar
  • 101
4 votes
2 answers
211 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 ...
user avatar
  • 1,086
1 vote
1 answer
109 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.
user avatar
  • 1,086
1 vote
1 answer
328 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 ...
user avatar
0 votes
1 answer
71 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-...
user avatar
  • 847
1 vote
0 answers
92 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 ...
user avatar
5 votes
1 answer
571 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 ...
user avatar
  • 1,618
0 votes
0 answers
126 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 ...
user avatar
  • 183
0 votes
1 answer
239 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 &...
user avatar
  • 1,086
4 votes
1 answer
327 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 ...
user avatar
  • 858
1 vote
2 answers
279 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 ...
user avatar
  • 768
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"
user avatar
1 vote
2 answers
376 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 ...
user avatar
  • 1,086
6 votes
0 answers
112 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 ...
user avatar
2 votes
0 answers
193 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 (...
user avatar
  • 1,086
5 votes
0 answers
749 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 ...
user avatar
  • 10.9k
2 votes
1 answer
709 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 ...
user avatar
3 votes
3 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 ...
user avatar
  • 2,879
0 votes
0 answers
67 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 ...
user avatar
  • 1,690
1 vote
0 answers
183 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 ...
user avatar
  • 1,690
2 votes
1 answer
204 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 ...
user avatar
0 votes
1 answer
747 views

why tmux under ansi-term so slow?

I use colorized output in ghci. And if run it: in comint-mode, or in eshell, then colors displayed fine, but a lot of escape sequences displayed like ^A^Bλ ^A^B> ^A^B^B. in ansi-term, then I got ...
user avatar
  • 515
3 votes
0 answers
258 views

Emacs 25 + comint + -nw = eaten newlines

I've been building and running Emacs 25 prereleases on a recent Fedora system that I usually access via ssh. I usually run this emacs in a terminal, and I'm fond of using ansi-term inside it. I've ...
user avatar
11 votes
1 answer
2k views

Is it possible to read user input from STDIN while tangling a source block?

Is it possible to read user input from STDIN while tangling a source block with org-babel-tangle? I am aware of this: Org Mode Babel - Interactive code block evaluation. That doesn't help solve this ...
user avatar
  • 1,650
2 votes
1 answer
1k views

How to combine maxima-mode with *imaxima*?

How can I setup emacs to evaluate maxima code from a buffer in maxima-mode in the *imaxima* buffer rather than the default *maxima* one? While I can copy and paste the code between buffers, I'm ...
user avatar
  • 3,415