|This is how this post looks like. You can see an adict window by the side|
This is Acme. I hope you like this shade of yellow and this shade of blue. There's no way to change it without getting into the source code and recompiling. It may be sound odd, but I kind of like it. It's refreshing. In emacs and vim it is very easy to get a beautiful colour scheme (I use solarized-dark everywhere I can,) but this means you can choose. And choosing means a decision, with pros, cons and whatever. Just screw it and pick blue and yellow.
Pause: the file servers
acme/10/ is the directory associated to this text acme/10/addr is a file with an address position for text insertions acme/10/body is a file with the contents of the editing window (can't overwrite) acme/10/ctl is a "file" (socket-like) that allows you to send commands to the window acme/10/data is a file with the data of the editing window (can overwrite) acme/10/errors is a file with data spat by commands executed by this window acme/10/event is a "file" (socket-like) where you can read/write the editing session acme/10/tag is a file holding the contents of the tag (the menu above) acme/10/xdata is a file with the data (addr bound) of the editing window
Back into Acme
"Acme (\; , the peak, zenith, prime) denotes the best of something. Acme or ACME may also refer to: Acme Corporation, a fictional company in the cartoon world of Looney Tunes, ACME Detective Agency, a fictional detective agency from the Carmen Sandiego seri" "es of computer games and television shows, Acme (album), the sixth album by the Jon Spencer Blues Explosion, Acme Novelty... http://en.wikipedia.org/wiki/Acme"
On button clicking
;; Truncated, retrying in TCP mode.
"Acme is a text editor and graphical shell from the Plan 9 from Bell Labs operating system, designed and implemented by Rob Pike. It can use the sam command language. The design of the interface was influenced by Oberon. It is different from other editing " "environments in that it acts as a 9P server. A distinctive element of the user interface is mouse chording... http://en.wikipedia.org/wiki/Acme_(text_editor)"
Selections, regexes and other furry animals
Keyboard shortcutsThere are a few keyboard shortcuts, even if Acme is mouse-centric. Press Esc, and all text written since the last click is selected. In addition to this, we have the other standards:
C-U ‚Äì> Delete from cursor to start of line.
C-W ‚Äì> Delete word before the cursor.
C-H ‚Äì> Delete character before the cursor.
C-A ‚Äì> Move cursor to start of the line.
C-E ‚Äì> Move cursor to end of the line.
Nothing more, nothing less. Minimal, isn't it?
#!/bin/zsh #9indent echo "WinId is: " $winid echo -n "1,$" | 9p write acme/$winid/addr echo "Selected whole contents for overwriting with 'write'" 9p read acme/$winid/body | indent -st | 9p write acme/$winid/data
First is to check which is the ID of the window. When invoking a command, its environment has it in a variable, aptly named winid. To overwrite the contents of the file, we set the addr to the whole file with the selector 1,$. We do so by piping to 9p with the command write. 9p is the middleman, allowing us to read and write files in 9P servers, like the ones acme and other Plan9 programs offer. Finally we get the body, indent it (-st is the command to use stdin in indent) and pipe it to data. Done! This indents a well-formed C file as expected.
Add this file to your path and add 9indent to your tag. Ready to indent by middle-clicking.
A slightly more complex example is to generate the output of a Markdown file. The code is as follows:
#!/bin/zsh echo "WinId is: " $winid format=$(9p read acme/$winid/tag) echo "Tag is " $format echo "Format in tag" case $format in *"latex"* ) echo "latex ouput selected" format="latex" ;; *"groff-mm"* ) echo "groff-mm output selected" format="groff-mm" ;; *"odf"* ) echo "odf ouput selected" format="odf" ;; *"html"* ) echo "html output selected" format="html" ;; * ) echo "Unrecognized format, defaulting to html" format="html" ;; esac echo -n "1,$" | 9p write acme/$winid/addr echo "Selected whole contents for overwriting with 'write'" 9p read acme/$winid/body | peg-markdown --to=$format | 9p write acme/new/body echo "Wrote the html-markdowned version to a new buffer" last=$(9p ls acme | sort -g | tail -n 1) echo "Get last created buffer" echo -n "clean" | 9p write acme/$last/ctl echo -n "0,0" | 9p write acme/$last/addr echo -n "dot=addr" | 9p write acme/$last/ctl echo -n "show" | 9p write acme/$last/ctl echo "Moved to beginning"
Dirty, Clean, Put
That's all, folks (for now)
Below you can see another video with a simpler scripting: browsing reddit from the command line, inside acme. The Python code snippet that gets Reddit data is available in this gist: reddi.py