[To reply replace "Aaron.Sloman.XX" with "A.Sloman"]
Stephen Isard <S.IsardDeleteThis@ed.ac.uk> writes:
> Hi Aaron,
>
> I'm mailing you directly rather than posting because I want to be sure I
> don't have the wrong end of the stick.
No wrong ends that I noticed, apart from accidental posting to the
group!
> Your procedure is going to be immediately useful to people who are
> suffering from the problem of spaces in names, but wouldn't it be good
> to also fix the problem at source, i.e., in the system files?
Yes, though that's one of many things to be fixed in the system
files, and doing that and rebuilding all the saved images will take
some time (I can't recompile some myself as we don't have the
machines here, and I have not yet set up the convenient environment
used at sussex for managing one master directory with lots of
different cross links for different versions of poplog, from which
all the different versions can easily be created).
Or rather, I have the master directory tree, but have not yet copied
and checked out all the tools they used for manipulating it.
In any case I thought some people might like a simple fix that did
not require either fetching a new poplog image or rebuilding poplog
after recompiling a source file.
There are lots of things that don't work well if you have spaces in file
or directory names. e.g. ved_dired, the file browser, and
vedfilecomplete, to name but two.
So there will be lots of thought needed on how to fix all this. (I'd
hate to have to adopt the Emacs philosophy using editing "modes": one of
the things I prefer about Ved is that any mechanism can be used in any
context -- apart from one or two that I have forgotten.)
> Of course there are going to be people, e.g., students, who aren't in a
> position to install a new system for themselves and will want to use
> your procedure in the meantime, but in the long run, a separate
> procedure for reading in files with spaces in their names would be an
> extra piece of obscure lore for the new user to trip over.
I agree. I keep saying that I want to apply to EPSRC for funds to
hire a couple of people, one at Birmingham and one somewhere else to
work on poplog for a couple of years to bring various things up to
date, clean up some of the messier features, and incorporate various
desirable extensions, including replacing the disastrous Ved "graphic"
characters (Very nice for Ved users and awful for everyone else.)
But I have been so busy with other things I have done nothing about
the grant proposal, apart from some discussions a few months ago
with Steve Leach about some of the things that need to be done...
(If someone in a UK university would like to be a co-proposer to EPSRC
that might trigger me into action! Perhaps Nottingham where Brian Logan
tells me interesting things are being done to link Poplog with a Virtual
Reality package developed there which runs on NT!)
> The only remark I have about your procedure is that it seems to prevent
> the user from opening a new file with a space in the name. (I haven't
> actually tried your code, just read it.)
That was because I assumed it was obvious that no sane poplog user would
ever wish to create new files with spaces in their names, only to
read/edit existing ones.
But on reflection I see I was completely wrong, for the very reason I
gave originally, i.e. there are now cross-mounted *windows* file systems
and there could be a directory with a space in its name, etc. etc.
And anyway, if an operating system allows something and users want to do
it, then no editor should be designed so as to make it impossible!
So I have modified ved_spaceved so that you can create a file with a
space in its name, including creating a new file in a directory with
a space in its name.
I have installed the new version in
http://www.cs.bham.ac.uk/research/poplog/auto/ved_spaceved.p
and I append it below also. (Remove my signature before installing,
either in $usepop/pop/lib/auto/ or in $poplocal/local/auto/)
I added a fix in case anyone tries to use it in WinTel poplog but I
have no idea whether it will work in windows/NT. Probably not.
Nothing ever works there as I would expect...
Aaron
Revised version follows
===================================================================
/* --- Copyright University of Birmingham 2001. All rights reserved. ------
> File: $poplocal/local/auto/ved_spaceved.p
> Purpose: Read in file whose name contains spaces
> Author: Aaron Sloman, May 13 2001 (see revisions)
> Documentation: Below for now
> Related Files:
*/
/*
HELP ved_spaceved
Utility to use Ved for reading in or creating files whose names
include spaces.
This is needed because ved_ved assumes that if its argument
includes spaces then it refers to several files, which should
all be read into Ved. (This will almost certainly be disabled in
a later version of Poplog, or at least made optional.)
ENTER spaceved my silly file.p
This command will look for a file called 'my silly file.p'
and read it into ved for editing.
If there is no such file, a new ved buffer will be created, which
when written will have 'my silly file.p' as its name.
It will also work for directories whose names contain spaces,
e.g.
ENTER spaceved ~/my dir/my silly file.p
WARNING: this will not use vedsearchlist, so explicit path
names will be needed for files not in the current directory.
It will also not find the file if it is already being edited,
so use ESC e (vedfileselect) to return to a file previously
edited with this command.
The ENTER spaceved command will make ved read the file into
a Ved buffer and in many ways it will be like an ordinary ved
file. However, on the status line ved will show the type "workbuff"
before the file name as a reminder that this is an unusual file.
*/
section;
define lconstant setupglobals(newfile, string);
;;; Set up some of the globals for the new file, to make it behave
;;; more or less like an ordinary file
dlocal ved_current_file = newfile;
sysfileok(string) -> string;
;;; modify this test for windows ???
#_IF hd(sys_os_type) == "unix"
if string(1) = `/` then
#_ELSE
;;; see if second char in string is `:`, e.g. C:foo\baz
if datalength(string) > 2 and string(2) == `:` then
#_ENDIF
;;; it's a full path name
string ->> vedpathname -> vedcurrent;
nullstring -> veddirectory;
else
;;; it's a relative path
current_directory dir_>< string -> vedpathname;
current_directory -> veddirectory;
string -> vedcurrent;
endif;
;;; if not false, it will be "workbuff"!
false -> vedfileprops;
false -> vedchanged;
;;; Maybe the user should have a choice about this:
true -> vedwriteable;
enddefine;
define ved_spaceved();
;;; Edit file whose name (or path) has spaces.
;;; Check that the file exists
lvars filedev = readable(vedargument);
if filedev then
;;; Prepare new ved file structure containing the file
;;; ignore first result of vedreadfile
lvars (_, newfile) = vedreadfile(filedev, vedveddefaults, false);
else
;;; need to create a new file. Check that directory exists
lvars path = sys_fname_path(vedargument);
unless path = nullstring or sys_file_exists(path) then
vederror('NO DIRECTORY: ' <> path)
endunless;
;;; create new empty file
lvars newfile = vedopen(vedargument, false);
endif;
setupglobals(newfile, vedargument);
vededit(newfile);
enddefine;
endsection;
/* --- Revision History ---------------------------------------------------
--- Aaron Sloman, May 15 2001
Altered so that it can also be used to create a new file with
spaces in its name, or a new file in a directory whose name has spaces.
Modified to test for `:` as second character as an indicator of
full path name, for non-unix file systems. Needs a change for
VMS
*/
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk (ReadATas@please !)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/freepoplog.html
|