* Re: [9fans] 'euro symbol' special in acme interface?
@ 2002-03-29 5:23 Russ Cox
2002-03-29 13:07 ` Axel Belinfante
2002-04-03 13:01 ` [9fans] finding acme window id from shell script? Axel Belinfante
0 siblings, 2 replies; 7+ messages in thread
From: Russ Cox @ 2002-03-29 5:23 UTC (permalink / raw)
To: 9fans
> Today I tried to update the coffeelist script I mentioned sometime
> before, such that the 'field name' 'payable' is replaced by the euro
> sign (made using 'compose' e$ ).
> However, when I read that substring from acme, so, when reading from the
> data file after making the selection with a regexp, I seem to get
> the empty string. Making the selection seems to work OK;
> using mouse button 3 on the string I use to make the selection
> (prefixed with a :) works ok.
> Anything obvious that I may have missed?
Wow. That's quite the shell script.
Try replacing read with sed 1q in your shell
definitions. You're in uncharted territory.
Read and acme don't get along very well
about reading multibyte UTF sequences.
Acme currently assumes that it doesn't have to deal
with programs that read from data 1 byte at a time,
like read does.
Russ
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] 'euro symbol' special in acme interface?
2002-03-29 5:23 [9fans] 'euro symbol' special in acme interface? Russ Cox
@ 2002-03-29 13:07 ` Axel Belinfante
2002-04-03 13:01 ` [9fans] finding acme window id from shell script? Axel Belinfante
1 sibling, 0 replies; 7+ messages in thread
From: Axel Belinfante @ 2002-03-29 13:07 UTC (permalink / raw)
To: 9fans
> > Today I tried to update the coffeelist script I mentioned sometime
> > before, such that the 'field name' 'payable' is replaced by the euro
> > sign (made using 'compose' e$ ).
[...]
> Wow. That's quite the shell script.
I hope it can be made more simple. Keep in mind it's my first attempt
at programming acme from rc :-) (having no experience with the acme
interface, doing the same in C seemed even more scary to me). The hope
was that it might be used as an example, to built upon... (oh well :-)
> Try replacing read with sed 1q in your shell definitions.
[...]
Last night I played with it at home, and when it was obvious that
the selection was made correctly, I looked at the reading part,
tried cat and then sed 1q and it worked.
Thanks for the hint, and for explaining the problem!
Axel.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [9fans] finding acme window id from shell script?
2002-03-29 5:23 [9fans] 'euro symbol' special in acme interface? Russ Cox
2002-03-29 13:07 ` Axel Belinfante
@ 2002-04-03 13:01 ` Axel Belinfante
1 sibling, 0 replies; 7+ messages in thread
From: Axel Belinfante @ 2002-04-03 13:01 UTC (permalink / raw)
To: 9fans
Another question about programming acme from rc:
Can a shell script (or other program) find
out from which acme window it was invoked
(other than looking for a 'known' filename
in/mnt/acme/index)?
In the manual I only found acme's ID command,
which I cannot use from within the shell script
(or is there a way?), and reading the ctl file,
but I assume that refers to e.g. /mnt/acme/<nr>/ctl
and to read that I already need to know <nr>.
Currently I just look for a 'fixed' filename in
/mnt/acme/index, which works ok; I'm just wondering
whether there is a more 'direct' way.
Thanks,
Axel.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] finding acme window id from shell script?
2002-04-03 14:58 rog
@ 2002-04-03 15:47 ` Axel Belinfante
0 siblings, 0 replies; 7+ messages in thread
From: Axel Belinfante @ 2002-04-03 15:47 UTC (permalink / raw)
To: 9fans
> > id=`{grep $% /mnt/acme/index | awk '{print $1}'} , or so
>
> that's not entirely accurate as it's quite possible to have have
> different acme windows with the same tag file, either deliberately
> (via Zerox) or accidentally (by typing).
Agreed. Your $acmewin is better in that respect.
Or e.g. a file /mnt/acme/id , or...
> while we're on the subject of shell scripts for acme, here's a little
> shell script i wrote years ago to show me what changes i'd made to a
> file within acme.
> it's a testament to the resilience of the file-style interface that it
> has remained unchanged (and working) throughout all the changes to
> acme (e.g. alef->C) that have taken place in the meantime. the
> modification date on the script is March 1999.
Nice! (both the script, and the resilience of the file-style interface)
Axel.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] finding acme window id from shell script?
@ 2002-04-03 14:58 rog
2002-04-03 15:47 ` Axel Belinfante
0 siblings, 1 reply; 7+ messages in thread
From: rog @ 2002-04-03 14:58 UTC (permalink / raw)
To: 9fans
> id=`{grep $% /mnt/acme/index | awk '{print $1}'} , or so
that's not entirely accurate as it's quite possible to have have
different acme windows with the same tag file, either deliberately
(via Zerox) or accidentally (by typing).
while we're on the subject of shell scripts for acme, here's a little
shell script i wrote years ago to show me what changes i'd made to a
file within acme.
use like:
afdiff somefile.c
it's a testament to the resilience of the file-style interface that it
has remained unchanged (and working) throughout all the changes to
acme (e.g. alef->C) that have taken place in the meantime.
the modification date on the script is March 1999.
#!/bin/rc
# afdiff: show differences between the file contents as held in
# acme's internal buffers and the file as actually held in the filesystem.
if (! test -f /mnt/acme/index) {
echo 'not inside acme' >[1=2];
exit fail
}
if (! ~ $#* 1 2) {
echo 'usage: afdiff acmefile [file]' >[1=2]
exit usage
}
pat=`{echo $1 | sed 's/[.*()[|+]/\\&/g'}
poss=`{awk '{print $1, $6}' < /mnt/acme/index | grep ' .*'^$pat^'$'}
if (! ~ $#poss 2) {
{
if (~ $#poss 0) {
echo no matching acme files
exit nomatch
}
echo 'afdiff: ambiguous name; possible matches are:'
*=$poss
while (! ~ $#* 0 1) {echo $2; shift 2}
} >[1=2]
}
f2=/mnt/acme/^$poss(1)^/body
if (~ $#* 2) f1=$*(2)
if not f1=$poss(2)
exec diff $f1 $f2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] finding acme window id from shell script?
2002-04-03 13:45 rog
@ 2002-04-03 14:16 ` Axel Belinfante
0 siblings, 0 replies; 7+ messages in thread
From: Axel Belinfante @ 2002-04-03 14:16 UTC (permalink / raw)
To: 9fans
That would be nice.
id=`{grep $% /mnt/acme/index | awk '{print $1}'} , or so
Axel.
> one feature i would find useful: an environment variable giving the
> filename of the current window (from the tag). to save valuable space
> in tags, it should probably be a single letter, maybe $% ?
>
> cp $% $%.old
> Edit ,>diff $% /fd/0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [9fans] finding acme window id from shell script?
@ 2002-04-03 13:45 rog
2002-04-03 14:16 ` Axel Belinfante
0 siblings, 1 reply; 7+ messages in thread
From: rog @ 2002-04-03 13:45 UTC (permalink / raw)
To: 9fans
> Can a shell script (or other program) find out from which acme window
> it was invoked (other than looking for a 'known' filename
> in/mnt/acme/index)?
in the alef version of acme i made a change so that the window id was
set in $acmewin so that shell scripts that wished to could operate on
the window they were executed from.
i did that largely so that i could implement aget and aput commands
which got or put some text into the selection of the current window so
you could do
aget|fmt|aput
however since the '|' functionality has been implemented that's not so
useful.
one feature i would find useful: an environment variable giving the
filename of the current window (from the tag). to save valuable space
in tags, it should probably be a single letter, maybe $% ?
cp $% $%.old
Edit ,>diff $% /fd/0
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-04-03 15:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-29 5:23 [9fans] 'euro symbol' special in acme interface? Russ Cox
2002-03-29 13:07 ` Axel Belinfante
2002-04-03 13:01 ` [9fans] finding acme window id from shell script? Axel Belinfante
2002-04-03 13:45 rog
2002-04-03 14:16 ` Axel Belinfante
2002-04-03 14:58 rog
2002-04-03 15:47 ` Axel Belinfante
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).