Rudolf Adamkovič <rud...@adamkovic.org> writes: > A user of the Org Mode and Graphviz has currently 3 options: > > (1) Write `#+begin_src dot': > > - lose all benefits of the specialized major mode > - keep all benefits of Org Babel
There is an option to customize `org-src-lang-modes'. > (2) Write `#+begin_src graphviz-dot': > ... > Calling the source block `dot' is nonsense, as the language is `circo'. But isn't graphviz-dot nonsense as well then? >> In contrast, if you force using graphwiz-dot-mode from MELPA, and it is >> not installed, there will be an error. > > Is this not the default behavior in Org Babel? > > e.g. Lua or R are editable in the Fundamental mode as Dot is. AFAIK, no. By default, when you try C-c ' on Lua/R in clean Emacs, you will just get an error (user error, more specifically). This is different for dot because dot has a specific entry in `org-src-lang-modes' - use fundamental-mode. It is really not consistent with other defaults, but that's what we have historically. >> Maybe we should solve this problem more generally, and universally >> change babel to try deriving the major mode first and fall back to >> fundamental-mode if the major mode is not available. > > That would be great. In fact, it sounds like a perfect job for Org > experts like you. :) > > But even if we had this functionality, we still need an alias for > `graphviz-dot', right? Otherwise, the specialized mode would not > activate. So, perhaps my patch is a step in the right direction? Not sure. As I said, we can achieve the same via `org-src-lang-modes'. The only problem is the existing fundamental-mode association. Which is why I am thinking to change the defaults about how the major mode is derived from the src block lang. Either as global default or by extending `org-src-lang-modes' to accept multiple major modes as allowed value. >> Why not simply graphviz? > > I named it after the specialized major mode, to make it work out of the > box. But, as I explain below, `graphviz' would be the best name for > these source blocks. I would not object making "graphviz" an alias to "dot" lang name for babel. > In fact, the best name would be `ob-graphviz', and the reason is as > follows. While the `dot' source blocks default to the Dot language, > they can use all the other Graphviz languages as well. For example, > below is my drawing of a molecule with a hydrocarbon ring, which is > easier done with Circo: > ... > Instead, we should write `#+begin_src graphviz :cmd circo' and and call > the Babel package `ob-graphviz`. It just happens that `:cmd' defaults > to `dot'. And that is fine, as Dot is the most popular Graphviz > language. I think that the least breaking course of action would be creating ob-graphviz.el that simply loads ob-dot. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>