forked from mirrors/org-mode
org-src: Use `sh-mode' for all the shells it can handle
* lisp/org-src.el (org-src--get-known-shells): New helper function extracting known shells from `sh-ancestor-alist' (org-src-lang-modes): Update the value Link: https://orgmode.org/list/CAMbmz5ntkOHMiZG4EbNAks9ob-0ahnciCfHQ9LQmJoci0+i7fg@mail.gmail.com
This commit is contained in:
parent
cfe5e01e14
commit
26ef5e3e5b
|
@ -39,6 +39,7 @@
|
||||||
(require 'org-macs)
|
(require 'org-macs)
|
||||||
(require 'org-compat)
|
(require 'org-compat)
|
||||||
(require 'org-keys)
|
(require 'org-keys)
|
||||||
|
(require 'sh-script)
|
||||||
|
|
||||||
(declare-function org--get-expected-indentation "org" (element contentsp))
|
(declare-function org--get-expected-indentation "org" (element contentsp))
|
||||||
(declare-function org-mode "org" ())
|
(declare-function org-mode "org" ())
|
||||||
|
@ -194,11 +195,17 @@ You may want to use this hook for example to turn off `outline-minor-mode'
|
||||||
or similar things which you want to have when editing a source code file,
|
or similar things which you want to have when editing a source code file,
|
||||||
but which mess up the display of a snippet in Org exported files.")
|
but which mess up the display of a snippet in Org exported files.")
|
||||||
|
|
||||||
|
(defun org-src--get-known-shells ()
|
||||||
|
"List all the shells in `sh-ancestor-alist' for `org-src-lang-modes'.
|
||||||
|
The shells are associated with `sh-mode'."
|
||||||
|
(mapcar
|
||||||
|
(lambda (shell) (cons (symbol-name shell) 'sh))
|
||||||
|
(delete-dups (flatten-tree sh-ancestor-alist))))
|
||||||
|
|
||||||
(defcustom org-src-lang-modes
|
(defcustom org-src-lang-modes
|
||||||
'(("C" . c)
|
`(("C" . c)
|
||||||
("C++" . c++)
|
("C++" . c++)
|
||||||
("asymptote" . asy)
|
("asymptote" . asy)
|
||||||
("bash" . sh)
|
|
||||||
("beamer" . latex)
|
("beamer" . latex)
|
||||||
("calc" . fundamental)
|
("calc" . fundamental)
|
||||||
("cpp" . c++)
|
("cpp" . c++)
|
||||||
|
@ -208,9 +215,10 @@ but which mess up the display of a snippet in Org exported files.")
|
||||||
("elisp" . emacs-lisp)
|
("elisp" . emacs-lisp)
|
||||||
("ocaml" . tuareg)
|
("ocaml" . tuareg)
|
||||||
("screen" . shell-script)
|
("screen" . shell-script)
|
||||||
("shell" . sh)
|
|
||||||
("sqlite" . sql)
|
("sqlite" . sql)
|
||||||
("toml" . conf-toml))
|
("toml" . conf-toml)
|
||||||
|
("shell" . sh)
|
||||||
|
,@(org-src--get-known-shells))
|
||||||
"Alist mapping languages to their major mode.
|
"Alist mapping languages to their major mode.
|
||||||
|
|
||||||
The key is the language name. The value is the mode name, as
|
The key is the language name. The value is the mode name, as
|
||||||
|
@ -221,7 +229,7 @@ not the case, this variable provides a way to simplify things on
|
||||||
the user side. For example, there is no `ocaml-mode' in Emacs,
|
the user side. For example, there is no `ocaml-mode' in Emacs,
|
||||||
but the mode to use is `tuareg-mode'."
|
but the mode to use is `tuareg-mode'."
|
||||||
:group 'org-edit-structure
|
:group 'org-edit-structure
|
||||||
:package-version '(Org . "9.6")
|
:package-version '(Org . "9.7")
|
||||||
:type '(repeat
|
:type '(repeat
|
||||||
(cons
|
(cons
|
||||||
(string "Language name")
|
(string "Language name")
|
||||||
|
|
Loading…
Reference in New Issue