Ihor Radchenko <yanta...@posteo.net> writes: > They work. Fundamental mode is usable, isn't it?
As usable as any other language: no syntax highlighting, no correct indentation, no compilation and run, no code completion, etc. Instead of theorizing, let me tell you my experience, as a user of the Org Mode and Graphviz: I have had the Graphviz Dot mode installed for a long time and only now noticed Org does not use it. I took it for granted that Org would does its best to enable the right major mode, for that is the case with all the other languages I use. Turns out, it does not, and I missed out on all the great features of the Graphviz Dot mode. 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 (2) Write `#+begin_src graphviz-dot': - keep all benefits of the specialized major mode - lose all benefits or Org Babel: org-babel-execute-src-block: No org-babel-execute function for graphviz-dot! (3) Keep changing between `dot' and `graphviz-dot': This is the best option for an average user, currently. Note that options (2) and (3) require the user to "know the trick". > 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. > 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? > 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. >> 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. > > But the official name is "DOT language" isn't it? > I see no reason for renaming. 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: #+begin_src dot :cmd circo :file cyclopentane.svg graph { bgcolor = transparent node [shape = circle] { node [label = "C" style = filled] c1 c2 c3 c4 c5 } { node [label = "H"] h11 h12 h21 h22 h31 h32 h41 h42 h51 h52 } c1 -- c2 -- c3 -- c4 -- c5 -- c1 h11 -- c1 -- h12 h21 -- c2 -- h22 h31 -- c3 -- h32 h41 -- c4 -- h42 h51 -- c5 -- h52 } #+end_src Calling the source block `dot' is nonsense, as the language is `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. Rudy -- "If you're thinking without writing, you only think you're thinking." --- Leslie Lamport Rudolf Adamkovič <rud...@adamkovic.org> [he/him] http://adamkovic.org