From: trebol55555@yandex.ru
To: 9fans@9fans.net
Subject: [9fans] Chords, ^, _, ^B and scroll with mouse wheel in p9p sam
Date: Tue, 31 May 2016 02:34:57 +0100 [thread overview]
Message-ID: <36493baa15b236661ef0f0225656755c@debpi> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 2942 bytes --]
I posted wrong code for Plan 9 by error.
The E script:
-----------------
#!/bin/rc
files=()
dest=()
if(~ $#* 0){
echo usage: E file ... >[1=2]
exit usage
}
for(i)
switch($i){
case /*
files = ( $files $i )
case *
files = ( $files `{cleanname `{pwd}^/$i} )
}
if(test -f /mnt/term/srv/sam.$user) dest = /mnt/term/srv/sam.$user
if not if(test -f /srv/sam.$user) dest = /srv/sam.$user
if not {
switch($files){
case *:*
for(i in $files){
fi = `{echo $i | sed 's/(.*):[^:]*/\1/'}
ad = `{echo $i | sed 's/.*:([^:]*)/\1/'}
plumb -d edit -a 'addr='$"ad'' $fi
}
case *
plumb -d edit $files
}
exit
}
switch($files){
case *:*
for(i in $files)
echo $i | sed 's/^/B /;s/:(.*)$/\n\1/g' >> $dest
case *
echo B $files >> $dest
}
-----------------
The plumb rules:
-----------------
# existing files, possibly tagged by line number, go to editor
type is text
data matches '([.a-zA-Z¡-￿0-9_/+\-]*[a-zA-Z¡-￿0-9_/+\-])('$addr')?'
arg isfile $1
plumb start E $file:$3
## man index entries are synthesized
type is text
data matches '([a-zA-ZÃ-ʨ¡-ï¿¿0-9_-./+\-]+)\(([1-8])\)'
plumb start rc -c 'if(test -f /mnt/term/srv/sam.$user) dest = /mnt/term/srv/sam.$user; if not if(test -f /srv/sam.$user) dest = /srv/sam.$user; if not {man '$2' '$1' >[2=1] | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')''; exit}; {echo ''{}''; echo ''B ~~'$1'('$2')~~''; echo ''<man '$2' '$1' >[2=1]''} >>$dest'
# poor man's sam file browser
type is text
data matches '([.a-zA-Z¡-￿0-9_/\-;&$,'']+)'
arg isdir $0
plumb start rc -c 'if(test -f /mnt/term/srv/sam.$user) dest = /mnt/term/srv/sam.$user; if not if(test -f /srv/sam.$user) dest = /srv/sam.$user; if not {plumb -d edit '$dir'; exit}; cd '$dir'; DIR = `{pwd}; {echo ''{}''; echo B $DIR/~~samdir~~; echo '',<echo ~~''$DIR''~~; echo; echo ../;ls -pF ''$DIR''''; echo 0} >>/srv/sam.$user'
## poor man's sam exec in current file's cwd
type is text
data matches '(¤)([a-zA-ZÃ-ʨ¡-ï¿¿0-9_\-./\+^,()$:|#%<>*&'' ]+)'
plumb start rc -c 'if(test -f /mnt/term/srv/sam.$user) dest = /mnt/term/srv/sam.$user; if not if(test -f /srv/sam.$user) dest = /srv/sam.$user; if not {echo can''''t find sam server file >[1=2]; exit open}; {cd '$wdir'; {echo '$wdir' ¤'''$2'''; echo; {'$2'}; echo} >/tmp/sam_ecfcwd_$pid >[2=1]; {echo ''{}''; echo B '$wdir'^/~~cmd~~; echo ''$''; echo ''<cat /tmp/sam_ecfcwd_''$pid; echo ''!rm /tmp/sam_ecfcwd_''$pid} >>$dest}'
-----------------
I've tested it in 9front, and all works good. Of course you can delete
all the acme part if you don't use it.
Remember that you have to edit samterm/io.c to create always the pipe
[...]
hoststart();
plumbstart();
extstart();
}
And in P9P you need to set the shell to rc in sam/unix.c
#define SHNAME "rc"
#define SHPATHNAME "/usr/local/plan9/bin/rc"
Or adapt the rules for sh...
trebol.
next reply other threads:[~2016-05-31 1:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 1:34 trebol55555 [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-05-30 16:35 trebol55555
2016-05-27 17:11 trebol55555
2016-05-27 17:46 ` Mark Lee Smith
2016-05-27 18:04 ` trebol55555
2016-05-28 10:04 ` Mark Lee Smith
2016-05-26 22:03 trebol55555
2016-05-27 20:57 ` Mark Lee Smith
2016-05-27 21:42 ` Tobias Kreisel
2016-05-27 22:16 ` Ethan Grammatikidis
2016-05-27 22:37 ` stanley lieber
2016-05-28 15:25 ` Ethan Grammatikidis
2016-05-27 23:09 ` Kurt H Maier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36493baa15b236661ef0f0225656755c@debpi \
--to=trebol55555@yandex.ru \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).