commit c2271ba672af2828acfcc4db2ade145b08e3a1aa Author: Ev Bogdanov Date: Thu Jan 26 19:29:57 2017 +0300 acme diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ccc9fd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.DS_Store \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f9dfe92 --- /dev/null +++ b/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2017, Ev Bogdanov +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6887650 --- /dev/null +++ b/README.md @@ -0,0 +1,189 @@ +# Acme text editor + +![Acme text editor](./acme.png) + +Acme is a Zen-style text editor. + +Using Acme you sacrifice: +- configuration files +- themes +- syntax highlighting +- autocompletion +- specific language support +- *your favourite Vim/Emacs/Sublime feature* :trollface: + +What you gain is that instead of spending too much time configuring your editor, you will focus on actual working. + +The killer feature of Acme is how it integrates into surrounding system. Acme is not trying to be a complete environment by itself. Acme acts as a glue which links together other programs and tools. With Acme the OS becomes your IDE. + +## Install + +### FreeBSD +``` +pkg install plan9port +``` + +### macOS +``` +brew install plan9port +``` + +### Debian +``` +sudo apt-get install gcc libx11-dev libxt-dev libxext-dev libfontconfig1-dev +git clone https://github.com/9fans/plan9port $HOME/plan9 +cd $HOME/plan9/plan9port +./INSTALL -r $HOME/plan9 +``` + +## Environment setup + +### Bash +``` +export PLAN9="/path/to/plan9port" +export PATH="$PATH:$PLAN9/bin" +``` + +### Tcsh +``` +setenv PLAN9 /path/to/plan9port +set path = ($path $PLAN9/bin) +``` + +## Font + +Run font server: +``` +fontsrv +``` + +In case it's not installed: +``` +cd /path/to/plan9port/src/cmd/fontsrv/ +9 mk install +``` + +Have a look at all available fonts: +``` +9p ls font +``` + +Try one of them: +``` +acme -f /mnt/font/'Droid Sans Mono'/13a/font +``` + +## Run + +I spawn Acme by running `a` script. + +## Scripts + +Who is who in **bin** directory: + +- `+ EXP` lisp-style polish notation calculator; example: `+ '(+ 1 2 3)'` +- `F`, `lne`, `lpe`, `ne`, `pe` perl one-liners shortcuts +- `a` start Acme +- `a+ SYMBOL` alignment (default is fat comma: `|a+ '=>'`, erlang proplist: `|a+ ' '`) +- `c+ SYMBOL` add comment (perl: `|c+` or `|c+ '#'`, erlang: `|c+ %`, js: `|c+ //`) +- `c- SYMBOL` delete comment (perl/erlang: `|c-`, js: `|c- //`) +- `cc+` snake_case to CamelCase +- `cc-` CamelCase to snake_case +- `d` works like `Edit , d` +- `eman MODULE` shortcut for `erl -man MODULE` (displays the manual page for the Erlang module MODULE) +- `g+ WHAT` recursively grep current directory +- `git+ MESSAGE` git: commit and push to master +- `h+` transform line to heading +- `hg+ MESSAGE` hg: commit and push to master +- `html+` html boilerplate +- `lc+` to lowercase +- `nobs+` is taken from plan9 `nobs` (it removes all backspace characters and the characters that precede them) +- `perl+` perl boilerplate (shebang, `use strict` etc) +- `put+ BROWSER` regular `Put` plus reload active tab in browser: `ff` | `ch` | `sa` +- `s-` remove leading whitespace +- `s2t N_SPACES` spaces to tabs (default: 4 spaces to 1 tab) +- `t2s N_SPACES` tabs to spaces (default: 1 tab to 4 spaces) +- `t+` add tab +- `t-` delete tab +- `uc+` to uppercase +- `w+ WIDTH` (hello, `fmt -w WIDTH`) + +Put these guys in your **$path**. + +## Random notes + +- `Edit =` find out the current line number +- `:13` goto 13th line +- `:0` goto file beginning +- `:$` goto file end +- `:0,$` or `:,` or `Edit ,` select the whole file +- `:1,5` select lines 1..5 +- `Edit , d` clear window +- `Edit , < echo hello world` replace window body with some text +- `Edit , < erl -man maps` replace window body with erlang manual +- `Edit , s/text/TEXT/g` or `Edit , | perl -pe 's/text/TEXT/g'` global replace +- `$%` or `$samfile` current file name +- `$winid` current window id +- `echo some text | 9p write acme/$winid/body` append to the end of current window +- keyboard shortcuts: + - `ctrl-u` delete from cursor to start of line + - `ctrl-w` delete word before the cursor + - `ctrl-h` delete character before the cursor + - `ctrl-a` move cursor to start of the line + - `ctrl-e` move cursor to end of the line + - `ctrl-i` tab + - `ctrl-j` enter + - `ctrl-f` filepath autocompletion + - `fn-*left arrow*` go home (macOS) + - `fn-*right arrow*` go end (macOS) +- `:foobar` search forward +- `:-/foobar` search backwards +- press `esc` to select the last typed text +- press `esc` again to delete any selected text +- `Font` switch between fonts +- `:/^hel` regexp match: lines starting with 'hel' +- `:/lo\n/` regexp match: lines ending with 'lo' +- `:/^b/,/^e/` regexp match: lines between starting with 'b' and starting with 'e' +- `Dump` write the state of acme to the file +- `Load` restore from the dump +- `Edit , > perl` pipe window body through perl interpreter (better than `perl -e ...`) + +## Sam commands + +- `Edit +/hello/` search 'hello' forward +- `Edit -/hello/` search 'hello' backward +- `Edit , > wc -l` count lines in file +- `Edit , | sort` sort lines +- `Edit 3,5p` print lines 3..5 in new window +- `Edit 3,5 |uc+` lines 3..5 upper cased +- `Edit 3,5 s/HE/he/g` replace on 3..5 lines only +- `Edit 2 d` delete second line +- `Edit 2 a/new\n/` append text after 2nd line +- `Edit 2 i/new\n/` insert text before 2nd line + +## Cut / Copy selection to a file + +- select some text +- cut: `| sed '' > file.txt` +- copy: `> sed '' > file.txt` +- pipe selection to a file: `> awk '{ print(toupper($1)) }' | sort | nl > file.txt` + +## Other Plan9 goodies + +- `win` start shell in a new window +- `page FILE` view graphics files +- `web URL` open url in your browser + +## Resources + +- [Acme homepage](http://acme.cat-v.org/) +- [A Tour of the Acme Editor](http://www.youtube.com/watch?v=dP1xVpMPn8M) +- [Plan 9 Acme Intro](http://www.youtube.com/watch?v=dopu3ZtdCsg) +- [On using Acme as a day-to-day text editor](http://jlouisramblings.blogspot.ru/2013/04/acme-as-editor_20.html) +- [Let’s Try Acme](http://echosa.github.io/blog/categories/acme/) +- [Plan 9 configuration](https://github.com/jlouis/plan9-setup) +- [Extensibility in the Acme text editor](http://www.mostlymaths.net/2013/03/extensibility-programming-acme-text-editor.html) +- [Plan 9 from User Space](https://github.com/9fans/plan9port) +- [Community: 9fans](http://plan9.bell-labs.com/wiki/plan9/9fans/index.html) +- [Google group: plan9port-dev](https://groups.google.com/forum/#forum/plan9port-dev) +- [Plan 9 and FreeBSD](https://forums.freebsd.org/threads/rio.29736/) diff --git a/acme.png b/acme.png new file mode 100644 index 0000000..7272852 Binary files /dev/null and b/acme.png differ diff --git a/bin/+ b/bin/+ new file mode 100755 index 0000000..c9eddaa --- /dev/null +++ b/bin/+ @@ -0,0 +1,33 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use feature 'say'; + +sub do_calc { + my ($op, $acc, @args) = @_; + for my $arg (@args) { + $acc += $arg if $op eq '+'; + $acc -= $arg if $op eq '-'; + $acc *= $arg if $op eq '*'; + $acc /= $arg if $op eq '/'; + } + return $acc; +} + +sub calc { + my $exp = shift; + die 'oops!' unless $exp =~ m/\(([\+-\/\*])([0-9 \.-]+)\)/; + return do_calc($1, split ' ', $2); +} + +sub pn { + my $exp = shift; + my $old = $exp; + $exp =~ s/(\([\+-\/\*] [0-9 \.-]+\))/calc($1)/eg; + die "oops! i'm stuck" if $exp eq $old; + return $exp if $exp =~ m/^[0-9 \.-]+$/; + return pn($exp); +} + +say pn($ARGV[0]); diff --git a/bin/F b/bin/F new file mode 100755 index 0000000..b748162 --- /dev/null +++ b/bin/F @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +if [[ $# -eq 1 ]]; then + perl -C -Mutf8 -lanE "$1" + +elif [[ $# -eq 2 ]]; then + if [[ -f "$2" ]]; then + perl -C -Mutf8 -lanE "$1" "$2" + else + perl -C -Mutf8 -F''"$1"'' -lanE "$2" + fi + +elif [[ $# -eq 3 && -f "$3" ]]; then + perl -C -Mutf8 -F''"$1"'' -lanE "$2" "$3" +fi diff --git a/bin/a b/bin/a new file mode 100755 index 0000000..9d59211 --- /dev/null +++ b/bin/a @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +export SHELL="$PLAN9/bin/rc" +export acmeshell="$PLAN9/bin/rc" +export BROWSER=safari +export tabstop=4 +export TERM=dumb +export PAGER=nobs + +if [ "$(pgrep plumber)" ]; then + echo plumber is running +else + echo starting plumber + plumber + cat "$HOME/acme/plumbing" "$PLAN9/plumb/basic" | 9p write plumb/rules +fi + +acme -a -f /mnt/font/Menlo-Regular/12a/font $1 diff --git a/bin/a+ b/bin/a+ new file mode 100755 index 0000000..acb02f4 --- /dev/null +++ b/bin/a+ @@ -0,0 +1,38 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use utf8; +use open qw(:std :utf8); + +my ($d) = @ARGV; +$d = "=>" unless $d; + +my $max = 0; +my @ls = (); +my @rs = (); +my $i = 1; +my $t = ""; + +while () { + if ($i == 1) { + $t = $1 if /^(\s+)/; + $i += 1; + } + $_ =~ s/^\s+|\s+$//g; + my @ls_rs = split $d, $_, 2; + my $len = length $ls_rs[0]; + $max = $len if $len > $max; + push @ls, $ls_rs[0]; + push @rs, $ls_rs[1]; +} + +for (my $i = 0; $i < @ls; $i += 1) { + my $l = $ls[$i]; + my $r = $rs[$i]; + my $n = $max - length $l; + my $s = " " x $n; + $l .= $s; + print $t, $l, $d, $r; + print "\n" unless $i + 1 == @ls; +} diff --git a/bin/c+ b/bin/c+ new file mode 100755 index 0000000..c4d78a3 --- /dev/null +++ b/bin/c+ @@ -0,0 +1,10 @@ +#!/usr/bin/env perl + +my ($symbol) = @ARGV; + +# default: | c+ '#' +$symbol = '#' unless $symbol; + +while () { + print "$symbol$_"; +} diff --git a/bin/c- b/bin/c- new file mode 100755 index 0000000..58a423d --- /dev/null +++ b/bin/c- @@ -0,0 +1,12 @@ +#!/usr/bin/env perl + +# default: 1 symbol comment: #, % +# need ARGV for comments like this: // + +my ($symbol) = @ARGV; + +my $offset = $symbol ? length $symbol : 1; + +while () { + print substr $_, $offset; +} diff --git a/bin/cc+ b/bin/cc+ new file mode 100755 index 0000000..a7db02c --- /dev/null +++ b/bin/cc+ @@ -0,0 +1,5 @@ +#!/usr/bin/env perl + +while () { + print join "", map { ucfirst $_ } (split "_", $_); +} diff --git a/bin/cc- b/bin/cc- new file mode 100755 index 0000000..3b45301 --- /dev/null +++ b/bin/cc- @@ -0,0 +1,7 @@ +#!/usr/bin/env perl + +while () { + s/([A-Z]+)([A-Z][a-z])/$1_$2/g; + s/([a-z\d])([A-Z])/$1_$2/g; + print lc; +} diff --git a/bin/d b/bin/d new file mode 100755 index 0000000..d290104 --- /dev/null +++ b/bin/d @@ -0,0 +1,5 @@ +#!/usr/bin/env perl + +open FH, "| 9p write acme/$ENV{winid}/addr"; +print FH ","; +system "9p write acme/$ENV{winid}/data + + + + title + + + + + + + +HTML diff --git a/bin/lc+ b/bin/lc+ new file mode 100755 index 0000000..8ca6911 --- /dev/null +++ b/bin/lc+ @@ -0,0 +1,8 @@ +#!/usr/bin/env perl + +use utf8; +use open qw(:std :utf8); + +while (<>) { + print lc $_; +} diff --git a/bin/lne b/bin/lne new file mode 100755 index 0000000..35f79e5 --- /dev/null +++ b/bin/lne @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +perl -C -Mutf8 -lnE "$@" diff --git a/bin/lpe b/bin/lpe new file mode 100755 index 0000000..09d671b --- /dev/null +++ b/bin/lpe @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +perl -C -Mutf8 -lpE "$@" diff --git a/bin/ne b/bin/ne new file mode 100755 index 0000000..02b1223 --- /dev/null +++ b/bin/ne @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +perl -C -Mutf8 -nE "$@" diff --git a/bin/nobs+ b/bin/nobs+ new file mode 100755 index 0000000..241a964 --- /dev/null +++ b/bin/nobs+ @@ -0,0 +1,3 @@ +#!/bin/sh + +sed 's/.//g' "$@" diff --git a/bin/pe b/bin/pe new file mode 100755 index 0000000..93ddc38 --- /dev/null +++ b/bin/pe @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +perl -C -Mutf8 -pE "$@" diff --git a/bin/perl+ b/bin/perl+ new file mode 100755 index 0000000..3007514 --- /dev/null +++ b/bin/perl+ @@ -0,0 +1,19 @@ +#!/usr/bin/env perl + +$template = <<'TMP'; +#!/usr/bin/env perl + +use strict; +use warnings; +use feature 'say'; +use experimental 'signatures'; + +sub main { + +} + +main(); + +TMP + +print $template; diff --git a/bin/put+ b/bin/put+ new file mode 100755 index 0000000..a0eda31 --- /dev/null +++ b/bin/put+ @@ -0,0 +1,72 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +## USAGE +## ----------------------------------------------------------------------------- + +## firefox: +## put+ ff +## chrome: +## put+ ch +## safari: +## put+ sa + +## DATA +## ----------------------------------------------------------------------------- + +use constant FIREFOX => 'ff'; +use constant CHROME => 'ch'; +use constant SAFARI => 'sa'; + +my $browser = $ARGV[0] || CHROME; +my $osascript; + +## ACME 'Put' +## ----------------------------------------------------------------------------- + +open my $fh, "| 9p write acme/$ENV{winid}/ctl"; +print $fh "put\n"; +close $fh; + +## FIREFOX SCRIPT (SADLY, IT'S FULL OF BUGS) +## ----------------------------------------------------------------------------- + +if ($browser eq FIREFOX) { + $osascript = 'tell application "Firefox" + activate + delay 2 + tell application "System Events" + keystroke "r" using command down + end tell + end tell'; +} + +## CHROME SCRIPT +## ----------------------------------------------------------------------------- + +if ($browser eq CHROME) { + ## wait for server update + sleep 2; + + $osascript = 'tell application "Google Chrome" to reload active tab of window 1'; +} + +## SAFARI SCRIPT +## ----------------------------------------------------------------------------- + +if ($browser eq SAFARI) { + ## also wait for server update + sleep 2; + + $osascript = 'tell application "Safari" + set docUrl to URL of document 1 + set URL of document 1 to docUrl + end tell'; +} + +## RUN SCRIPT +## ----------------------------------------------------------------------------- + +system "osascript -e '$osascript'"; diff --git a/bin/s- b/bin/s- new file mode 100755 index 0000000..992aa64 --- /dev/null +++ b/bin/s- @@ -0,0 +1,10 @@ +#!/usr/bin/env perl + +while (<>) { + if ($_ =~ m/^\s+$/) { + print "\n"; + } else { + $_ =~ s/^\s+//; + print $_; + } +} diff --git a/bin/s2t b/bin/s2t new file mode 100755 index 0000000..3237780 --- /dev/null +++ b/bin/s2t @@ -0,0 +1,19 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my $N_SPACES = $ARGV[0] || 4; + +while (my $line = ) { + # Skip empty lines + print "\n" and next if $line !~ m/\S/; + + $line =~ m/^(\s*)(.+)$/; + my $n_spaces = length($1); + my $n_tabs = ($n_spaces > 0 and $n_spaces < $N_SPACES) + ? 1 + : int($n_spaces / $N_SPACES); + + print "\t" x $n_tabs . "$2\n"; +} diff --git a/bin/t+ b/bin/t+ new file mode 100755 index 0000000..e55d508 --- /dev/null +++ b/bin/t+ @@ -0,0 +1,5 @@ +#!/usr/bin/env perl + +while (<>) { + print "\t$_"; +} diff --git a/bin/t- b/bin/t- new file mode 100755 index 0000000..9a4f47f --- /dev/null +++ b/bin/t- @@ -0,0 +1,6 @@ +#!/usr/bin/env perl + +while (<>) { + $_ =~ s/^\t//; + print $_; +} diff --git a/bin/t2s b/bin/t2s new file mode 100755 index 0000000..aa21164 --- /dev/null +++ b/bin/t2s @@ -0,0 +1,17 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my $N_SPACES = $ARGV[0] || 4; + +while (my $line = ) { + # Skip empty lines + print "\n" and next if $line !~ m/\S/; + + $line =~ m/^(\t*)(.+)$/; + my $n_tabs = length($1); + my $n_spaces = $n_tabs * $N_SPACES; + + print ' ' x $n_spaces . "$2\n"; +} diff --git a/bin/uc+ b/bin/uc+ new file mode 100755 index 0000000..daa2bec --- /dev/null +++ b/bin/uc+ @@ -0,0 +1,8 @@ +#!/usr/bin/env perl + +use utf8; +use open qw(:std :utf8); + +while (<>) { + print uc $_; +} diff --git a/bin/w+ b/bin/w+ new file mode 100755 index 0000000..dda5833 --- /dev/null +++ b/bin/w+ @@ -0,0 +1,63 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use feature 'say'; +use utf8; +use open qw(:std :utf8); + +my $WIDTH_DEFAULT = 80; +my $WIDTH = $ARGV[0] || $WIDTH_DEFAULT; + +sub main { + my $buf = ''; + while (my $line = ) { + if ($line =~ /^\s+$/) { + say $buf; + say '' if ($buf); + $buf = ''; + next; + } + if ($buf) { + $line = $buf . $line; + } + my ($head, $tail) = handle_str($line); + say $head; + $buf = handle_buf($tail); + } + say $buf if $buf; +} + +sub handle_buf { + my $buf = shift; + my $len = length($buf); + if ($len == $WIDTH) { + say $buf; + return ''; + } + if ($len < $WIDTH) { + return $buf; + } + ## $len > $WIDTH + my ($head, $tail) = handle_str($buf); + say $head; + handle_buf($tail); +} + +sub handle_str { + my $str = shift; + if ($str =~ m/^(.{0,$WIDTH})\s(.*)$/) { + return ($1, $2); + } + ## no spaces here: 0..$WIDTH + if ($str =~ m/^(\S*)\s(.*)$/) { + return ($1, $2); + } + ## no whitespace at all + if ($str =~ m/^(\S+)$/) { + return ($1, ''); + } + die "ooops!"; +} + +main(); diff --git a/docs/9p.txt b/docs/9p.txt new file mode 100644 index 0000000..fbf5268 --- /dev/null +++ b/docs/9p.txt @@ -0,0 +1,40 @@ + +# write works: +echo очешуеть | 9p write acme/2/body + +# read works: +9p read acme/2/body +... +очешуеть + +# ls +9p ls acme +9p ls plumb + +# read current windows: +9p read acme/index + +# read default rules +9p read plumb/rules + +// // // + +# write window body with $winid == 2 into another window +Edit , < 9p read acme/2/body + +# close window with $winid == 3 +echo del | 9p write acme/3/ctl + +// // // + +touch /Users/ev/Desktop/wtf2.txt + +echo opanki >> /Users/ev/Desktop/wtf2.txt + +echo 'name /Users/ev/Desktop/wtf2.txt' | 9p write acme/2/ctl +echo clean | 9p write acme/2/ctl +echo get | 9p write acme/2/ctl + +// // // + +echo 'текст в новом окне' | 9p write acme/new/body diff --git a/docs/RobPike_AcmeUserInterfaceForProgrammers.pdf b/docs/RobPike_AcmeUserInterfaceForProgrammers.pdf new file mode 100644 index 0000000..0a7eefb Binary files /dev/null and b/docs/RobPike_AcmeUserInterfaceForProgrammers.pdf differ diff --git a/docs/SamCommands.pdf b/docs/SamCommands.pdf new file mode 100644 index 0000000..25b51e7 Binary files /dev/null and b/docs/SamCommands.pdf differ diff --git a/docs/erlang_unicode.txt b/docs/erlang_unicode.txt new file mode 100644 index 0000000..44c89f4 --- /dev/null +++ b/docs/erlang_unicode.txt @@ -0,0 +1,3 @@ +erl +pc unicode + +io:setopts([{encoding, utf8}]). diff --git a/docs/music.txt b/docs/music.txt new file mode 100644 index 0000000..ca9d38b --- /dev/null +++ b/docs/music.txt @@ -0,0 +1,13 @@ +1. window: +/path/to/legally/purchased/music + +2. add tag: +## play 10 seconds +afplay -t 10 + +## play full song +afplay + +3. L-select song + +4. M-hold + L-click diff --git a/docs/read_body_from_erlang.txt b/docs/read_body_from_erlang.txt new file mode 100644 index 0000000..f6ac9a7 --- /dev/null +++ b/docs/read_body_from_erlang.txt @@ -0,0 +1,19 @@ +## ACME WITH WINID == 7 +## ----------------------------------------------------------------------------- + +каждый охотник желает знать где сидит фазан + + +## ERLANG +## ----------------------------------------------------------------------------- + +erl +pc unicode + +io:setopts([{encoding, unicode}]). + +Winid = "7". + +Body = os:cmd("9p read acme/" ++ Winid ++ "/body"). + +Body =:= "каждый охотник желает знать где сидит фазан". +true diff --git a/docs/single_quote_in_perl_one_liner.txt b/docs/single_quote_in_perl_one_liner.txt new file mode 100644 index 0000000..77c12d2 --- /dev/null +++ b/docs/single_quote_in_perl_one_liner.txt @@ -0,0 +1,24 @@ +## IN +## ----------------------------------------------------------------------------- +apple => 'apple.png', +cherry_pie => 'cherry_pie.png', +berries => 'berries.png', +yummy_taco => 'yummy_taco.png', + +## OUT +## ----------------------------------------------------------------------------- + +apple.png +cherry_pie.png +berries.png +yummy_taco.png + +## BASH +## ----------------------------------------------------------------------------- + +Edit , > lne '/'\''(.+)'\''/; say $1' + +## RC +## ----------------------------------------------------------------------------- + +Edit , > lne '/''(.+)''/; say $1' diff --git a/docs/single_quote_rc_vs_sh.txt b/docs/single_quote_rc_vs_sh.txt new file mode 100644 index 0000000..bdf2c67 --- /dev/null +++ b/docs/single_quote_rc_vs_sh.txt @@ -0,0 +1,38 @@ +## RC +## ----------------------------------------------------------------------------- + +echo $% +/Users/ev/ + +echo '''' +' + +a '1 +bb '22 +ccc '333 + +|a+ '''' + +a '1 +bb '22 +ccc '333 + + +## SH +## ----------------------------------------------------------------------------- + +echo $% +$% + +echo "'" +' + +a '1 +bb '22 +ccc '333 + +|a+ "'" + +a '1 +bb '22 +ccc '333 diff --git a/plumbing b/plumbing new file mode 100755 index 0000000..0c4694a --- /dev/null +++ b/plumbing @@ -0,0 +1,22 @@ +## MUSIC GO TO AFPLAY +## ----------------------------------------------------------------------------- + +## mac only +## todo: rewrite for freebsd / linux + +kind is text +data matches '[a-zA-Z¡-￿0-9_\-./]+' +data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(mp3|mp4|mpeg)' +data isfile $0 +plumb start afplay $file + +## PERL ERROR MESSAGES GO TO ACME +## ----------------------------------------------------------------------------- + +type is text +data matches '([a-zA-Z¡-￿0-9_\-.]+\.p[l|m])( line )([0-9]+)?' +arg isfile $1 +data set $file +attr add addr=$3 +plumb to edit +plumb client window $editor