[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug: ("bash" . sh) in default value of org-src-lang-modes
From: |
Sebastian Miele |
Subject: |
Bug: ("bash" . sh) in default value of org-src-lang-modes |
Date: |
Sat, 27 Mar 2021 16:04:58 +0100 |
User-agent: |
mu4e 1.4.15; emacs 27.2 |
Hello!
The default value of org-src-lang-modes contains ("bash" . sh), meaning
that for bash src blocks sh-mode gets used.
sh-mode supports many different languages (bash, zsh, dash, ...).
Often, when opening a file for which sh-mode gets activated, there is
enough information for sh-mode to determine the language that actually
is used in the file, e.g., by a shebang, or by the suffix of the
filename.
However, that usually does not work with Org src blocks. When sh-mode
has no clues, it in effect always uses the language determined by the
SHELL environment variable (at least on POSIX-conformant systems). If
that is not something like /bin/bash then sh-mode is not a bash mode.
E.g., with SHELL=/bin/zsh opening an edit buffer for
#+BEGIN_SRC bash
#+END_SRC
yields a buffer with the buffer-local variable sh-shell set to zsh
instead of bash, i.e., sh-shell is a zsh mode.
This can be fixed by defining something like
(defun org-babel-bash-mode ()
(sh-mode)
(sh-set-shell "bash"))
and having ("bash" . org-babel-bash) in the default value of
org-src-lang-mode.
Best wishes
Sebastian
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bug: ("bash" . sh) in default value of org-src-lang-modes,
Sebastian Miele <=