Questions tagged [shell]

Questions relating to commands for passing single command lines to shell sub-processes, running a shell interactively with input and output to an Emacs buffer, and for running a shell in a terminal emulator window.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

Emacs shell - git diff not displaying inserted ("+") lines with dos file endings and color

If I modify a file checked into version control with DOS line endings, on a normal terminal I can see the change: # Normal terminal... $ git diff diff --git a/a b/a index c113281..85c3ecd 100644 --- a/...
0 votes
1 answer
33 views

Change Emacs prompt [duplicate]

I have Emacs running as a package in MobaXterm The problem is that Emacs has very ugly prompt. If I disable PS1 in .bashrc than it works in Emacs fine but change MobaXterm terminal as well. Hence I ...
  • 139
0 votes
0 answers
14 views

Issue seeing files in dired directory or shell on remote machine

This used to work fine but seems to have broken today and I have not knowingly made any explicit changes to configuration. If I use a standard terminal (mac) and ssh into my server I can visit a path ...
  • 239
0 votes
1 answer
25 views

`M-x shell` not displaying colors

OS: Mac OS 12.5.1 Emacs: GNU Emacs 28.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2022-05-11 (i.e. the 28.1-4 binary from https://emacsformacosx.com/) ...
0 votes
0 answers
12 views

Using Term mode to ssh from Linux to Windows

Windows 10 ships an SSH server. I am using it for running PowerShell from Linux. When I do this from the Linux terminal (I tried in Xfce and LX terminals), everything is smooth. I run: ssh user@192....
  • 1,658
1 vote
0 answers
33 views

Shell with unique buffer names

I use the following function to make a shell buffer, but the unique file name is not taking effect. (defun galaxy-shell () "Make a uniquely named buffer for executing shell commands." (...
  • 383
2 votes
2 answers
48 views

Emacs shows up a buffer even if I told it to not do so

I'm writing a couple of functions to help me in Java development (may turn into a package someday). To extract the classpath for my project, I use Maven (mvn dependency:build-classpath), then I filter ...
0 votes
1 answer
14 views

Outputs are truncated in a remote shell buffer over `tramp`

When I run ps -ef | grep python3 in my kitty terminal, I get root 2331 1 0 Jun22 ? 00:00:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers root 2667 1 ...
1 vote
1 answer
22 views

How to stop shell buffers echoing directory path when `cd` into it?

When cd some_directory then RET in shell-mode, some_directory is printed in the echo area. How can I stop this?
0 votes
0 answers
18 views

`shell` process got killed when C-c C-c

When tramp-own-remote-path is add to tramp-remote-path, a shell buffer started with /ssh:/some_server:/bin/bash got killed when doing C-c C-c on a running process or empty prompt. The issue does not ...
1 vote
1 answer
49 views

How can I get the name of the file on the current Dired line?

I'm running emacs on WSL. The following function launches the binary file marked in dired: (defun wsl/execute () "execute file at point in dired" (interactive) (dired-do-shell-command ...
  • 145
0 votes
0 answers
48 views

Shell: Is it possible to enter input to an interactive command inside the shell?

It doesn't work for me. e.g. Entering a command read -r value in a terminal would wait for an input from the user, and after user enters some value, we can see that value with echo $value. But is ...
0 votes
1 answer
48 views

How to get tab completion work properly in telnet-mode

I'm trying to get command and file tab completion to work in telnet-mode. For that, I did bind the TAB key to completion-at-point in telnet-mode-map. The function is called as expected but it does ...
  • 641
0 votes
1 answer
31 views

A comparitive analysis of shell, eshell, and term: what are the similiraties? What are the differences between them? When to use each of them?

This question was previously answered in Unix Stack Exchange. It has not been answered here, in Emacs Stack Exchange. I believe new answers in a community fully dedicated to Emacs could go deeper. But ...
1 vote
1 answer
121 views

Why does `eshell` not create an active process In Emacs while `shell` and `term` do?

In Emacs, the features shell, term, and eshell are different commands used for similar goals. When executed, shell and term create active processes in Emacs. I expected the same for eshell. However, ...
0 votes
2 answers
71 views

Why does htop command does not work on *shell*?

I tend to prefer shell over term. With shell everything is text and I can use the Emacs bindings to move around. Also, I have been trying to avoid opening my nixOS terminal. I have been trying to stay ...
0 votes
1 answer
57 views

Why does org see this source block as having "unbalanced parentheses"?

Here is a terse snippet with which you can recreate the issue, I hope: #+begin_src sh for x in $(for y in $(cmdA '"'); do cmdB $y; done); do cmdC $x; done #+end_src Here if I try to operate with ...
  • 103
0 votes
1 answer
25 views

Being in *shell* buffer, is it possible to open a file with the current Emacs application from a shell command?

After executing the shell command, I have a shell buffer inside Emacs. After executing classic ls -l, there is a file listed that I want to open in Emacs: [pedro@system:~/projects/career-opportunities]...
0 votes
1 answer
31 views

Open shell from find-file interactively

Currently, I can use C-x C-f to find-file (or ido-find-file) then open a dired directory and launch M-x shell. Is it possible to interactively navigate a path be it a local ~/Documents or tramp shell ...
  • 229
3 votes
1 answer
44 views

How to run a buffer/region with shell commands as root user?

I need to copy-paste a bunch of shell commands to emacs and run them as root/sudo. How do I do it? For instance, while configuring samba, I come across this instruction from the documentation: Become ...
0 votes
0 answers
49 views

How to have a multiple line prompt terminal?

Using mainly ansi-term,term or vterm I'd like the prompt to contain a line with informations for directory,user and git, whilst the actual input prompt line to be below. I've heard of zsh though doubt ...
  • 629
3 votes
1 answer
72 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 ...
  • 3,997
0 votes
0 answers
41 views

Emacs shell make a new shell in a new numbered *shell<n>* buffer, same window

I updated from emacs 27 to emacs 29, and I find that now when I run M-x shell It overwrites the file/buffer I am currently using with a new shell, rather than starting a new shell in the current ...
0 votes
1 answer
34 views

Completely removing all python-shell functionality

I'm running emacs 27.2 under Linux. I want to totally and completely remove all python-shell-* functions. I know how to unmap the python-shell-related keymappings, but I want to go further and remove ...
  • 552
0 votes
1 answer
56 views

Dedicated python shells that runs the code

This answer how to map C-c ! to create a new python shell for the current buffer. The main code is this: (defun my-python-start-or-switch-repl (&optional msg) "Start and/or switch to the ...
2 votes
1 answer
13 views

SICSTus Emacs Interface - Installation

I am currently trying to install the SICSTus Emacs Interface on Ubuntu to use Emacs to program in Prolog, but it seems that I am too stupid to do so. On https://sicstus.sics.se/sicstus/docs/4.3.5/html/...
1 vote
1 answer
46 views

call windows batch from shell

I'm trying to run QGIS from the command-line on Windows. QGIS provides a batch file for this, "C:\Program Files\QGIS 3.20.3\bin\qgis.bat". When I run this from within Emacs shell, the load ...
  • 3,997
1 vote
1 answer
35 views

clean weird characters from org source shell

When I run a shell command in Org I sometimes get back weird control characters: #+begin_src sh :results output :session test guix pull #+end_src #+RESULTS: : : Updating channel 'guix' from Git ...
  • 3,997
0 votes
1 answer
326 views

How to read the shell environment variables?

I have the following command in my .emacs (setq org-roam-directory (concat (getenv "BASEDIR") "/data/org-roam/")) The purpose is to the set the directory for org-roam (but ...
  • 223
3 votes
3 answers
61 views

Use basename of the file

When I am done editing myfile.tex, I M-x shell-command RET. At the prompt, I manually enter pandoc -s myfile.tex -o myfile.org. What command will save me the trouble of having to type out the myfile ...
  • 1,712
0 votes
1 answer
106 views

Automatically change encoding of process buffers

Platform Windows 10 with GNU Emacs 26.1 (build 1, x86_64-w64-mingw32). Goal To set the encoding of process buffers to UTF-8. I would like to set the input and output encoding of process buffers, like ...
  • 316
1 vote
1 answer
89 views

How to pass a string argument to a function from global-set-key definition inside .emacs

Inside my .emacs file I have these two functions: (defun bh/switch-to-vs () (interactive) (universal-argument) (shell "*vs*")) (defun bh/switch-to-android () (interactive) (...
  • 113
1 vote
1 answer
37 views

emacs 28.0.50 `sh-quoted-exec` has different coloring for `sh` and `bash`

In Shell-script[bash] mode, coloring differs for sh-quoted-exec in #!/bin/sh and #!/bin/bash. If #!/bin/sh is the first line: // I prefert this If #!/bin/bash is the first line: Would it be possible ...
  • 1,072
0 votes
0 answers
86 views

How to create shell aliases in Emacs [GUI] in Windows?

In Linux this can be done by something like: alias cdwww="cd /srv/www" In Windows there is an equivalent command called DOSKEY, used for example like this: doskey ls=dir $* The above works ...
  • 113
1 vote
0 answers
60 views

Two prompt lines using emacs shell and plink

I am using emacs M-x shell command to create a shell, and from this shell I connect to a remote machine by using plink (PuTTY on windows). I have a problem with the prompt being presented twice. I ...
  • 41
2 votes
1 answer
85 views

How to define global key binding for `C-c >` and `C-c <` using `defhydra`

I am trying to apply following solutions's key binding to overwrite all mode's key bindings for C-c > and C-c <. From the answer for Can we do C-c > and > and > to continue indentation:...
  • 1,072
0 votes
2 answers
294 views

How to "pipe" a string to a shell command in elisp rather than give it as an arg?

The command I'm trying to duplicate: curl https://example.com | readability https://example.com As far as I can see, though, using that | pipe is NOT the same as passing the string in as an arg. If I ...
0 votes
1 answer
36 views

From an org item, launch a shell command with the item text as parameter

From an org list item, I want a function that I can bind to a shortkey or an org-speed shortcut, to be able to launch a shell command with the org list item text as parameter. Then I want to add tag ...
  • 103
0 votes
0 answers
202 views

How to run shell scripts at startup of Emacs/EXWM?

I have configurations I would generally run on the startup of DWM. Now, I would like to do the same with EXWM/Emacs. Is there any Elispian way to do it? EDIT: arrived in conjunction with @lawlist OBS: ...
  • 257
0 votes
0 answers
53 views

Specify which emacs to open for a file when running shell inside emacs

Consider a scenario I run an emacs instance E01, and use the shell inside emacs to find the file I want to open; I found the file file using this shell. Now I'm ready to open it through the shell ...
0 votes
0 answers
182 views

Interactive terminal solution for Emacs on Windows?

I recently tried to move from over to Emacs but hit a brick wall while trying to setup a terminal. While shell and eshell work fine, they are not really interactive so you can't really run things such ...
  • 123
1 vote
2 answers
58 views

Custom compilation command fails on Windows due to slashes in paths

when i type on "shell": c:\Users\TR\Desktop\emacs-27.2-x86_64\bin\GAMES\game3>love . works fine but when i put (defun insert-file-name () (interactive) (let ((compilation-ask-about-...
1 vote
1 answer
36 views

Tramp with Dired produces unwanted //DIRED// line

Connected via Tramp to an old remote system, when I list a directory using Dired, I get: /plink:user@example.com:/tmp: total used in directory 549 available 114.7 MiB drwxrwxrwt 3 root ...
  • 989
6 votes
1 answer
2k views

How to get the PATH from the SHELL

When launched at system start-up, the Emacs daemon doesn't pick up modifications to the PATH introduced by shell initialization scripts. Emacswiki suggests to use this function to update Emacs' PATH, (...
  • 1,414
0 votes
2 answers
335 views

pipe result of elisp function to a shell command

I wanna pipe the output of an elisp function (emacs-version) to a shell command (xclip). How can I do this? I accept vanilla emacs and evil solutions.
1 vote
1 answer
236 views

How to make emacs shell the same as system terminal experience?

On macOS, using iTerm2. It looks like In Emacs For Mac OS X, it looks like I copied system's ~/.zshrc file to ~/.profile and ~/.bash_profile, but doesn't they read configrations when start emacs?
0 votes
1 answer
141 views

Launch an external command prompt (cmd.exe) in a specific folder [duplicate]

I'm trying to build a cmd interactive function in Emacs, which would open a Windows command prompt - exactly like Win+R cmd does. Within Emacs, it would be accessible with M-x cmd, and it would open ...
  • 441
1 vote
2 answers
2k views

How to use doom emacs as a golang ide quickly?

I installed the newest doom emacs on macOS. Also configed language packages as $ emacs ~/.doom.d/init.el :lang (go +lsp) :tools lsp $ ~/.emacs.d/bin/doom sync When I open a .go file, the code became ...
0 votes
1 answer
111 views

Repeating characters in `python-mode.el` shell interaction

I experience strange behaviour when using python-mode. When sending characters to the shell using C-c C-e, the first string works well. After that, the characters start repeating, in a manner that is ...
  • 103
1 vote
0 answers
73 views

Unexpected local shell in TRAMP mode

I have a clear installation of spacemacs with layer shell on. I open remote dir SPC f f ssh:<host>:<path> I open shell SPC ' Shell is local (I expect it to be opened on the remote host)

1
2 3 4 5
7