Questions tagged [bash]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
1answer
51 views

Spawn a bash outside emacs?

I am trying to spawn a shell outside emacs, not in a buffer. I have tried (start-process "firefox" nil "firefox"), wich does start a firefox process outside emacs, but when i tried (start-process "...
1
vote
2answers
49 views

How can I get the list of recentf files from bash / cli?

How can I retrieve the list of recent files in bash? I'd like to get this set of files so I can use it with rofi. I could manually parse the data file that looks something like: ;;; Automatically ...
5
votes
1answer
68 views

Help me avoid “|| true” in org babel bash statements

I'm writing a lot of manuals on how to accomplish things in bash. Often I'm showing people something that doesn't work, and then go on to show what works. When I'm showing something that doesn't work, ...
1
vote
0answers
15 views

mmm-mode strange behavior with perl-shell-script

Background: I've been working with a program that is about half Bash and half perl. I thought I'd give mmm-mode a try since it sounded like just the mode for me. I don't know lisp well enough to be ...
4
votes
1answer
67 views

sh-script-mode: get [[ … ]] pair expansion to automatically include whitespace?

Say you're coding a shell script and you want to write something like: if [[ "$out" =~ 'none' ]]; then return $err fi If you're just typing it out and have any of the various electric/pair ...
1
vote
1answer
37 views

How do I specify a daemon to start with alternate emacs version with emacsclient

I have found this script from here #!/usr/bin/env zsh # Checks if there's a frame open emacsclient -n -e “(if (> (length (frame-list)) 1) ‘t)” 2> /dev/null | grep t &> /dev/null if [ “$?”...
1
vote
2answers
34 views

How to run selected bash commands

I have a large bash script and I need to rerun certain lines of code. Normally I would comment out any line I don't want to run and then execute the file on the shell. But that is rather cumbersome. I'...
1
vote
2answers
38 views

eShell Aliases – How to `grep` Forward Slashes

In Bash, I have an alias of ls -Ap | grep --color=always /$ that grabs the directories of the current directory, more or less. That said, using the same as an alias in Emacs's eShell seems to not ...
1
vote
1answer
32 views

Making Emacs show the last part of bash-command output

I use the Evil mode inside Emacs for doing a lot of my work. If I need to run a shell-command and see its output all I need to do is type in normal mode :!<bash command>. The window splits into ...
1
vote
1answer
279 views

How to get bash source code blocks to execute .profile / .bashrc

I don't understand how the source code blocks work exactly. There are some variables, definitions and aliases in my .bashrc that I think I should be able to use in the source code blocks. However, ...
1
vote
1answer
175 views

Emacs opens gitbash in new system window

I've try to follow this question and sulution Git Bash in emacs on Windows I have this function: (prefer-coding-system 'utf-8) (defun git-bash () (interactive) (let ((explicit-shell-file-name "C:/...
1
vote
1answer
285 views

M-x shell from MSYS2: cannot set terminal process group

I'm using MSYS2-x86_64, and whenever I do M-x shell I see the following: bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell ]0;~/.emacs.d ...
3
votes
1answer
50 views

completion for .bash_history

I am considering implementing an ivy-powered bash_history greper for term-mode, but before I do I wanted to know if this has already been done, by some fancy company-bashhistory package or whatever. ...
1
vote
1answer
121 views

Set custom bashrc or PS1 variable

I'm using, at the terminal on my android device, an simple approach to show the path to my location (export PS1="(\w)$ "). However, the \w seems to not be working in emacs shell emulator running ...
1
vote
1answer
108 views

How to turn off line wrap when opening from terminal

I'm trying to open a file from terminal and ensure that line-wrap will be off. I'm trying the following code, but it won't work emacs --no-window-system --eval '(setq truncate-lines 1)' file I don't ...
4
votes
2answers
100 views

How to sort bash functions alphabetically?

My boss is a bit of a neat freak. He wants the functions in my functions.sh be ordered alphabetically. foo() { echo foo } baa() { echo baa } So baa should appear first in the file. Can emacs ...
1
vote
1answer
50 views

Eshell simple echo in parenthesis not working

Why doesn't the following work in eshell $ (echo "foo") Symbol's function definition is void: echo What I tried: googled eshell parenthesis not working More Context: Eventually I'm trying to ...
1
vote
0answers
163 views

notmuch doesn't show INBOX (“Spawning child process: Invalid argument”)

I'm trying to get notmuch working on Windows 10 using WSL/Ubuntu. The idea is to treat the WSL as a remote machine (roughly following https://notmuchmail.org/remoteusage/) and to have a shell script ...
1
vote
1answer
323 views

How do you abort an emacs M-x compile compilation

How do you abort an emacs M-x compile compilation? I'm editing a bash file, and I "test execute it" by doing M-x compile. What I tried - googled:emacs abort compilation The file I'm working on is ...
1
vote
1answer
103 views

How can I tail/stream output when evaluating org babel shell blocks?

I learnt about asynchronous execution of org babel shell code blocks, thanks to: How is #+BEGIN_SRC sh :results drawer different to #+BEGIN_SRC sh I want to know if it's possible to tail/stream the ...
7
votes
1answer
2k views

How to fix “Symbol's function definition is void: org-babel-get-header”

How do you trouble shoot this? (trying to run a sh block async) #+BEGIN_SRC sh /tmp/7.sh ...
1
vote
0answers
234 views

How is #+BEGIN_SRC sh :results drawer different to #+BEGIN_SRC sh

While reading http://www.howardism.org/Technical/Emacs/literate-devops.html I saw the author recommending #+BEGIN_SRC sh :results drawer for "time-consuming and verbose" commands. (I do a ...
3
votes
1answer
716 views

Remote shell path - env: No such file or directory

In Emacs, when I open the file /ssh:USER@HOST:/PATH, Tramp mode kicks in and everything is great. While editing the file, I want to open a remote shell as well using M-x shell, but its behaviour is ...
0
votes
1answer
276 views

Git bash opens in window outside of emacs

When running Emacs on Windows 10, I am able to launch git bash from within Emacs using the information given here, here, or here. For example, I can just add these two lines to my .emacs: (setq ...
0
votes
0answers
25 views

How to make compile function obey my .bashrc when compile is called by some library?

In my ~/.bashrc I've got some changes, the most important one being the change to $PATH. One of the commands I'm using runs through the compile function, but it fails - bash can't find the binary. ...
2
votes
1answer
391 views

Run Emacs command from terminal

Is there a way to open a file on emacs, execute a command and quit, quietly? I tried emacs file --eval '(progn (cmd) (kill-emacs))' But if I execute this, emacs shows up briefly before quitting. Is ...
3
votes
1answer
496 views

Flycheck gives errors, when I use shellcheck as linter for bash scripts

I use GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2017-06-09, and Shellcheck 0.3.7 als linter for bash scripts (https://www.shellcheck.net). When I open a bash script, I ...
3
votes
1answer
1k views

Emacs can't find Node when Node was installed using NVM

I've got Node installed using NVM, and Emacs (v25.2.1) isn't able to find Node. When I run M-: (executable-find "node") I get back nil. However, when I run M-: (executable-find "cat") I get "/bin/cat"...
1
vote
1answer
130 views

Suspend frame, run a bash command, sleep for a few seconds and come back to emacs

[ I'm using the latest emacs, and always emacsclient with the -nw option in a terminal ] I have this workflow I want to "automate" with an emacs hotkey. I find myself doing this over a hundred times ...
1
vote
2answers
299 views

tramp and fish shell (local)

How to setup emacs tramp to open remote files while local shell is fish? More precisely is how to ask tramp to use bash shell instead of one named in SHELL environment variable?
1
vote
1answer
515 views

Linter for Google shell style guide?

Does anyone know of a Bash linter for the Google shell style guide? I have been using shellcheck as my linter with flycheck but it doesn't conform to this standard.
0
votes
1answer
626 views

Ansi-Term not reading .profile

my question is very similar to this one. I use my .profile file to set environment variables, such as EDITOR. However, when I run ansi-term and type printenv I can see that that variable is not ...
3
votes
0answers
697 views

Using Windows bash as the shell

I'm trying get Spacemacs (i.e., Emacs) to use the Windows subsystem for Linux bash shell as the shell. I've added (setq explicit-shell-file-name "c:/Windows/System32/bash.exe") to my .spacemacs ...
0
votes
1answer
243 views

External command doesn't run in GUI mode

I have the following function attached to f2 key in latex mode: (defun latex-compile () "Runs pdflatex on current file" (interactive) (let* ((file-name (shell-quote-argument (buffer-...
0
votes
1answer
95 views

Garbage prepended to PATH

For some reason, some garbage is prepended to my PATH variable in emacs. Testing from eshell: (M+x eshell): ~/projects/rust/logentries-parser/src $ echo $PATH bash: cannot set terminal process group ...
1
vote
0answers
260 views

ansi-term changes in line-mode not registered after char-mode

Here's the situation. I start M-x ansi-term, which launches it in term-char-mode. I type the following: echo "hello world" and press RET, which outputs on the next line the expected output hello ...
3
votes
0answers
36 views

Highlight variables without $ inside (( )) when in sh-mode?

Is there a way to modify sh-mode to highlight variables inside a double parentheses construct when not using the dollar sign prefix? For example I want the i to be highlighted in ((i++)) without the ...
3
votes
0answers
425 views

Terminal Buffer: error in process filter: Invalid face: unspecified

On Fedora 25 with GNU Emacs 25.1.90 (which I am running via an AppImage, you can download it from here and test out your theories as to what's wrong if you would like, remember AppImages will only ...
10
votes
2answers
5k views

.bash_profile or .bashrc for shell in emacs?

I wrote an alias for a huge command and stored it in .bash_profile and to my surprise, emacs didn't pick up the alias that I wrote in .bash_profile. After some searching in the internet, I created a ....
2
votes
1answer
879 views

how to automatically open .ics file after org-icalendar-export-to-ics?

I use org-icalendar-export-to-ics to export org-agenda scheduled tasks to iCal format, which works nicely. In my use case, I always select export the "current file" (as opposed to "combine all agenda ...
1
vote
2answers
2k views

No such file or directory error on executing script

I use GNU Emacs 24.3.1 on Ubuntu 14.04 and I have a bash script: ~/path/to the/script/test.sh. As you see the path has space character. Script has a simple content: ENTRY=`zenity --password --...
4
votes
2answers
351 views

sh-script alignment issues

I'm sure emacs used to do it my way, but things appear to have changed (probably years ago, I've just been living with the pain). I want this (to conform to corp. standards): MULTIFORM=$( curl -...
1
vote
1answer
90 views

emacs theme changes when i moved to zsh from bash

I recently shifted form bash to zsh and also installed ohmyz. Since then my emacs theme doesn't work. the one on the Left is how it looks in bash. On the right, when run on zsh its different. Thanks,....
10
votes
3answers
4k views

Set indentation for shell script function

I am trying to set the number of spaces per indent for starting a new function in sh-mode (bash sub-mode). I have tried setting: '(sh-basic-offset 2) '(sh-indentation 2) '(smie-indent-basic 2) (as ...
2
votes
2answers
5k views

copy from shell and paste in terminal-emacs

How can I copy from the command line and paste in Emacs in terminal mode? If I select the text with the mouse and paste it from the clipboard with the third button (the wheel) it is OK. But if I try ...
2
votes
3answers
3k views

Tramp: Waiting for prompts from remote shell

I added two new lines to my .bashrc so that Bash can find my Go programs: GOROOT=/Users/jay/work PATH=$PATH:$GOROOT/bin But as a result, when I launch Emacs, Emacs hangs for several minutes and I ...
0
votes
1answer
101 views

Bash command to see a list of all open buffers

I am in bash and emacsclient is running. I would like to run a bash command to display a list of all open emacs buffers. The output of buffer-menu is fine. These commands do not work: emacsclient -e ...
0
votes
0answers
24 views

Odd filename parsing error when scripting emacsclient on OSX

I get the same error as this Stack Overflow asker when trying to use a wrapper script to tell OSX where the emacs server socket is: I don't think it's a bash issue, as the Emacs PID is correctly ...
9
votes
3answers
6k views

Git Bash in emacs on Windows

I can run the Bash shell that comes with Git for Windows. I put this in my .emacs: (defun git-bash () (interactive) (let ((explicit-shell-file-name "D:/Program Files/git/bin/bash")) (call-...
3
votes
0answers
217 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 ...