Greetings, Org hackers!

I noticed that `dot' source blocks do not work out of the box: C-c C-c
works but C-c ' uses the Fundamental mode, even with the Graphviz MELPA
package installed.

This is because the major mode for the Dot language is `graphviz-dot'
and not `dot'.  The attached patch improves the situation for the source
blocks defined as `#+BEGIN_SRC graphviz-dot', namely it makes C-c C-c
work with them.

P.S. As the next step, we could perhaps rename `ob-dot' to
`ob-graphviz-dot' and make `dot' the alias, not `graphviz-dot', so that
the officially documented `#+BEGIN_SRC dot' works out of the box too.

Rudy
>From 368a6625b8d812df35e4520e0a02a2e59e604d65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <rud...@adamkovic.org>
Date: Mon, 17 Feb 2025 21:06:32 +0100
Subject: [PATCH] ob-dot: Add `graphviz-dot' language alias

* lisp/ob-dot.el: ("graphviz-dot"): Add `graphviz-dot' language alias
so that the `graphviz-dot-mode' from MELPA works out of the box (when
the source block uses `graphviz-dot' for the language).
---
 lisp/ob-dot.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/ob-dot.el b/lisp/ob-dot.el
index da0183deb..59c87d839 100644
--- a/lisp/ob-dot.el
+++ b/lisp/ob-dot.el
@@ -95,6 +95,8 @@ This function is called by `org-babel-execute-src-block'."
   "Return an error because Dot does not support sessions."
   (error "Dot does not support sessions"))
 
+(org-babel-make-language-alias "graphviz-dot" "dot")
+
 (provide 'ob-dot)
 
 ;;; ob-dot.el ends here
-- 
2.39.5 (Apple Git-154)

-- 
"Genius is 1% inspiration and 99% perspiration."
--- Thomas Alva Edison, 1932

Rudolf Adamkovič <rud...@adamkovic.org> [he/him]
http://adamkovic.org

Reply via email to