Hot answers tagged

6 votes
Accepted

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

Try this Note: Made following minor changes to your code block: Moved #!/bin/bash into code block header :shebang #!/bin/bash to automatically set executable file permissions when block is ...
Melioratus's user avatar
  • 4,634
6 votes
Accepted

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

Here's a simple function that gets the pid of the process running in the current buffer and then calls the pstree command to get the process tree of that process: (defun iproc () (interactive) (...
NickD's user avatar
  • 29.3k
5 votes
Accepted

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

You'll need to write your own function for doing this. You'll want to read up on the functions get-buffer-process and signal-process to learn about how to send the right signal to the ESS process. ...
Jordon Biondo's user avatar
5 votes
Accepted

How to clear shell in ielm?

inferior-emacs-lisp-mode (aka ielm), like various other subshell modes in Emacs, derives from comint-mode, a general COMmand INTerpreter. This means that ielm inherits a lot of comint's functionality ...
Basil's user avatar
  • 12.3k
4 votes

multi line inputs in ipython

I realize it's an old question, but since it was left unanswered, I will bring the fix I found here after running into the same issue. Make sure your version of IPython is at least 5.4 Install ...
S4M's user avatar
  • 141
4 votes

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

As far as I can tell, comint offers the variable comint-input-ring-file-name for this. It wouldn't make much sense to use this globally, because all "frontend" functions that use comint under the ...
Stefan Kamphausen's user avatar
3 votes
Accepted

Cargo-process does not accept user input

After some research, I was able to solve it by adding this to my init.el: (with-eval-after-load 'rust-mode (define-key rust-mode-map (kbd "C-r") 'my-cargo-run)) (defun my-cargo-run () "Build and ...
Safron's user avatar
  • 171
3 votes

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

nowadays you would likely want to use https://github.com/wbolster/emacs-direnv it works similar to the hook that direnv installs in your shell. the emacs environment is updated on request (or ...
wouter bolsterlee's user avatar
3 votes

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

One crude non-robust way to get the last output in term-modeis: (defun term-recommended-hook () "Hook function recommended as `term-mode-hook'. (See file \"term.el\".)" (setq term-prompt-regexp "^...
Tobias's user avatar
  • 33.1k
3 votes

How to combine maxima-mode with *imaxima*?

I'm a beginner when it comes to Emacs (Lisp) but the following seems to work (at least for me). I'm also using the Spacemacs configuration framework so there's a possibility of some stuff being ...
Tuntuni's user avatar
  • 131
3 votes

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

You can do M-x ess-interrupt.
Alex's user avatar
  • 1,038
3 votes
Accepted

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

comint uses a regular expression to recognize password prompts: comint-password-prompt-regexp. It's fairly complicated in an attempt to catch as many variations as possible, but it is conceivable (and ...
NickD's user avatar
  • 29.3k
2 votes

zsh EXTENDED_HISTORY corrupts shell-mode history

Setting comint-input-ring-separator so that the whole timestamp is treated as part of the command separator worked for me. For example: ; Remember lots of previous commands in shell-mode (setq comint-...
a22's user avatar
  • 21
2 votes
Accepted

How can Emacs set an environment/shell variable in a subordinate shell?

After (re)reading the code of the shell function, here's what I'd do: (advice-add 'make-comint-in-buffer :around #'my-enable-auto-save-in-shell) (defun my-enable-auto-save-in-shell (...
Stefan's user avatar
  • 26.3k
2 votes

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

I slightly modify @npostavs 's answer for my own use. I'll accept his answer and give him the credit. (defvar python-shell-output-chunks nil) (defun python-shell-filter-long-lines (string) (push ...
Saddle Point's user avatar
2 votes

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

Sorry not sure how to paste this as a comment, this works for ESS: (defun my-interrupt-ess-buffer-process () "Send a SIGINT to script's iESS process." (interactive) (signal-process (ess-get-...
Arktik's user avatar
  • 972
2 votes

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

As suggested by the comments, the book is out of date in this respect. That command no longer kills the region; it just deletes it. The change was released in GNU Emacs 19.34 (21-aug-96) Commit ...
phils's user avatar
  • 50.5k
2 votes

How to copy output from ess to the kill ring?

Maybe not as elegant as what you want, but there are functions for each step in your workflow: ess-switch-to-inferior-or-script-buffer, C-c C-z set-mark, C-<space> comint-previous-prompt, C-c C-...
Tyler's user avatar
  • 22.1k
2 votes
Accepted

Why jshell doesn't work in comint-mode?

Comint doesn't provide a fully-functional terminal replacement. It passes input from the user to the shell, and prints the output back to the screen. It can handle some escape sequences, but that's ...
Tyler's user avatar
  • 22.1k
2 votes
Accepted

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

term-exec-hook is a variable defined in term.el. Called each time a process is exec'd by term-exec. This is called after the process is cranked up. It is useful for things that must be done each time ...
phils's user avatar
  • 50.5k
2 votes
Accepted

OSC 8 links not working in the Comint mode

What is the value of comint-output-filter-functions? Note the specific wording of the Changelog entry: *** Support for OSC escape sequences. Adding the new function 'comint-osc-process-output' to '...
db48x's user avatar
  • 17.7k
2 votes
Accepted

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

EDIT I suddenly, realized that I did not inspect comint--complete-file-name-data, then while I was checking some things, I accidentally added comint-filename-completion to the global hook (i.e. as ...
dalanicolai's user avatar
  • 7,785
1 vote

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

You should start with Process Information: (process-command (get-buffer-process "*Python*")) ==> ("python3" "-i") (process-status (get-buffer-process "*Python*")) ==> run You should not be ...
sds's user avatar
  • 6,104
1 vote

Cargo-process does not accept user input

Another possibility: (defun rust-compile-send-input () "Read string from minibuffer and send it to the rust process of the current buffer." (interactive) (let ((input (read-from-...
bertfred's user avatar
  • 1,729
1 vote

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

I cycle using comint-previous-input and comint-next-input. So, if I had entered previously x = 1 and x = 2; when I enter x = [cursor] the above two comint commands cycle the previous entries backward ...
Arktik's user avatar
  • 972
1 vote
Accepted

Shell mode - clear screen but keep scrollback

comint-postoutput-scroll-to-bottom in the hook comint-output-filter-functions is causing to scroll to bottom and so to remove it from the hook add this snippet to emacs config (add-hook 'comint-mode-...
junnu's user avatar
  • 780
1 vote

How to get rid of flickers in python shell?

See the variable comint-scroll-show-maximum-output, which may be somewhat at fault here for the behavior the O.P. experiences -- the default value is t: Documentation: Controls how to scroll due to ...
lawlist's user avatar
  • 19.1k
1 vote

Using xonsh as python shell

I suggest you use for interactive xonsh sessions shell-mode instead. (It works well for me; after all xonsh is a shell.) Read for install requirements from the xonsh documentation: How do I use xonsh ...
halloleo's user avatar
  • 1,341
1 vote

Shell coding system

As regards Linux, the behaviour can be controlled by with: (setenv "LANG" ENCODING) before calling M-x shell and after from the shell buffer with: (set-buffer-process-coding-system INPUT-ENCODING ...
antonio's user avatar
  • 1,802
1 vote
Accepted

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

I finally notice that there are situations that python-shell-send-string and python-shell-send-file call each other. The function python-shell-send-string use \n to identify whether it should send a ...
Saddle Point's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible