Hobix uses YAML for its entry format, which is all well and good, but it introduces a small problem: syntax highlighting and indentation don’t work well in Emacs. See, YAML is nice in that it’s all free form and human readable/writable, but it makes it hard to figure out what the indentation should be for a given bit of YAML.
Take the following bit of YAML:
--- !hobix.com,2004/entry author: [jterk] created: 2006-07-13 20:18:02 -04:00 content: > Hobix uses YAML for its entry format. _
Imagine, if you will, that the cursor is sitting where the _
is, and I hit the TAB
key. In generic YAML, with no specification of how this particular data should be layed out, Emacs has no way of knowing what I want to do next. I might want to continue the block of text corresponding to the content
tag, which would use the same indentation as the line beginning with “Hobix”. Or I could want to start a new tag, in which case the indentation of the line would be the same as that of the content
tag.
Even after I’ve typed the next thing, and Emacs can figure out if it’s regular text or a new tag, it still can’t indent. I could be making a compound data type for content
. Yeesh!
To add insult to injury, tag identifiers (those guys like author:
) can have white space as part of the tag. In fact, as far as I can see, there isn’t much that can’t be part of a YAML tag. This particular little tidbit makes syntax highlighting more or less hit or miss. But that might just be ignorance on my part.
I think, however, that I have a solution. I can impose an insufferable dictatorship on hobix-mode
(when I finally get around to it): if the mode knows that only a few specific tags will show up at the beginning of the file and that after that it’s all gravy, things will be much easier. It’s like I’ll be letting the emacs mode know what the schema is beforehand, or something. Imagine that! There’s still a small problem of in line html, and the (for now, anyways) Textile syntax that I’ve complained about. Indentation for those isn’t quite so cut and dry … I wonder if I can detect what sort of “region” the cursor is in from hobix-mode and set a mode for that region? Hmm.