Code review - Issue 6854092: $acmeshell: supply filename in $0https://codereview.appspot.com/2012-11-26T03:56:46+00:00rietveld
Message from unknown
2012-11-26T03:40:30+00:00marius.eriksenurn:md5:c771f71b89fe3b580d130a982b3574f1
Message from marius.eriksen@gmail.com
2012-11-26T03:40:31+00:00marius.eriksenurn:md5:fa555fb186063c8318e1aad6c1bb67ce
Message from marius.eriksen@gmail.com
2012-11-26T03:42:21+00:00marius.eriksenurn:md5:652392c2f3715e7500ddacb9726298ab
After using $acmeshell for a while, I was really beginning to miss $%, which isn't accessible in bash since % is job substitution in bourne shells.
I think supplying the filename as argv[0] is both natural and makes sense: you are executing the snippet within the context of the file, so in a sense it is argv[0].
Message from rsc@golang.org
2012-11-26T03:47:41+00:00rscurn:md5:87172f95876c85d3b5b0cf1cedd3159d
Making it argv[0] does not make sense to me. The file is not what is
being executed. I would suggest making the file name available under a
different variable. $samfile would be a good, if slightly misnamed,
choice, because the file is already available under that name when
using sam's ! command. That is, where there is currently a putenv for
"%", add one for "samfile" too.
Russ
Message from unknown
2012-11-26T03:53:45+00:00marius.eriksenurn:md5:357ac91a6323682b4142cd19f2f6c95c
Message from marius.eriksen@gmail.com
2012-11-26T03:53:46+00:00marius.eriksenurn:md5:c214a60e01b007eadab89879fc7c9524
Message from rsc@golang.org
2012-11-26T03:54:26+00:00rscurn:md5:f4a1212a9c9c2cb56f89370f9112c133
LGTM
Message from marius.eriksen@gmail.com
2012-11-26T03:55:24+00:00marius.eriksenurn:md5:a2dce074dadb7c465d747f995ca32ba3
I can live with that. It also has the major advantage of being passed through in environments, so you can write scripts that are invoked with button-2 without inspecting the acme environment through $winid (the file often being the only thing you care about anyway).
Message from rsc@golang.org
2012-11-26T03:56:46+00:00rscurn:md5:95951e87d1b93f55de14eb5746add082
*** Submitted as http://code.google.com/p/plan9port/source/detail?r=27ec22f7be57 ***
acme: set $samfile (same as $%) during execution
R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/6854092
Committer: Russ Cox <rsc@swtch.com>