> I'd like to be able to provoke XVed into editing a file ``from the
> outside'', ie, by running a script or program. [Note that I have
> an XVed already running, and that's the one I'd like to open up
> the new window.]
>
> How might I go about this?
Here's a quick answer, which I am sure you can refine as needed.
Make your script or program create a file with the required information.
E.g. to edit file foo the provoking file could contain a pop11 command
like:
veddo('ved foo');
or
edit('foo');
Then use sys_timer to make a program check every N seconds whether the
file exists, and if so do something with it. E.g. something like this:
define check_provoke();
lconstant file = '$HOME/.provoke'; ;;; or whatever filename
;;; keep up to 10 backups of done file
dlocal pop_file_versions = 10;
;;; sys_file_stat is faster and simpler than readable
;;; for checking whether a file exists
if sys_file_stat(file, nullvector) then
;;; the file can contain arbitrary Pop-11 commands
compile(file);
;;; save it for future reference by adding '.done'
sys_file_move(file, file <> '.done')
endif;
;;; Make it check every 60 seconds
60e6 -> sys_timer(check_provoke);
enddefine;
Start up the timer.
check_provoke();
I've just checked that this works with ordinary VED. It should work
with Xved, but I don't use it.
Watch out for input going into the wrong file if you are typing when
the new file appears. You could make vedwarpcontext false inside
check_provoke, to prevent input focus warping to the new file.
To turn it off do
false -> sys_timer(check_provoke);
You can add extra sophistication to make it easier to start up different
versions to look at different files with different time intervals, etc.
E.g. I have one that checks every N seconds whether I have new mail
Aaron
|