[net.emacs] autoload confusion

meyer@uoregon.UUCP (meyer) (01/10/86)

	This may not be a *real* bug, but I'm confused about
	the philosphy of "autoload". Specifically, I would like
	to load my own scheme-mode (lisp-mode, prolog-mode,...),
	but since scheme-mode (for example) is already defined, (i.e., 
    	!EQ (XSYMBOL (function)->function, Qunbound), where "function"
	is scheme-mode), one cannot define a new scheme-mode. That is,
	autoload returns nil and does nothing if the symbol (function name,
	e.g., 'scheme-mode) is already bound.  Apparently, this will be 
	true for any function name loaded out of loaddefs.el.

	Further, we can't use the scheme entries in auto-mode-alist
	(since we can't autoload a different scheme-mode). To get
	around this, I had to call my scheme-mode something
	different, and cons the appropriate stuff onto the front
	of auto-mode-alist. A terrible hack, at best.

	Is there a way to get around this (e.g., unbind a symbol;
	I noticed there isn't much in the way of oblist handling
	functions), or should autoload always set up the autoload
	(like Gosling's)?

	Thanks for the time,


	David Meyer	

	Department of Computer and Information Science
	University of Oregon
	Eugene, OR 97403
	
	usenet:		{decvax, allegra}!tektronix!uoregon!meyer
	csnet:		meyer@uoregon.csnet
	arpanet:	meyer%uoregon.csnet@csnet-relay.arpa

	
	

mly@prep.ai.mit.edu (01/18/86)

From: mly@prep.ai.mit.edu (Richard Mlynarik)
   From: uoregon!meyer@mit-eddie (meyer)
   Newsgroups: net.emacs
   Date: Fri, 10-Jan-86 11:07:00 EST


   This may not be a *real* bug, but I'm confused about
   the philosphy of "autoload". Specifically, I would like
   to load my own scheme-mode (lisp-mode, prolog-mode,...),
   but since scheme-mode (for example) is already defined, (i.e., 
   !EQ (XSYMBOL (function)->function, Qunbound), where "function"
   is scheme-mode), one cannot define a new scheme-mode. That is,
   autoload returns nil and does nothing if the symbol (function name,
   e.g., 'scheme-mode) is already bound.  Apparently, this will be 
   true for any function name loaded out of loaddefs.el.

For starters, the definition of "autoload" in Emacs17 (the current
version) icontains the following fragment:

  /* If function is defined and not as an autoload, don't override */
  if (!EQ (XSYMBOL (function)->function, Qunbound)
      && !(XTYPE (XSYMBOL (function)->function) == Lisp_Cons
    && EQ (XCONS (XSYMBOL (function)->function)->car, Qautoload)))
    return Qnil;

so what you are trying to do would work if you were running a more
up-to-date Emacs.
Thanks for the [belated] bug report in any case...

   [..]
   Is there a way to get around this (e.g., unbind a symbol;
   I noticed there isn't much in the way of oblist handling
   functions), or should autoload always set up the autoload
   (like Gosling's)?

There is a useful subset of the relevant common-lisp functions:
makunbound, fmakunbound, boundp, fboundp, intern, intern-soft (ie find-symbol)

The behaviour of -always- doing a redefinition when `autoload' is
called is flawed in my opinion for a number of reasons, which I could
go into if you're interested.  I'd prefer to avoid making a religious
discussion out of this.