[comp.emacs] byte-compile errors in cl.el for 18.51

abair@oakhill.UUCP (Alan Bair) (07/09/88)

I recently upgraded our emacs from version 18.47 to 18.51, using all
the patches from the osu UUCP site osu-cis; 47-48, 48-49, 49-50 & 50-51.
I only ran into some major problems on the 50-51 upgrade.  

Everything worked fine until I tried to byte-compile the new or changed
lisp functions.  The file cl.el fails early in the process with the
message:  
	Wrong type argument: symbolp, (ptr oldforms (cdr ptr))
I looked at the code and can see nothing wrong with it, but then I'm 
not a Lisp expert.  Here is the code section where it dies:

;;; utilities
;;;
;;; pair-with-newsyms takes a list and returns a list of lists of the
;;; form (newsym form), such that a let* can then bind the evaluation
;;; of the forms to the newsyms.  The idea is to guarantee correct
;;; order of evaluation of the subforms of a setf.  It also returns a
;;; list of the newsyms generated, in the corresponding order.

(defun pair-with-newsyms (oldforms)
  "PAIR-WITH-NEWSYMS OLDFORMS
The top-level components of the list oldforms are paired with fresh
symbols, the pairings list and the newsyms list are returned."
  (do ((ptr oldforms (cdr ptr))
       (bindings '())
       (newsyms  '()))
      ((endp ptr) (values (nreverse bindings) (nreverse newsyms)))
    (let ((newsym (gentemp)))
      (setq bindings (cons (list newsym (car ptr)) bindings))
      (setq newsyms  (cons newsym newsyms)))))

If anyone has a fix please let me know.  I was able to finish the
update by renaming the file and keeping the old .el & .elc files.
Emacs seems to be working fine, I know of no users that are using 
the cl.el file, so its not a big hangup.

--------
While I'm posting, I had previously asked a question but never got any
response, so here it is again.

I have built emacs to use suntools and we are starting to use X11R2.
What I am wondering about, is whether I can build emacs to work under
both window systems or do I need two separate versions.  Its not clear
from the installation docs if you can set all of the #defines at the
same time.  As I understand I would need: 
	HAVE_SUN_WINDOWS, HAVE_X_WINDOWS & X11
Also how big does PURESIZE need to be then?

Again, thanks for any help.

Alan Bair
SPS CAD  Austin, TX
Motorola, Inc.
UUCP cs.utexas.edu!oakhill!turbinia!abair
PH#  (512) 440-2336

bob@allosaur.cis.ohio-state.edu (Bob Sutterfield) (07/10/88)

In article <1371@turbinia.oakhill.UUCP> abair@oakhill.UUCP (Alan Bair) writes:
>... can [I] build emacs to work under both window systems [Suntools
>and X11R2] or do I need two separate versions.  Its not clear from
>the installation docs if you can set all of the #defines at the same
>time.  As I understand I would need:
>	HAVE_SUN_WINDOWS, HAVE_X_WINDOWS & X11
>Also how big does PURESIZE need to be then?

I have one Emacs that I compiled with HAVE_SUN_WINDOWS,
HAVE_X_WINDOWS, HAVE_X_MENU, and HAVE_NEWS.  Because X10 was here
first and most folks still use it, the Emacs that can do X10 and
almost everything else is in /usr/local/bin, which is in everyone's
search path.  Its PURESIZE is a whopping 410000, which is only a
little larger than it really needs to be.  400000 might do it, but I'm
not sure.

I have another that I compiled with HAVE_X_WINDOWS, X11, and
HAVE_X_MENU.  That is with the other X11 binaries in
/usr/local/bin/X11, which only users interested in X11 put in their
search path, ahead of /usr/local/bin.  I suppose that if folks wanted
to run X11 in overview over Sutools, and still wanted the X11 binaries
in their path, I could have included HAVE_SUN_WINDOWS in this one as
well, but I don't think we have any of those types of people here.

The two Emacsen run from the same .elc files, but are two different
minor versions of 18.51.??, so thy need individual DOC-18.51.?? files
(one DOC describes X10 and NeWS stuff, the other describes X11 stuff)
that can still peaceably live in the same /usr/local/lib/emacs/etc
directory together.

For your site, you could very well define HAVE_SUN_WINDOWS,
HAVE_X_WINDOWS, and X11 with no problem at all.  You just can't (as
far as I know) run under two different protocol versions of X with the
same binary, unless you use x10tox11, but that's gross so don't even
think about it.  You'll only need one DOC file, because you'll only
have one version of Emacs running.
-=-
 Bob Sutterfield, Department of Computer and Information Science
 The Ohio State University; 2036 Neil Ave. Columbus OH USA 43210-1277
 bob@cis.ohio-state.edu or ...!{att,pyramid,killer}!cis.ohio-state.edu!bob

jr@bbn.com (John Robinson) (07/12/88)

In article <1371@turbinia.oakhill.UUCP>, abair@oakhill (Alan Bair) writes:
>Everything worked fine until I tried to byte-compile the new or changed
>lisp functions.  The file cl.el fails early in the process with the
>message:  
>	Wrong type argument: symbolp, (ptr oldforms (cdr ptr))
>I looked at the code and can see nothing wrong with it, but then I'm 
>not a Lisp expert.  Here is the code section where it dies:
>...

cl.el, like a few other elips libraries, makes and uses macro
definitions.  It won't compile right if the macros aren't defined at
the time you compile it.  The compiler might in principle catch this,
but it doesn't.

The workaround is easy - load the .el file first, then byte-compile
it.  In other words, in your case,

  M-x load-library cl.el
  M-x byte-compile cl.el

In the code you quoted, the (do ... ) function is really a macro, but
the compiler will compile code for a function call because the macro
wasn't expanded as it was reading in the file (macros are expanded in
the lisp reader, but the definitions happen in the evaluator, which
the copmiler doesn't call since you are compiling, not loading.  Got
it?).

This question should go onto the 10 most-asked questions list.
--