glucas is exactly correct, but to supplement his answer I have this piece of code I've used myself to make here doc insertion a little smarter.
This advice, coupled with sh-electric-here-document-mode enabled, make it so that if you type two chevrons the automatic here doc will be created, but then if the next character you type is another chevron, it will ...
This is the correct behaviour. .bash_profile is for so-called login shells. Like when you log in to your computer in text mode, or in a terminal emulator to a different computer via ssh or telnet or ...
.bashrc is meant for non-login shells, like when you are already logged in and start a new xterm, or in this case emacs' shell mode.
Usually the ....
This is caused by sh-electric-here-document-mode. When enabled, << will insert a here document skeleton.
This is enabled by default. You can disable it with a hook, such as:
(add-hook 'sh-mode-hook (lambda () (sh-electric-here-document-mode -1)))
The code below use a font-lock rule with a function instead of a regexp, the function search for occurrences of $VAR but only when they are inside a double-quoted string. The function (syntax-ppss) is used to determine this.
The font-lock rule use the prepend flag to add itself on top of the existing string highlighting. (Note that many packages use t for ...
In addition to the points made by @pingi, you can also use a separate configuration file that will be loaded only for the emacs shell (M-x shell):
From the manual page (emacs) Interactive Shell:
Emacs sends the new shell the contents of the file
‘~/.emacs_SHELLNAME’ as input, if it exists, where SHELLNAME is the name
of the file that the shell was ...
According to https://lists.gnu.org/archive/html/emacs-orgmode/2015-11/msg00425.html ob-sh was renamed ob-shell in org 8.2 ... and I cite from there:
org-babel-get-header was removed in 0d000f5 (babel: small change in
API., 2015-10-29), but the old ob-sh.el is still trying to call it.
That means you should replace (sh . t) by (shell . t) in your call of ...
The ^ noise is coming from various terminal control characters in your shell prompt. Try echo $PS1 to see the full sequence, and try e.g. export PS1='$ ' to see that a simpler prompt string removes that particular problem.
For the encoding, you might try making utf-8 your preferred encoding:
Setting up the prompt
The -i flag requests that Bash run in interactive mode, which requires a terminal. The solution is to leave the shell-command-switch variable at its default value, which is just -c.
If you really need to run Bash in interactive mode, you will need to run it in a pseudo-terminal, by using start-file-process with process-connection-type bound to t.
Thanks J David for forcing me to look more deeply.
flycheck.el defines sh-bash, the checker used for bash; and that has a next-checker known as sh-shellcheck. Ans, as Jordon is points out, that invokes shellcheck
Poking around in 2 reveals how to supress warning in a selective manner:
# shellcheck disable=SC2029
ssh foo "$@"
You're nearly there; you have a :prologue set, via exec 2>&1, to capture both stdout and stderr. To finish this, you just need two things:
:results: output to inform Babel that you want the results from what gets written out, not by what the code returns; and
:epilogue "true", to do what you're doing above with || true unilaterally and always without ...
You can't copy-paste between Emacs and a shell without using a system-wide copy-paste facility. Text terminals in general do not provide a copy-paste facility.
It seems that you're running this terminal Emacs in a terminal window in a window environment. Window environments do provide copy-paste; that's what happens when you use the mouse. However, this ...
I had this exact same problem but it had nothing to do with RVM on ( which I also have ) on my Ubuntu-16.10 machine. It was related to by custom prompt (PS1)
The issue was the prompt PS1.
This fix : https://stackoverflow.com/questions/6954479/emacs-tramp-doesnt-work
Essentially in your .bashrc
case "$TERM" in
Although it is not clearly documented in its man page, emacsclient doesn't seem to accept a full command (i.e. program + arguments) as the alternate editor, only a program.
You could write a small shell script:
exec emacs -q -nw "$@"
and use it as the alternate editor:
export EDITOR='emacsclient -a PATH_TO_YOUR_SCRIPT'
Setting sh-basic-offset to the required indentation is what is needed - but what I didn't realise is, it's also necessary to close and reopen all shell script files before the customisation takes effect. I can't remember ever having to do this before in emacs.
As of 40469d5, Flycheck includes the warning code of ShellCheck in the messages, and provides a new option flycheck-shellcheck-excluded-warnings to exclude warnings from ShellCheck reports.
To suppress a ShellCheck warning for Flycheck, use the error list at C-c ! l to find out the corresponding error code (in square brackets at the end of the message), and ...
The only way you would get that error is if you were using the shellcheck checker, in order to remove these warnings you need to customize the command flycheck is using for shellcheck, there is no built in way to customize the existing shellcheck checker, but you can create a new checker with that feature.
You'll need to create a new flycheck checker that ...
For the indentation after the | you should be able to get the right result by going to the incorrect line (i.e. the one that starts with grep) and then do M-x smie-config-set-indent RET before "|" RET nil RET.
But smie-config is not up to the task when it comes to tweaking the behavior of the close paren in the way you want. For that you'll need actual ...
Install exec-path-from-shell. From the documentation, after calling (package-initialize), add the following to your .emacs file:
(when (memq window-system '(mac ns x))
Add the following to your .emacs file:
(setq exec-path (append exec-path '("~/.nvm/versions/node/v6.3.0/bin")))
apt installs an old version of flycheck,
that does not support --external-sources, this particular commit has been merged at flycheck recently
https://github.com/flycheck/flycheck/pull/1256/files/7b35a1b17e415ecc8f9fc04b3a043a3afb40599c and make use of such feature.
The solution is simple, just opt-out of it. ...
exec-path is how Emacs finds executables, but you're not asking Emacs to find pdflatex, you're only asking it to find a shell, and the shell is then trying to run pdflatex.
The shell will be using the PATH in its environment. Your problem is probably that the way in which you start your GUI Emacs does not involve setting that PATH value in its environment, ...
In conjunction with the assistance of the original poster in the comments above, here is the final solution:
(defun org-icalendar-open-ics-file (file)
(start-process "org-icalendar-open-ics-file-process" nil "open" "-a" "/Applications/Calendar.app" file))
(add-hook 'org-icalendar-after-save-hook 'org-icalendar-open-ics-file)
emacsclient has a -a option which lets you specify an alternate editor to use if there is not an emacs process with a running server.
So emacsclient -a emacs may do what you want.
The alternate editor can also be specified to emacsclient via the ALTERNATE_EDITOR environment variable.
As for which of EDITOR or VISUAL to set: EDITOR was traditionally used ...
It looks like you've run the exec-path-from-shell from a Tramp buffer, so when it runs the shell, it attempts to do its magic on the remote server and then set the environment variables in your local emacs instance. That's almost certainly not what you want, and it's not a case that exec-path-from-shell is designed for. It looks like it's Tramp or your Tramp ...
I improved @Lindydancer's answer in the following ways:
Inlined the sh-script-extra-font-lock-is-in-double-quoted-string function, as it was only used once
Escaping the variable works.
Numeric variables ($10, $1, etc) are highlighted.
Break for code
(defun sh-script-extra-font-lock-match-var-in-double-quoted-string (limit)
"Search for variables in ...
You can find out how your code is executed by checking ob-shell.el. As for your particular example, your code is passed to bash as stdin, something like the following
$ echo 'echo $VAR_DEFINED_IN_BASHRC' | bash
It will not work, you need the following instead
$ echo 'echo $VAR_DEFINED_IN_BASHRC' | bash -i
So you need to run bash interactively (-i) to ...
You can explicitly set which shell M-xshell uses by customizing explicit-shell-file-name
If your zsh config causes problems with shell you might try M-x term or ansi-term instead which may play better with your config.
If nothing quite works right, you could always use tmux or screen to flip between emacs and a real shell.