aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-23 03:50:53 -0500
committerCraig Jennings <c@cjennings.net>2026-05-23 03:50:53 -0500
commitf96c7052f050efadc53b1a119eacc79e32ddb948 (patch)
tree0c158ab54e4d4f3375cf808a0bd0eb638e21662c
parentf530f06949e19d772bb65f68d93b9f951932fc12 (diff)
downloaddotemacs-f96c7052f050efadc53b1a119eacc79e32ddb948.tar.gz
dotemacs-f96c7052f050efadc53b1a119eacc79e32ddb948.zip
fix(org-babel): correct java structure-template language name
The `<java` Org Tempo template expanded to "#+begin_src javas", a typo for "java", so a Java source block came out tagged with a bogus language. I fixed the entry to "src java" and added a test that pins seven common aliases (bash, zsh, el, py, json, yaml, java) to their intended src language names, so the next typo in the template list gets caught.
-rw-r--r--modules/org-babel-config.el2
-rw-r--r--tests/test-org-babel-config-structure-templates.el32
2 files changed, 33 insertions, 1 deletions
diff --git a/modules/org-babel-config.el b/modules/org-babel-config.el
index bfa31d8f..2c52ae46 100644
--- a/modules/org-babel-config.el
+++ b/modules/org-babel-config.el
@@ -128,7 +128,7 @@ FLAG is the raw prefix argument passed interactively."
(add-to-list 'org-structure-template-alist '("dot" . "src dot :file temp.png :cmdline -Kdot -Tpng"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("js" . "src javascript"))
- (add-to-list 'org-structure-template-alist '("java" . "src javas"))
+ (add-to-list 'org-structure-template-alist '("java" . "src java"))
(add-to-list 'org-structure-template-alist '("json" . "src json"))
(add-to-list 'org-structure-template-alist '("latex" . "src latex"))
(add-to-list 'org-structure-template-alist '("py" . "src python"))
diff --git a/tests/test-org-babel-config-structure-templates.el b/tests/test-org-babel-config-structure-templates.el
new file mode 100644
index 00000000..ccd0a299
--- /dev/null
+++ b/tests/test-org-babel-config-structure-templates.el
@@ -0,0 +1,32 @@
+;;; test-org-babel-config-structure-templates.el --- Org Tempo template tests -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; org-babel-config.el registers Org Tempo structure templates (e.g. `<el'
+;; expands to an emacs-lisp src block) by adding entries to
+;; `org-structure-template-alist' in org-tempo's :config. A typo in the
+;; value expands to a bogus language name (a `<java' that produced
+;; "#+begin_src javas"). Requiring the module then org-tempo fires that
+;; config in batch, so this test pins the alias-to-language mapping for the
+;; common aliases.
+
+;;; Code:
+
+(require 'ert)
+(require 'org)
+(require 'ob-core)
+(require 'org-babel-config)
+(require 'org-tempo)
+
+(ert-deftest test-org-babel-structure-templates-map-to-languages ()
+ "Normal: each common alias maps to its intended src language name."
+ (dolist (pair '(("bash" . "src bash")
+ ("zsh" . "src zsh")
+ ("el" . "src emacs-lisp")
+ ("py" . "src python")
+ ("json" . "src json")
+ ("yaml" . "src yaml")
+ ("java" . "src java")))
+ (should (equal (assoc (car pair) org-structure-template-alist) pair))))
+
+(provide 'test-org-babel-config-structure-templates)
+;;; test-org-babel-config-structure-templates.el ends here