Closed 9gay closed 1 year ago
Sounds an awful lot like B
?
the difference between B
and E
is that E
waits for file to be modified (not to mention E
calls B
) and is meant to be used as EDITOR=E
, but A
is about waiting for window(s) in acme
to be closed even if the file(s) is/are not modified and is also meant to be used as EDITOR=A
, B
is inadequate for EDITOR=B
unless you intend to not modify any file when other programs call $EDITOR
also B
and E
are for sam
, but I use acme
so I've written A
B and E will both work just fine with acme, FWIW.
I'm not sure about this, though; it really feels like a personal tool.
@dancrossnyc I don't use sam
, so if I run E
in acme
:
% E game.dot
plumb: can't open plumb file: dial unix!/tmp/ns.gay.:0/plumb: connect /tmp/ns.gay.:0/plumb: No such file or directory
editing game.dot
^?26274: signal: interrupt
%
B and E will both work just fine with acme, FWIW.
with sam
running? yes
without sam
running? no
I'm not sure about this, though; it really feels like a personal tool.
just like B
and E
are personal to sam
, A
is personal to acme
, in order to run B
and E
I have to run sam
, in order to run A
I have to run acme
here's the source code of B
(why do I copy-paste code that's already in repo?):
#!/bin/sh
files=""
dest=""
line=""
if [ $# -gt 0 ]; then
case "$1" in
+[0-9]*)
line="`echo $1 | sed 's/+/:/'`"
shift
;;
esac
fi
if [ $# -eq 0 ]
then
echo 'usage: B [+line] file...' 2>&1
exit 1
fi
if [ "x$DISPLAY" = "x" ]
then
sam="/tmp/.sam.$USER"
else
if [ "$DISPLAY" = ":0" ]
then
DISPLAY=:0.0
fi
sam="/tmp/.sam.$USER.$DISPLAY"
fi
if [ ! -p $sam ]
then
pwd="`pwd`"
for i
do
i="$i$line"
i=`cleanname -d "$pwd" "$i"`
plumb -s B -d edit "$i"
done
else
for i
do
i="$i$line"
pwd=`pwd`
file=`cleanname -d $pwd $i`
line=`echo $file | sed 's/.*://'`
file=`echo $file | sed 's/:.*//'`
echo "B $file" >>$sam
if [ "x$line" != "x" -a "x$line" != "x$file" ]
then
echo "$line" >> $sam
fi
done
fi
and here's the source code of E:
#!/bin/sh
# run B but then wait for the file to change.
# great to set as $EDITOR.
# the notion of a file changing is a little weak.
stat=`ls -l $1`
B "$@"
echo editing "$@"
while sleep 1
do
nstat=`ls -l $1`
if [ "x$stat" != "x$nstat" ]
then
exit
fi
done
On Tue, Sep 6, 2022 at 1:47 PM 9gay @.***> wrote:
B and E will both work just fine with acme, FWIW.
with sam running? yes without sam running? no
That doesn't sound right. I cannot reproduce it locally, either on plan9ports or plan9. Both work just fine, loading a file into acme, without sam running.
I'm not sure about this, though; it really feels like a personal tool.
just like B and E are personal to sam, A is personal to acme, in order to run B and E I have to run sam, in order to run A I have to run acme here's the source code of B (why do I copy-paste code that's already in repo?):
I think you mean, "specific to" not "personal to" here, but this seems mistaken. Sorry.
!/bin/sh
files="" dest=""
line="" if [ $# -gt 0 ]; then case "$1" in +[0-9]*) line="
echo $1 | sed 's/+/:/'
" shift ;; esac fiif [ $# -eq 0 ] then echo 'usage: B [+line] file...' 2>&1 exit 1 fi
if [ "x$DISPLAY" = "x" ] then sam="/tmp/.sam.$USER" else if [ "$DISPLAY" = ":0" ] then DISPLAY=:0.0 fi sam="/tmp/.sam.$USER.$DISPLAY" fi
if [ ! -p $sam ] then pwd="
pwd
" for i do i="$i$line" i=cleanname -d "$pwd" "$i"
plumb -s B -d edit "$i" done else for i do i="$i$line" pwd=pwd
file=cleanname -d $pwd $i
line=echo $file | sed 's/.*://'
file=echo $file | sed 's/:.*//'
echo "B $file" >>$sam if [ "x$line" != "x" -a "x$line" != "x$file" ] then echo "$line" >> $sam fi done fiand here's the source code of E:
!/bin/sh
run B but then wait for the file to change.
great to set as $EDITOR.
the notion of a file changing is a little weak.
stat=
ls -l $1
B "$@" echo editing "$@" while sleep 1 do nstat=ls -l $1
if [ "x$stat" != "x$nstat" ] then exit fi done— Reply to this email directly, view it on GitHub https://github.com/9fans/plan9port/pull/579#issuecomment-1238470925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMEWAFP3RO4YRZNIX4UKPTV457SZANCNFSM6AAAAAAQEBY6LM . You are receiving this because you were mentioned.Message ID: @.***>
That doesn't sound right. I cannot reproduce it locally, either on plan9ports or plan9. Both work just fine, loading a file into acme, without sam running.
now the puzzling piece of code is if [ ! -p $sam ]
which runs plumb -s B -d edit "$i"
no matter is sam
running or not, this is the first time I run plumber
, but the interesting thing is that B
doesn't work without plumber
anymore even if sam
is running, but alright, my script is not so useful anymore unless there are people like me who want E
program to stop only when all acme
windows it created are closed
B
not working without plumber
but with sam
running appears to be bug in alpine linux, both busybox shell and bash always return false on if [ ! -p $sam ]
bug: it opens files that have spaces in their names, but for some reason prints an error