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
1answer
19 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 ...
1
vote
1answer
20 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 ...
0
votes
1answer
58 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 ...
3
votes
3answers
55 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 ...
0
votes
1answer
25 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 ...
1
vote
1answer
50 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) (...
1
vote
1answer
32 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 ...
0
votes
0answers
39 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 ...
1
vote
0answers
34 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 ...
2
votes
1answer
63 views

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

I am trying to apply following solutions's keybinding to overwrite all mode's keybindings for C-c > and C-c <. From the answer for Can we do C-c > and > and > to continue indentation: (...
0
votes
2answers
68 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
0answers
71 views

How to use nvm with spacemacs?

How can I use nvm with spacemacs? I want to be able to access nvm from any shell in spacemacs. I have installed nvm and it works with no problem from the terminal. When I open some shells in ...
0
votes
1answer
33 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 ...
0
votes
0answers
62 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: ...
0
votes
0answers
27 views

How to write the result of running an external command to a scratch buffer?

I'm running this ex command in evil mode: :%!grep -E "^\#" how can I write the result to some arbitrary buffer, instead of replacing the content of the current buffer?
0
votes
0answers
33 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
0answers
44 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 ...
1
vote
2answers
39 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
1answer
32 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 ...
6
votes
1answer
670 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, (...
0
votes
0answers
39 views

Despite commands working in Emacs shell or "M-!, still getting permission denied

I have Emacs 27.1 on Windows 10 using MSYS2 bash. I can successfully run bash from M-x shell: # echo $0 /usr/bin/bash Also, I can successfully run commands from `M-!". But some commands still ...
0
votes
0answers
60 views

Edit matlab code with emacs matlab-mode

I recently installed Emacs and I'm trying to configure it in a useful way. However, I'm finding really hard to correctly set up matlab-mode, which should provide autocompletion and linting. I noticed ...
0
votes
2answers
147 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
1answer
145 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
1answer
74 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 ...
0
votes
1answer
822 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
1answer
53 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 ...
0
votes
0answers
43 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)
4
votes
0answers
181 views

How do I make compilation use vterm instead of the default shell it is using?

I am running M-x compile commands in my Projectile projects. I would like to use vterm for running them as the compilations are getting very slow because the project is very large. How do I make ...
0
votes
1answer
117 views

How to send keyboard interrupt to running program in shell mode?

I wish to achieve what a C-c (send a keyboardinterrupt) would do in a terminal outside of Emacs. How do I do that in Emacs shell mode?
1
vote
1answer
34 views

Emacs unable to execute shell commands despite them being in the Emacs shell PATH

I am on Ubuntu. I'm trying to run the latex command to run in the Emacs shell. I have done some research, and have already done the following: I noticed that running env in the Emacs shell gave a ...
1
vote
1answer
173 views

What is causing Emacs remote shell to be slow on completion?

So basically I am doing the following: Opening a dired buffer with tramp on a remote. Opening a shell on the remote (M-x shell) Then if I try for example to type any command such as ls -la the ...
0
votes
0answers
21 views

How to run shell command in function and intercept standard output

Tell me how to use the trans command of the trans-shell package for translation. I need to write a function that will intercept the output translated text.
0
votes
0answers
34 views

emacs opens py file as sh file

Emacs has opened a py file as a shell script. What went wrong and how to change?
0
votes
1answer
71 views

How can I move the cursor from a shell window to another window in Evil mode?

Imagine I have following four windows in Emacs: Window 1 is a shell window (M-x shell). Windows 2, 3, and 4 are normal windows with files open. Evil mode is enabled. If I am the shell window, how can ...
2
votes
1answer
145 views

Run an external shell command to mutate text

I would like to run par or fmt to format my .md file. In vim this would be %!fmt (for the whole buffer) or 13,16!fmt (for line 13 - line 16). What's the "emacs way" to achieve something like ...
0
votes
1answer
81 views

How to print colorful and bold string in the mini-buffer

When I do echo "\033[1;31mThis is bold red text\033[0m" it should print This is bold red text as red and bold. When I try it in the emacs's shell it prints it as it is instead showing the ...
2
votes
0answers
52 views

Can desktop sessions be used to save and restore shell buffers?

Is it possible to use desktop-save-mode to save and partially restore my shell buffers? I realize shell buffers have quite a bit of state that isn't under the direct control of emacs, so specifically ...
1
vote
1answer
50 views

Elisp - Changing directory in shell buffer

I want to open an instance of a terminal emulator (in my case term) and go to a specific directory, all with a single Elisp function. My idea was to send a specific string programmatically to the ...
0
votes
0answers
29 views

/bin/top not found in eshell over ssh

How does eshell resolve its PATH? If I run my top in eshell on my local machine, it opens a new buffer and shows the output of the command in it. However, if I do the same on an eshell run on a remote ...
0
votes
2answers
51 views

How to not let a shell to capture the space key in Spacemacs?

In spacemacs, the space key is used to trigger the command shortcut, and an extra space can lead to a input/search of emacs command. Now I run into this situation: I use SPC b n to switch to next ...
2
votes
2answers
349 views

how can I run conda in emacs shell?

I've been using Python command 'conda' in the terminal on my Mac. But when I run a command like 'conda activate ...' in Emacs's shell (M-x shell), it gives me this objection: CommandNotFoundError: ...
0
votes
1answer
71 views

Run latexmk inside z shell instead of shell

Problem I am using latexkm to compile .tex documents, and recently I got this error while compiling: Running `latexmk' on `AF2021_serie5' with ``latexmk -bibtex-cond -pdf -synctex=1 AF2021_serie5'' Rc ...
0
votes
0answers
25 views

Dealing with unwanted output

If you used shell-mode for a while, you probably ran into situation where there's a process spitting lots of output very fast, so that C-g and C-c C-c don't really help. One way I found to be somewhat ...
1
vote
1answer
33 views

Can I format the arguments in a table and provide the rows to a shell block as arguments?

In org-mode, is possible to provide arguments formatted as a table to a shell block? E.g. argument |a|b| |c|d| shell script echo $a expected results a b c d Basically, I want org-mode to read the ...
1
vote
0answers
95 views

org-babel: zsh sessions use bash

#+BEGIN_SRC zsh :session z1 echo $HOME $0 #+END_SRC #+RESULTS: : /Users/evar /bin/bash I am thinking of trying the workaround outlined here, but shouldn't this work out of the box? Update: I couldn'...
5
votes
1answer
303 views

Org Src Block does not return any output

TL;DR: How do I get the stderr of my source block to be part of the #+RESULTS block, without changing the contents of the block? I can only get stdout to appear. [Long and winding explanation] While ...
2
votes
2answers
137 views

Starting a shell then cd to a specific directory

I want to go to a specific directory after I start a shell. So I put these lines in my .emacs file: (shell) (shell-command "cd C:/MyStartUp/ThisDirectory") (setq default-directory "C:/...
0
votes
0answers
53 views

is there a way to make compile shell process happen in eshell / "real" shell?

i wanted to bind a key to a compile and run command, then i found this post, Compile and run single file c++ programs in Emacs[SOLVED] ( last answer) It works perfectly fine and as intended. The only ...
2
votes
1answer
45 views

Fixed length buffer for shell

I launch a shell in my session with M-x shell and then I launch a python script that produces a lot of output to stdout---so many lines of output that my emacs session beomes quite slow. Is there a ...

1
2 3 4 5
7