[comp.sys.xerox] can't find package error message

Kevin_Crowston@XV.MIT.EDU (02/19/88)

Being a new user of Common-Lisp, I frequently type in file names
(with colons after the file server name) as atoms.  This invariably
results in an error like "Can't find package {LISP to look up symbol
}<LENS>LENS.LCOM", followed by a trip to SEDIT to edit the
command.  Once in SEDIT, however, the offending colon is prefixed 
with a % to get it past the reader, so all I have to do is close the
SEDIT window.  

Question:  is there any way to make this automatic?  Is there a flag
I can set that says:  "if you can't find the package, pretend there
was a percent in front of the colon"?  A quick glance through the
release notes didn't turn up anything promising...

Kevin Crowston
Sloan School of Management

"Lennart_Lovstrand.EuroPARC"@XEROX.COM (02/23/88)

Kevin,

I have had the exact same problems and I sympathetize with you.  I don't know of
a flag that disables bad package errors, but I have a patch for \SUBREAD which
does about what I think you want.  The fix will let you type in NS file names
without having to manually bother about escaping the colons in the host name or
typing it in as a string, but this is all it gives you -- ie, you will still
have to escape colons anywhere else where you might be using them outside of
their real purpose as package delimiters.

What the patch does is to change the code that parses package delimiters into
treating them as normal characters for the single case when the first character
of the atom is a left curly bracket.  The only potential danger that I can see
with this is that it will fail to discover a real package starting with a left
curly bracket if anybody would be foolish enough to create such a thing.  This
may seem a bit extreme to some people, but it certainly saves me a lot of
frustration by not forcing me to go through SEdit and feel stupid every five
minutes when I forget...

If you have the source of \SUBREAD (LLREAD), change:

	elseif (EQ SNX PACKAGEDELIM.RC)
	    then (GO GOTPACKAGEDELIM)
	else (GO ATOMLOOP))

into:

	elseif (EQ SNX PACKAGEDELIM.RC)
	    then (if (EQ (\GETBASECHAR \FATPNAMESTRINGP PBASE 0) (CHARCODE {))
			then (GO GOTATOMCHAR)
			else (GO GOTPACKAGEDELIM))
	else (GO ATOMLOOP))

and recompile.  Or copy ~ftp/lisp/subreadpatch.lcom from parcvax.xerox.com using
anonymous ftp.

--Lennart <Lovstrand.EuroPARC@Xerox.COM>
Rank Xerox EuroPARC, 61 Regent Street, Cambridge CB2 1AB, England

"Lennart_Lovstrand.EuroPARC"@XEROX.COM (03/08/88)

For those who do not have source or ARPANET access or who does not like to
modify system code, here's a cleaner alternative which makes use of a read macro
to achieve the same result as SUBREADPATCH.  (Thanks to Larry Masinter for
suggesting this technique.)

Again, this read macro properly installed will stop colons from being
interpreted as package delimiters inside symbols beginning with a left brace.
This allows you to merrily enter NS file names without bothering to manually
quote the colons in the host name or be forced to make a detour into SEdit each
time you forget.  Good for your blood pressure too.

--Lennart


(DEFINEQ (READNSFILENAME
 (LAMBDA (STREAM RDTBL)
  (LET ((colonSyntax (GETSYNTAX (CHARCODE %:) RDTBL))
        (braceSyntax (GETSYNTAX (CHARCODE {) RDTBL))
        fileAtom)
       (CL:UNWIND-PROTECT (PROGN (SETSYNTAX (CHARCODE %:) 'OTHER RDTBL)
                                 (SETSYNTAX (CHARCODE {) 'OTHER RDTBL)
                                 (CL:UNREAD-CHAR #\{ STREAM)
                                 (SETQ fileAtom (READ STREAM RDTBL)))
              (SETSYNTAX (CHARCODE %:) colonSyntax RDTBL)
              (SETSYNTAX (CHARCODE {) braceSyntax RDTBL))
       fileAtom))))

(SETSYNTAX (CHARCODE {) '(MACRO FIRST NOESCQUOTE READNSFILENAME)
       (FIND-READTABLE "INTERLISP"))
(SETSYNTAX (CHARCODE {) '(MACRO FIRST NOESCQUOTE READNSFILENAME)
       (FIND-READTABLE "XCL"))