by zelphirkalt · 4y ago · 0 comments
The table of "The layout of a data structure in the Jikes RVM" for example. Imagine, if suddenly there was a new attribute in one of the tables, which has a longer name than any of the previously existing ones. Great fun to manually widen the whole thing. With multiple cursors easily possible, but even then it sucks and there are other scenarios, where it gets much worse.
In Org mode I could imagine managing such a table and then copying it back into the code comment. And maybe Emacs' ASCII art drawing mode (forgot its name) would help me with other shapes, but drawing something like an ERM or so is still tedious.
Maybe those ASCII art diagrams could be created, when the design is already finished.
https://dot-to-ascii.ggerganov.com
I generate the ASCII graph and then paste it in the comments together with a link to the service. This way I can go back later and update it if needed:
/*
Link: https://dot-to-ascii.ggerganov.com/?src_hash=476410d3
0.6
┌─────────────────────────┐
▼ │
┌───┐ 0.8 ┌───┐ 0.1 ┌───┐ 0.7 ┌───┐ 0.2 ┌───┐
│ d │ ─────▶ │ │ ◀───── │ e │ ─────▶ │ a │ ─────▶ │ b │
└───┘ │ c │ └───┘ └───┘ └───┘
│ │ 0.4 │
│ │ ◀──────────────────────────────────┘
└───┘
*/I'm using Noto Sans Mono as monospace font. Broken with Iosevka as well, works with Dejavu Sans Mono.
That said, it's pretty cool, bookmarked.
EDIT: weird now I'm looking at my comment from an iPhone and the arrow is rendered with the arrow emoji. Have I found an exploit to embed emojis in HN comments?!
Apple emoji font, in addition to emojis, also includes other characters like numbers, arrows, and "trademark" (tm), "registered" (r), and "copyright" (c) symbols, so that's why.
Not having integrated built-in tools to properly maintain this type of representation is a missed opportunity.
IDEs went the copy/paste and word replace route, and the few diagram and table drawing tools in ASCII are often in separate applications, reducing their usefulness.
Then the system text renderer can be responsible for drawing these diagrams, and they can be embedded anywhere in text.
It would also have the side benefit of letting people draw their own emojis, rather than waiting some time from months to never to have their suggestions included in the next Unicode release.
Leave plaintext to be as plain as possible. Emoji were already a bad compromise made to get Japanese encodings to sort-of work. Leave markup to general markup languages. Don't make unicode even more convoluted.
So you'd use a mouse to "draw" a line (if it's horizontal or vertical), and it'd take only 4 "draw line" to make a box, and turn on 'insert' mode to type in the text inside the box.
Drawing diagonal lines is a bit more involved, but not too hard either. Adding a cell to an ascii table is also pretty easy using this same method.
However, it is preferable to have the diagram in svg tho. The svg file could even be separate from the comments, but just referenced.
I cannot find any information about an IDE which does this.
M-x picture-mode
https://www.gnu.org/software/emacs/manual/html_node/emacs/Pi...
Further enhanced by M-x artist-mode (also included with Emacs):
Also I think that modeling languages like Mermaid are a nice alternative for small to medium diagrams. But these wont work in code comments. But they can be fitted into a Markdown file.