comparison man/lispref/loading.texi @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children 9fae6227ede5
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the XEmacs Lisp Reference Manual. 2 @c This is part of the XEmacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 @c See the file lispref.texi for copying conditions. 4 @c See the file lispref.texi for copying conditions.
5 @setfilename ../../info/loading.info 5 @setfilename ../../info/loading.info
6 @node Loading, Byte Compilation, Macros, Top 6 @node Loading, Byte Compilation, Macros, Top
7 @chapter Loading 7 @chapter Loading
8 @cindex loading 8 @cindex loading
298 This function defines the function (or macro) named @var{function} so as 298 This function defines the function (or macro) named @var{function} so as
299 to load automatically from @var{filename}. The string @var{filename} 299 to load automatically from @var{filename}. The string @var{filename}
300 specifies the file to load to get the real definition of @var{function}. 300 specifies the file to load to get the real definition of @var{function}.
301 301
302 The argument @var{docstring} is the documentation string for the 302 The argument @var{docstring} is the documentation string for the
303 function. Normally, this is the identical to the documentation string 303 function. Normally, this is identical to the documentation string in
304 in the function definition itself. Specifying the documentation string 304 the function definition itself. Specifying the documentation string in
305 in the call to @code{autoload} makes it possible to look at the 305 the call to @code{autoload} makes it possible to look at the
306 documentation without loading the function's real definition. 306 documentation without loading the function's real definition.
307 307
308 If @var{interactive} is non-@code{nil}, then the function can be called 308 If @var{interactive} is non-@code{nil}, then the function can be called
309 interactively. This lets completion in @kbd{M-x} work without loading 309 interactively. This lets completion in @kbd{M-x} work without loading
310 the function's real definition. The complete interactive specification 310 the function's real definition. The complete interactive specification
312 @var{function}, and when that happens, it's time to load the real 312 @var{function}, and when that happens, it's time to load the real
313 definition. 313 definition.
314 314
315 You can autoload macros and keymaps as well as ordinary functions. 315 You can autoload macros and keymaps as well as ordinary functions.
316 Specify @var{type} as @code{macro} if @var{function} is really a macro. 316 Specify @var{type} as @code{macro} if @var{function} is really a macro.
317 Specify @var{type} as @code{keymap} if @var{function} is really a 317 Specify @var{type} as @code{keymap} if @var{function} is really a keymap.
318 keymap. Various parts of Emacs need to know this information without 318 Various parts of Emacs need to know this information without loading the
319 loading the real definition. 319 real definition.
320 320
321 An autoloaded keymap loads automatically during key lookup when a prefix 321 An autoloaded keymap loads automatically during key lookup when a prefix
322 key's binding is the symbol @var{function}. Autoloading does not occur 322 key's binding is the symbol @var{function}. Autoloading does not occur
323 for other kinds of access to the keymap. In particular, it does not 323 for other kinds of access to the keymap. In particular, it does not
324 happen when a Lisp program gets the keymap from the value of a variable 324 happen when a Lisp program gets the keymap from the value of a variable
333 333
334 @example 334 @example
335 (autoload @var{filename} @var{docstring} @var{interactive} @var{type}) 335 (autoload @var{filename} @var{docstring} @var{interactive} @var{type})
336 @end example 336 @end example
337 337
338 For example, 338 For example,
339 339
340 @example 340 @example
341 @group 341 @group
342 (symbol-function 'run-prolog) 342 (symbol-function 'run-prolog)
343 @result{} (autoload "prolog" 169681 t nil) 343 @result{} (autoload "prolog" 169681 t nil)
507 @cindex load error with require 507 @cindex load error with require
508 508
509 Features are normally named after the files that provide them, so that 509 Features are normally named after the files that provide them, so that
510 @code{require} need not be given the file name. 510 @code{require} need not be given the file name.
511 511
512 For example, in @file{emacs/lisp/prolog.el}, 512 For example, in @file{emacs/lisp/prolog.el},
513 the definition for @code{run-prolog} includes the following code: 513 the definition for @code{run-prolog} includes the following code:
514 514
515 @smallexample 515 @smallexample
516 (defun run-prolog () 516 (defun run-prolog ()
517 "Run an inferior Prolog process, input and output via buffer *prolog*." 517 "Run an inferior Prolog process, input and output via buffer *prolog*."
607 Emacs. Use this to conditionalize execution of lisp code based on the 607 Emacs. Use this to conditionalize execution of lisp code based on the
608 presence or absence of emacs or environment extensions. 608 presence or absence of emacs or environment extensions.
609 609
610 @var{fexp} can be a symbol, a number, or a list. 610 @var{fexp} can be a symbol, a number, or a list.
611 611
612 If @var{fexp} is a symbol, it is looked up in the `features' variable, 612 If @var{fexp} is a symbol, it is looked up in the @code{features} variable,
613 and @code{t} is returned if it is found, @code{nil} otherwise. 613 and @code{t} is returned if it is found, @code{nil} otherwise.
614 614
615 If @var{fexp} is a number, the function returns @code{t} if this Emacs 615 If @var{fexp} is a number, the function returns @code{t} if this Emacs
616 has an equal or greater number than @code{fexp}, @code{nil} otherwise. 616 has an equal or greater number than @var{fexp}, @code{nil} otherwise.
617 Note that minor Emacs version is expected to be 2 decimal places wide, 617 Note that minor Emacs version is expected to be 2 decimal places wide,
618 so @code{(featurep 20.4)} will return @code{nil} on XEmacs 20.4---you 618 so @code{(featurep 20.4)} will return @code{nil} on XEmacs 20.4---you
619 must write @code{(featurep 20.04)}, unless you wish to match for XEmacs 619 must write @code{(featurep 20.04)}, unless you wish to match for XEmacs
620 20.40. 620 20.40.
621 621
625 625
626 If @var{fexp} is a list whose car is the symbol @code{or}, the function 626 If @var{fexp} is a list whose car is the symbol @code{or}, the function
627 returns @code{t} if any the features in its cdr are present, @code{nil} 627 returns @code{t} if any the features in its cdr are present, @code{nil}
628 otherwise. 628 otherwise.
629 629
630 If @var{fexp} is a list whose car is the symbol @code{not}, the function 630 If @var{fexp} is a list whose car is the symbol @code{not}, the function
631 returns @code{t} if the feature is not present, @code{nil} otherwise. 631 returns @code{t} if the feature is not present, @code{nil} otherwise.
632 632
633 Examples: 633 Examples:
634 634
635 @example 635 @example