NW C-c ` | N C-c <UP> | NE C-c ' |
W C-c <LEFT> | E C-c <RIGHT> | |
SW C-c / | S C-c <DOWN> | SE C-c \ |
The key pressed determines your typing direction; ie. type C-c ' and the some '/'-characters will get you a line to the upper-right (north-east).
This will be only available after you activate picture-mode, (M-x picture-mode). Now, because picture-mode is often used in combination with another (say, you want to draw a nice little ascii-art diagram in an e-mail), you can activate picture mode, do your drawing action, and then go back to the previous mode with C-c C-c. There are some more interesting commands; please see the emacs reference manual for details.
ditaa
Now, after you've written all these fine ascii-art diagrams, you might want to make them a bit more flashy for inclusing in another document. For that, there is Ditaa, which I learned from my dear colleague Stefan. Ditaa is a GPL Java program, that takes an ascii-art diagram, and turns it into something flashy. See below for an example; we take some simple ascii art, and ditaa turns it into the nice picture on the right:
Ditaa is a bit slow, but the results are quite nice. You could run ditaa from within emacs with something like:
(setq ditaa-cmd "java -jar <path-to-ditaa>ditaa0_6b.jar")
(defun djcb-ditaa-generate ()
(interactive)
(shell-command
(concat ditaa-cmd " " buffer-file-name)))
after which you can generate those pictures with M-x djcb-ditaa-generate. This is rather primitive of course. For example, it should be possible to integrate this with DocView (screencast), which is to be part of emacs 23. But this is left as an exercise to the reader...
artist-mode
There's another mode for emacs, called artist-mode, which is better suited when you want to express your emotions through art. It must be said, however, that it's often quicker to create some figures in artist-mode than in picture-mode; that's not really a problem, as you can switch between the two. There's a nice screen cast of someone using artist-mode to draw a linked-list in a code comment.
For artist-mode, the most important thing to remember is Shift + middle-click on your mouse to change the tool you are using. And see the picture, which is my interpretation of naïve art. My lack of talent, however, cannot be blaimed on artist-mode, I'm afraid...
No comments:
Post a Comment