I have a few custom bash functions that are defined is some file and are made available to me in regular terminals via the line
. "/path/Custom Bash Functions.sh"
in my ~/.bashrc
. However, Emacs does not recognize them.
I don't really care whether they are available in any terminal emulator inside Emacs. I only care about them working when I hit M-!
.
This answer suggests setting shell-command-switch
to "-ic"
(adding switch i
to the default). However, all this seemingly results in is that the output of all commands I execute via M-!
are preceded by:
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
I still can't execute custom bash functions. Auto-complete for them doesn't work either.
Maybe this is because I use a newer version. I use the latest version on the master branch of Emacs' git repo (pulled the latest changes and installed them less than 2 hours ago).
-i
does is to source~/.bashrc
(assuming you use/bin/bash
as your shell). So you can put your custom functions in that file, or source your custom functions file from there. That's probably a good idea so you can have your custom functions in a shell without having to source it explicitly every time. The complaints that bash issues however in the-i
case probably arise from how emacs sets up the process and probably cannot be avoided. – NickD Nov 2 '18 at 17:42-i
should work. Try adding-ix
and post the complete output, preferably with a shorter.bashrc
that reproduces the problem. – Gilles 'SO- stop being evil' Nov 2 '18 at 19:22.bashrc
was messing with what I tried to do. Anyway, it works now. However, there still is no auto-complete. I have to type out the entire command. Should auto-complete work? I tested it withemacs -Q
and it behaves in the same way: The command works (after evaluating(setq shell-command-switch "-ic")
) but it's not auto-completed when I hit <kbd>Tab</kbd>. – UTF-8 Nov 5 '18 at 18:34i
switch. – UTF-8 Nov 7 '18 at 15:04