annotate lisp/autoload.el @ 5917:ffb5abc8dc4e

Fix a bug in the #'equalp compiler macro. lisp/ChangeLog addition: 2015-06-11 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (equalp): Fix a bug in this compiler macro when passed constants in a certain order. tests/ChangeLog addition: 2015-06-11 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Add a test looking for a bug just fixed in the equalp compiler macro.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 11 Jun 2015 16:09:11 +0100
parents 4a6f90020a59
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1 ;;; autoload.el --- maintain autoloads in auto-autoloads files.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
1753
588465af3ca1 [xemacs-hg @ 2003-10-15 09:19:08 by stephent]
stephent
parents: 1733
diff changeset
3 ;; Copyright (C) 1991-1994, 1997, 2003 Free Software Foundation, Inc.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
5070
b0f4adffca7d fix so that CL docstrings (with &key, etc.) handled properly
Ben Wing <ben@xemacs.org>
parents: 4783
diff changeset
5 ;; Copyright (C) 1996, 2000, 2002, 2003, 2004, 2010 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
7 ;; Original Author: Roland McGrath <roland@gnu.ai.mit.edu>
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
8 ;; Heavily Modified: XEmacs Maintainers
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Keywords: maint
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
13 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
14 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
15 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
16 ;; option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
19 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
20 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
21 ;; for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5101
diff changeset
24 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
26 ;;; Synched up with: FSF 21.2 by Ben Wing.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
27 ;;; Note that update-file-autoloads is seriously modified and not really
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
28 ;;; syncable.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
32 ;; This code keeps auto-autoloads.el files up to date. It interprets
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
33 ;; magic cookies (of the form ";;;###autoload" in Lisp source files
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
34 ;; and "/* ###autoload */" in C source files) in various useful ways.
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
35 ;; It is also used to maintain custom-defines.el files, since most of
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
36 ;; the logic for computing them is the same as for auto-autoloads.el.
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
37
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
38 ;; Usage
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
39 ;; =====
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
40
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
41 ;; Recommended usage for this library, as implemented in the core
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
42 ;; build process, is
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
43
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
44 ;; xemacs -no-packages -batch \
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
45 ;; -l autoload -f batch-update-directory-autoloads PREFIX DIRECTORY
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
46
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
47 ;; which causes XEmacs to update the file named by PATH from the .el
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
48 ;; files in DIRECTORY (but not recursing into subdirectories) and (if
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
49 ;; the autoload file is not already protected with a feature test) add
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
50 ;; a check and provide for 'PREFIX-autoloads. Currently there is no
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
51 ;; sanity check for the provided feature; it is recommended that you
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
52 ;; nuke any existing auto-autoloads.el before running the command.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
53
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
54 ;; There is not yet a recommended API for updating multiple directories
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
55 ;; into a single auto-autoloads file. Using the recipe above for each
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
56 ;; DIRECTORY with the same PATH should work but has not been tested.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
57 ;; There is no API for recursing into subdirectories. There probably
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
58 ;; won't be; given the wide variety of ways that existing Lisp packages
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
59 ;; arrange their files, and the fact that source packages and installed
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
60 ;; packages have a somewhat different directory structure, this seems far
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
61 ;; too risky. Use a script or a Lisp library with an explicit list of
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
62 ;; PATHs; see update-elc.el for how to do this without recursive invocation
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
63 ;; of XEmacs).
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
64
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
65 ;; The probable next step is to fix up the packages to use the
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
66 ;; `batch-update-directory-autoloads' API. However, for backward
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
67 ;; compatibility with XEmacs 21.4 and 21.1, this can't be done quickly.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
68
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
69 ;; For backward compatibility the API used in the packages/XEmacs.rules:
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
70
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
71 ;; xemacs -vanilla -batch -eval "$(AUTOLOAD_PACKAGE_NAME)" \
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
72 ;; -l autoload -f batch-update-autoloads $(AUTOLOAD_PATH)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
73
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
74 ;; is supported, and the implementation is unchanged. However,
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
75 ;; revision of the API (in a backward compatible way) and the
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
76 ;; implementation are planned, and until those stabilize it is too
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
77 ;; risky to use this version of XEmacs for package releases.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
78
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
79 ;; Implementation:
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
80 ;; ===============
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
81
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
82 ;; #### This section should be moved to the Internals manual, or
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
83 ;; (maybe) the Lispref, and integrated with the information above.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
84 ;; Don't believe anything written here; the code is still a mess, and
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
85 ;; this is a lot of guesswork.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
86
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
87 ;; Autoloads are used in a number of contexts, including core Lisp,
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
88 ;; packaged Lisp, and ELLs (dynamically loadable compiled objects
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
89 ;; providing Lisp functionality). There two general strategies for
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
90 ;; collecting autoloads. The first is to put autoloads for a package
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
91 ;; in a package-specific auto-autoloads file. This is easy to
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
92 ;; implement, and allows packages to be distributed with prebuilt
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
93 ;; auto-autoloads files. The second is to collect all the autoloads
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
94 ;; in a single global auto-autoloads file. This is alleged to speed
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
95 ;; up initialization significantly, but requires care to ensure that
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
96 ;; auto-autoloads files remain synchronized with the libraries.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
97
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
98 ;; The traditional logic for determining where to put autoload
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
99 ;; definitions is complex and is now deprecated. The special variable
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
100 ;; `generated-autoload-file' is used to hold the path to the file, and
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
101 ;; is initialized to the traditional (well, it's a new tradition with
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
102 ;; XEmacs 20) $blddir/lisp/auto-autoloads.el. However, this variable
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
103 ;; may be bound by calling code, or may be generated at collect time
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
104 ;; and I'm not even sure the initialized value was ever used any more.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
105
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
106 ;; Because there may be multiple auto-autoloads files in use (in XEmacs
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
107 ;; 21.x with a full complement of packages there are dozens), and they may
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
108 ;; contain initializations that would be dangerous to reexecute, each is
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
109 ;; protected by a feature test. By convention, the feature symbol is of
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
110 ;; the form "NAME-autoloads". For packages, the special variable
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
111 ;; `autoload-package-name' is used to determine NAME. In the core,
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
112 ;; autoloads are defined in the modules (all of which are collected in a
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
113 ;; single auto-autoloads file), using NAME=modules, in the lisp directory
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
114 ;; using NAME=lisp, and in the lisp/mule directory, using NAME=mule, for
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
115 ;; the autoloads feature. These latter are computed by the autoloads
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
116 ;; function at collect time.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 ;; ChangeLog:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
120 ;; See ./ChangeLog.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
124 ;; Need to load easy-mmode because we expand macro calls to easy-mmode
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
125 ;; macros in make-autoloads below.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
126 (require 'easy-mmode)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
127
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
128 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
129 ;; Standard file and directory names
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
130
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
131 ;; `autoload-file-name' is defvar'd and initialized in packages.el,
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
132 ;; which is loaded (and dumped) very early. If you find it isn't, you
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
133 ;; know what you're doing.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
134
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
135 (defconst autoload-target-directory "../lisp/"
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
136 "Standard directory containing autoload declaration file.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
137
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
138 Use `generated-autoload-file' (q.v.) to change its installation location.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
139
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
140 ;; Dynamic variables for communication among functions
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
141
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
142 ;; FSF 21.2:
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
143 ;; The autoload file is assumed to contain a trailer starting with a FormFeed
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
144 ;; character.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
145
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
146 (defvar generated-autoload-file
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
147 (expand-file-name autoload-file-name lisp-directory)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
148 "*File `update-file-autoloads' puts autoloads into.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
149 A .el file can set this in its local variables section to make its
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
150 autoloads go somewhere else.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
151
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
152 Note that `batch-update-directory' binds this variable to its own value,
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
153 generally the file named by `autoload-file-name' in the directory being
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
154 updated. XEmacs.rules setq's this variable for package autoloads.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
155
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
156 (defvar generate-autoload-function
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
157 #'generate-file-autoloads
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
158 "Function to generate the autoloads for a file and insert at point.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
159 Called with one argument, the file.")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
160
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
161 (define-obsolete-variable-alias 'autoload-package-name
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
162 'autoload-feature-prefix)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
163 (defvar autoload-feature-prefix nil
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
164 "If non-nil, use this string to prefix the autoload feature name.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
165
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
166 Usually a package name (from AUTOLOAD_PACKAGE_NAME, defined in XEmacs.rules
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
167 in the top of the package hierarchy), or \"auto\" (reserved for the core Lisp
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
168 auto-autoloads file). Highest priority candidate except for an explicit
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
169 argument to `autoload-make-feature-name' (q.v.).")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
170
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
171 (defvar autoload-feature-suffix "-autoloads"
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
172 "String added to `autoload-feature-prefix' to create the autoload feature name.")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
173
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
174 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
175 ;; Magic strings in source files
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
176
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
177 (defconst generate-autoload-cookie ";;;###autoload"
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
178 "Magic comment indicating the following form should be autoloaded.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
179 Used by `update-file-autoloads'. This string should be
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
180 meaningless to Lisp (e.g., a comment).
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
181
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
182 This string is used:
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
183
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
184 ;;;###autoload
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
185 \(defun function-to-be-autoloaded () ...)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
186
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
187 If this string appears alone on a line, the following form will be
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
188 read and an autoload made for it. If it is followed by the string
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
189 \"immediate\", then the form on the following line will be copied
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
190 verbatim. If there is further text on the line, that text will be
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
191 copied verbatim to `generated-autoload-file'.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
192
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
193 (defconst generate-c-autoload-cookie "/* ###autoload"
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
194 "Magic C comment indicating the following form should be autoloaded.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
195 Used by `update-file-autoloads'. This string should be
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
196 meaningless to C (e.g., a comment).
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
197
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
198 This string is used:
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
199
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
200 /* ###autoload */
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
201 DEFUN (\"function-to-be-autoloaded\", ... )
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
202
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
203 If this string appears alone on a line, the following form will be
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
204 read and an autoload made for it. If there is further text on the line,
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
205 that text will be copied verbatim to `generated-autoload-file'.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
206
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
207 (defconst generate-c-autoload-module "/* ###module"
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
208 "Magic C comment indicating the module containing autoloaded functions.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
209 Since a module can consist of multiple C files, the module name may not be
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
210 the same as the C source file base name. In that case, use this comment to
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
211 indicate the actual name of the module from which to autoload functions.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
212
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
213 (defconst generate-autoload-section-header "\f\n;;;### "
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
214 "String inserted before the form identifying
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
215 the section of autoloads for a file.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
216
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
217 (defconst generate-autoload-section-trailer "\n;;;***\n"
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
218 "String which indicates the end of the section of autoloads for a file.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
219
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
220 (defconst generate-autoload-section-continuation ";;;;;; "
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
221 "String to add on each continuation of the section header form.")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
222
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
223 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
224 ;; Parsing the source file text.
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
225 ;; Autoloads in C source differ from those in Lisp source.
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
226
4425
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
227 ; Add operator definitions to autoload-operators.el in the xemacs-base
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
228 ; package.
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
229 (ignore-errors (require 'autoload-operators))
4352
d2f4dd8611d9 Factor out lists of operators specially treated by 'make-autoload'.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4332
diff changeset
230
4425
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
231 ; As autoload-operators is new, provide stopgap measure for a while.
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
232 (if (not (boundp 'autoload-make-autoload-operators))
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
233 (progn
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
234 (defvar autoload-make-autoload-operators
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
235 '(defun define-skeleton defmacro define-derived-mode define-generic-mode
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
236 easy-mmode-define-minor-mode easy-mmode-define-global-mode
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
237 define-minor-mode defun* defmacro*)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
238 "`defun'-like operators that use `autoload' to load the library.")
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
239
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
240 (defvar autoload-make-autoload-complex-operators
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
241 '(easy-mmode-define-minor-mode easy-mmode-define-global-mode
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
242 define-minor-mode)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
243 "`defun'-like operators to macroexpand before using `autoload'.")
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
244
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
245 (put 'autoload 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
246 (put 'defun 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
247 (put 'defun* 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
248 (put 'defvar 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
249 (put 'defcustom 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
250 (put 'defconst 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
251 (put 'defmacro 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
252 (put 'defmacro* 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
253 (put 'defsubst 'doc-string-elt 3)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
254 (put 'define-skeleton 'doc-string-elt 2)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
255 (put 'define-derived-mode 'doc-string-elt 4)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
256 (put 'easy-mmode-define-minor-mode 'doc-string-elt 2)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
257 (put 'define-minor-mode 'doc-string-elt 2)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
258 (put 'define-generic-mode 'doc-string-elt 7)
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
259 ;; defin-global-mode has no explicit docstring.
bfb8a26de3cb Move autoload operator definitions to xemacs-base.
Mike Sperber <sperber@deinprogramm.de>
parents: 4352
diff changeset
260 (put 'easy-mmode-define-global-mode 'doc-string-elt 1000)))
4352
d2f4dd8611d9 Factor out lists of operators specially treated by 'make-autoload'.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4332
diff changeset
261
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 (defun make-autoload (form file)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
263 "Turn FORM into an autoload or defvar for source file FILE.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
264 Returns nil if FORM is not a special autoload form (i.e. a function definition
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
265 or macro definition or a defcustom)."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
266 (let ((car (car-safe form)) expand)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
267 (cond
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
268 ;; For complex cases, try again on the macro-expansion.
4352
d2f4dd8611d9 Factor out lists of operators specially treated by 'make-autoload'.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4332
diff changeset
269 ((and (memq car autoload-make-autoload-complex-operators)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
270 (setq expand (let ((load-file-name file)) (macroexpand form)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
271 (eq (car expand) 'progn)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
272 (memq :autoload-end expand))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
273 (let ((end (memq :autoload-end expand)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
274 ;; Cut-off anything after the :autoload-end marker.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
275 (setcdr end nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
276 (cons 'progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
277 (mapcar (lambda (form) (make-autoload form file))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
278 (cdr expand)))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
279
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
280 ;; For special function-like operators, use the `autoload' function.
4352
d2f4dd8611d9 Factor out lists of operators specially treated by 'make-autoload'.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4332
diff changeset
281 ((memq car autoload-make-autoload-operators)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
282 (let* ((macrop (memq car '(defmacro defmacro*)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
283 (name (nth 1 form))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
284 (body (nthcdr (get car 'doc-string-elt) form))
4702
eb1a409c317b Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents: 4695
diff changeset
285 (doc (if (stringp (car body)) (pop body))))
5578
4a6f90020a59 Avoid redundant arglist information, #'make-autoload.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
286 (if (and (memq car '(defmacro defmacro* defun defun*))
4a6f90020a59 Avoid redundant arglist information, #'make-autoload.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
287 (not (and doc (save-match-data
4a6f90020a59 Avoid redundant arglist information, #'make-autoload.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
288 (string-match
4a6f90020a59 Avoid redundant arglist information, #'make-autoload.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
289 "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'"
4a6f90020a59 Avoid redundant arglist information, #'make-autoload.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
290 doc)))))
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 5070
diff changeset
291 (let ((arglist (nth 2 form)))
4702
eb1a409c317b Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents: 4695
diff changeset
292 (setq doc (concat (or doc "")
eb1a409c317b Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents: 4695
diff changeset
293 "\n\narguments: "
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 5070
diff changeset
294 (cl-function-arglist arglist)
5070
b0f4adffca7d fix so that CL docstrings (with &key, etc.) handled properly
Ben Wing <ben@xemacs.org>
parents: 4783
diff changeset
295 "\n"))))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
296 ;; `define-generic-mode' quotes the name, so take care of that
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
297 (list 'autoload (if (listp name) name (list 'quote name)) file doc
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
298 (or (and (memq car '(define-skeleton define-derived-mode
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
299 define-generic-mode
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
300 easy-mmode-define-global-mode
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
301 easy-mmode-define-minor-mode
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
302 define-minor-mode)) t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
303 (eq (car-safe (car body)) 'interactive))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
304 (if macrop (list 'quote 'macro) nil))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
305
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
306 ;; Convert defcustom to a simpler (and less space-consuming) defvar,
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
307 ;; but add some extra stuff if it uses :require.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
308 ((eq car 'defcustom)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
309 (let ((varname (car-safe (cdr-safe form)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
310 (init (car-safe (cdr-safe (cdr-safe form))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
311 (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form)))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
312 (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form))))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
313 (if (not (plist-get rest :require))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
314 `(defvar ,varname ,init ,doc)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
315 `(progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
316 (defvar ,varname ,init ,doc)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
317 (custom-add-to-group ,(plist-get rest :group)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
318 ',varname 'custom-variable)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
319 (custom-add-load ',varname
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
320 ,(plist-get rest :require))))))
4303
cee827542370 [xemacs-hg @ 2007-12-04 20:18:33 by aidan]
aidan
parents: 4256
diff changeset
321 ;; Coding systems. #### Would be nice to handle the docstring here too.
cee827542370 [xemacs-hg @ 2007-12-04 20:18:33 by aidan]
aidan
parents: 4256
diff changeset
322 ((memq car '(make-coding-system make-8-bit-coding-system))
cee827542370 [xemacs-hg @ 2007-12-04 20:18:33 by aidan]
aidan
parents: 4256
diff changeset
323 `(autoload-coding-system ,(nth 1 form) '(load ,file)))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
324 ;; nil here indicates that this is not a special autoload form.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
325 (t nil))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
327 (defun make-c-autoload (module)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
328 "Make an autoload list for the DEFUN at point in MODULE.
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
329 Returns nil if the DEFUN is malformed."
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
330 (and
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
331 ;; Match the DEFUN
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
332 (search-forward "DEFUN" nil t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
333 ;; Match the opening parenthesis
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
334 (progn
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
335 (skip-syntax-forward " ")
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
336 (eq (char-after) ?\())
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
337 ;; Match the opening quote of the Lisp function name
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
338 (progn
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
339 (forward-char)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
340 (skip-syntax-forward " ")
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
341 (eq (char-after) ?\"))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
342 ;; Extract the Lisp function name, interactive indicator, and docstring
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
343 (let* ((func-name (let ((begin (progn (forward-char) (point))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
344 (search-forward "\"" nil t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
345 (backward-char)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
346 (intern (buffer-substring begin (point)))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
347 (interact (progn
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
348 (search-forward "," nil t 4)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
349 (skip-syntax-forward " ")
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
350 (not (eq (char-after) ?0))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
351 (begin (progn
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
352 (search-forward "/*" nil t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
353 (forward-line 1)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
354 (point))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
355 (search-forward "*/" nil t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
356 (goto-char (match-beginning 0))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
357 (skip-chars-backward " \t\n\f")
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
358 (list 'autoload (list 'quote func-name) module
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
359 (buffer-substring begin (point)) interact nil))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
360
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
361 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
362 ;; Generating autoloads for a single file
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 ;;;###autoload
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
365 (defun generate-file-autoloads (file)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
366 "Insert at point an autoload section for FILE.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 autoloads are generated for defuns and defmacros in FILE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 marked by `generate-autoload-cookie' (which see).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 If FILE is being visited in a buffer, the contents of the buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 are used."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 (interactive "fGenerate autoloads for file: ")
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
372 (cond ((string-match "\\.el$" file)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
373 (generate-autoload-type-section
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
374 file
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
375 (replace-in-string (file-name-nondirectory file) "\\.elc?$" "")
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
376 nil #'generate-lisp-file-autoloads-1))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
377 ;; #### jj, are C++ modules possible?
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
378 ((string-match "\\.c$" file)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
379 (generate-autoload-type-section
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
380 file
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
381 (replace-in-string (file-name-nondirectory file) "\\.c$" "")
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
382 t #'generate-c-file-autoloads-1))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
383 (t
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
384 (error 'wrong-type-argument file "not a C or Elisp source file"))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
386 (defun* generate-autoload-type-section (file load-name literal fun-to-call)
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
387 "Insert at point an autoload-type section for FILE.
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
388 LOAD-NAME is the non-directory portion of the name, with the final .el, .elc
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
389 or .c section removed. If LITERAL, open the file literally, without decoding.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
390 Calls FUN-TO-CALL to compute the autoloads, with the loaded file in the
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
391 current buffer, passing it OUTBUF (where to write the autoloads), LOAD-NAME,
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
392 and TRIM-NAME (result of calling `autoload-trim-file-name' on FILE)."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 (let ((outbuf (current-buffer))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
394 (trim-name (autoload-trim-file-name file))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 (autoloads-done '())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 (print-length nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 (print-readably t) ; XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 (float-output-format nil)
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
399 (visited (get-file-buffer file))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
400 suppress-form
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 ;; (done-any nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 output-end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 ;; If the autoload section we create here uses an absolute
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 ;; pathname for FILE in its header, and then Emacs is installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 ;; under a different path on another system,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 ;; `update-autoloads-here' won't be able to find the files to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 ;; autoloaded. So, if FILE is in the same directory or a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 ;; subdirectory of the current buffer's directory, we'll make it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 ;; relative to the current buffer's directory.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 (setq file (expand-file-name file))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
412 ;; #### FSF 21.2. Do we want this?
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
413 ; (let* ((source-truename (file-truename file))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
414 ; (dir-truename (file-name-as-directory
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
415 ; (file-truename default-directory)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
416 ; (len (length dir-truename)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
417 ; (if (and (< len (length source-truename))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
418 ; (string= dir-truename (substring source-truename 0 len)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
419 ; (setq file (substring source-truename len))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
420
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
421 ;; Check for suppression form (XEmacs)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
422 (let* ((dir (file-name-directory file))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
423 (_pkg (expand-file-name "_pkg.el" dir))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
424 (pkg-vis (get-file-buffer _pkg))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
425 pkg-buf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
426 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
427 (when (file-readable-p _pkg)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
428 (unwind-protect
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
429 (progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
430 (let ((find-file-hooks nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
431 (enable-local-variables nil))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
432 (set-buffer (or pkg-vis (find-file-noselect _pkg)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
433 (set-syntax-table emacs-lisp-mode-syntax-table))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
434 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
435 (save-restriction
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
436 (widen)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
437 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
438 (block nil
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
439 (while (search-forward "(package-suppress" nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
440 ;; skip over package-name
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
441 (forward-sexp 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
442 (let ((supfile (read (current-buffer))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
443 (when (equal supfile load-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
444 (setq suppress-form (eval (read (current-buffer))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
445 (return))))))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
446 (unless pkg-vis
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
447 ;; We created this buffer, so we should kill it.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
448 (if pkg-buf (kill-buffer pkg-buf)))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 (progn
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
453 (let (;(find-file-hooks nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
454 ;(enable-local-variables nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
455 )
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
456 (set-buffer (or visited (find-file-noselect file literal literal
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
457 )))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
458 ;; This doesn't look right for C files, but it is. The only
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
459 ;; place we need the syntax table is when snarfing the Lisp
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
460 ;; function name.
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 442
diff changeset
461 (set-syntax-table emacs-lisp-mode-syntax-table))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
462 ; (if visited
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
463 ; (set-buffer visited)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
464 ; ;; It is faster to avoid visiting the file.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
465 ; (set-buffer (get-buffer-create " *generate-autoload-file*"))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
466 ; (kill-all-local-variables)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
467 ; (erase-buffer)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
468 ; (setq buffer-undo-list t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
469 ; buffer-read-only nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
470 ; ;; This doesn't look right for C files, but it is. The only
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
471 ; ;; place we need the syntax table is when snarfing the Lisp
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
472 ; ;; function name.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
473 ; (emacs-lisp-mode)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
474 ; (if literal
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
475 ; (insert-file-contents-literally file nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
476 ; (insert-file-contents file nil)))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
477 (unless (setq autoloads-done
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
478 (funcall fun-to-call outbuf load-name trim-name))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
479 (return-from generate-autoload-type-section))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
480 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 (unless visited
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
482 ;; We created this buffer, so we should kill it.
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
483 (kill-buffer (current-buffer)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 (set-buffer outbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 (setq output-end (point-marker))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 (if t ;; done-any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 ;; XEmacs -- always do this so that we cache the information
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 ;; that we've processed the file already.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 (progn
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
490 ;; Insert the section-header line
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
491 ;; which lists the file name and which functions are in it, etc.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 (insert generate-autoload-section-header)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
493 (prin1 (list 'autoloads autoloads-done load-name trim-name
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
494 ;; In FSF 21.2. Also in FSF 19.30. Presumably
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
495 ;; deleted from XEmacs.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
496 ;; (nth 5 (file-attributes file))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
497 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 outbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 (terpri outbuf)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
500 ;; #### Alas, we will have to think about this. Adding this means
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
501 ;; that, once we have created or maintained an auto-autoloads file,
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
502 ;; we alone and our successors can update the file. The file itself
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
503 ;; will work fine in older XEmacsen, but they won't be able to
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
504 ;; update autoloads -- hence, to build.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
505 ; ;; Break that line at spaces, to avoid very long lines.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
506 ; ;; Make each sub-line into a comment.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
507 ; (with-current-buffer outbuf
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
508 ; (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
509 ; (forward-line -1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
510 ; (while (not (eolp))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
511 ; (move-to-column 64)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
512 ; (skip-chars-forward "^ \n")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
513 ; (or (eolp)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
514 ; (insert "\n" generate-autoload-section-continuation)))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
515 ;; XEmacs: This was commented out before. #### Correct?
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
516 ; (insert ";;; Generated autoloads from "
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
517 ; (autoload-trim-file-name file) "\n")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
518 ;; XEmacs -- handle suppression
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
519 (when suppress-form
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
520 (insert "\n;;; Suppress form from _pkg.el\n")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
521 (insert "(unless " (prin1-to-string suppress-form) "\n\n"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 (goto-char output-end)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
523 ;; XEmacs -- handle suppression
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
524 (when suppress-form
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
525 (insert "\n) ;; unless (suppressed)\n"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 (insert generate-autoload-section-trailer)))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
527 ))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
528
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
530 (defun process-one-lisp-autoload (autoloads-done outbuf load-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
531 "Process a single autoload at point and write to OUTBUF.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
532 Point should be just after a magic cookie string (e.g. ;;;###autoload).
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
533 Updates AUTOLOADS-DONE and returns the new value."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
534 (skip-chars-forward " \t")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
535 ;; (setq done-any t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
536 (if (eolp)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
537 ;; Read the next form and make an autoload.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
538 (let* ((form (prog1 (read (current-buffer))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
539 (or (bolp) (forward-line 1))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
540 (autoload (make-autoload form load-name)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
541 (if autoload
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
542 (setq autoloads-done (cons (nth 1 form)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
543 autoloads-done))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
544 (setq autoload form))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
545 (autoload-print-form autoload outbuf ""))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
546 ;; Copy the rest of the line to the output.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
547 (cond ((looking-at "immediate\\s *$") ; XEmacs
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
548 ;; This is here so that you can automatically
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
549 ;; have small hook functions copied to
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
550 ;; auto-autoloads.el so that it's not necessary
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
551 ;; to load a whole file just to get a two-line
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
552 ;; do-nothing find-file-hook... --Stig
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
553 (forward-line 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
554 (let ((begin (point)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
555 (forward-sexp)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
556 (forward-line 1)
4332
6ad202d453cb Insert <immediate> into section header for immediate autoloads.
Mike Sperber <sperber@deinprogramm.de>
parents: 4303
diff changeset
557 (princ (buffer-substring begin (point)) outbuf))
6ad202d453cb Insert <immediate> into section header for immediate autoloads.
Mike Sperber <sperber@deinprogramm.de>
parents: 4303
diff changeset
558 (setq autoloads-done (cons '<immediate> autoloads-done)))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
559 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
560 (princ (buffer-substring
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
561 (progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
562 ;; Back up over whitespace, to preserve it.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
563 (skip-chars-backward " \f\t")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
564 (if (= (char-after (1+ (point))) ? )
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
565 ;; Eat one space.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
566 (forward-char 1))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
567 (point))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
568 (progn (forward-line 1) (point)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
569 outbuf))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
570 autoloads-done)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
571
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
572 (defun* generate-lisp-file-autoloads-1 (outbuf load-name trim-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
573 "Insert at point in OUTBUF an autoload section for an Elisp file.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
574 The file is assumed to be already loaded and in the current buffer.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
575 autoloads are generated for defuns and defmacros marked by
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
576 `generate-autoload-cookie' (which see)."
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
577 (let ((autoloads-done '())
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
578 )
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
579 (save-excursion
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
580 (save-restriction
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
581 (widen)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
582 (goto-char (point-min))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
583 (unless (search-forward generate-autoload-cookie nil t)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
584 (message "No autoloads found in %s" trim-name)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
585 (return-from generate-lisp-file-autoloads-1 nil))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
586
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
587 (message "Generating autoloads for %s..." trim-name)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
588 (goto-char (point-min))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
589 (while (not (eobp))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
590 (skip-chars-forward " \t\n\f")
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
591 (cond
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
592 ((looking-at (regexp-quote generate-autoload-cookie))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
593 (search-forward generate-autoload-cookie)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
594 (setq autoloads-done
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
595 (process-one-lisp-autoload autoloads-done outbuf load-name)))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
596 ((looking-at ";")
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
597 ;; Don't read the comment.
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
598 (forward-line 1))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
599 (t
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
600 (forward-sexp 1)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
601 (forward-line 1)))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
602 )))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
603 (or noninteractive ; XEmacs: only need one line in -batch mode.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
604 (message "Generating autoloads for %s...done" trim-name))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
605 autoloads-done))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
606
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
607 (defun* generate-c-file-autoloads-1 (outbuf load-name trim-name
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
608 &optional funlist)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
609 "Insert at point an autoload section for the C file FILE.
1048
edc95b5fe4cb [xemacs-hg @ 2002-10-11 14:09:46 by james]
james
parents: 996
diff changeset
610 autoloads are generated for defuns and defmacros in FILE
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
611 marked by `generate-c-autoload-cookie' (which see).
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
612 If FILE is being visited in a buffer, the contents of the buffer
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
613 are used."
1733
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
614 (let ((exists-p-format
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
615 "(when (locate-file \"%s\" module-load-path module-extensions)\n")
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
616 autoloads-done)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
617 (save-excursion
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
618 (save-restriction
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
619 (widen)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
620 (goto-char (point-min))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
621 ;; Is there a module name comment?
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
622 (when (search-forward generate-c-autoload-module nil t)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
623 (skip-chars-forward " \t")
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
624 (let ((begin (point)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
625 (skip-chars-forward "^ \t\n\f")
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
626 (setq load-name (buffer-substring begin (point)))))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
627 (if funlist
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
628 (progn
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
629 (message "Generating autoloads for %s..." trim-name)
1733
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
630 (princ (format exists-p-format load-name) outbuf)
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
631 (dolist (arg funlist)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
632 (goto-char (point-min))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
633 (re-search-forward
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
634 (concat "DEFUN (\""
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
635 (regexp-quote (symbol-name arg))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
636 "\""))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
637 (goto-char (match-beginning 0))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
638 (let ((autoload (make-c-autoload load-name)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
639 (when autoload
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
640 (push (nth 1 (nth 1 autoload)) autoloads-done)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
641 (autoload-print-form autoload outbuf " "))))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
642 ;; close the princ'd `when' form
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
643 (princ ")" outbuf))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
644 (goto-char (point-min))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
645 (let ((match
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
646 (search-forward generate-c-autoload-cookie nil t)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
647 (unless match
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
648 (message "No autoloads found in %s" trim-name)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
649 (return-from generate-c-file-autoloads-1 nil))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
650
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
651 (message "Generating autoloads for %s..." trim-name)
1733
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
652 (princ (format exists-p-format load-name) outbuf)
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
653 (while match
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
654 (forward-line 1)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
655 (let ((autoload (make-c-autoload load-name)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
656 (when autoload
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
657 (push (nth 1 (nth 1 autoload)) autoloads-done)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
658 (autoload-print-form autoload outbuf " ")))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
659 (setq match
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
660 (search-forward generate-c-autoload-cookie nil t)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
661 ;; close the princ'd `when' form
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
662 (princ ")" outbuf)))))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
663 (or noninteractive ; XEmacs: only need one line in -batch mode.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
664 (message "Generating autoloads for %s...done" trim-name))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
665 autoloads-done))
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
666
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
667 ;;;###autoload
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
668 (defun generate-custom-defines (file)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
669 "Insert at point a custom-define section for FILE.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
670 If FILE is being visited in a buffer, the contents of the buffer
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
671 are used."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
672 (interactive "fGenerate custom defines for file: ")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
673 (cond ((string-match "\\.el$" file)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
674 (generate-autoload-type-section
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
675 file
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
676 (replace-in-string (file-name-nondirectory file) "\\.elc?$" "")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
677 nil #'generate-custom-defines-1))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
678 ((string-match "\\.c$" file)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
679 ;; no way to generate custom-defines for C files (currently?),
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
680 ;; but cannot signal an error.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
681 nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
682 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
683 (error 'wrong-type-argument file "not a C or Elisp source file"))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
684
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
685 (defun* generate-custom-defines-1 (outbuf load-name trim-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
686 "Insert at point in OUTBUF a custom-define section for an Elisp file.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
687 This contains all defcustoms and defgroups in the file.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
688 The file is assumed to be already loaded and in the current buffer."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
689 (let* ((search-regexp-1 "^(\\(defcustom\\|defgroup\\) ")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
690 (search-string-2 ";;;###custom-define")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
691 (search-regexp-2 (regexp-quote search-string-2))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
692 (autoloads-done '()))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
693 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
694 (save-restriction
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
695 (widen)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
696 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
697 (unless (or (re-search-forward search-regexp-1 nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
698 (re-search-forward search-regexp-2 nil t))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
699 (message "No custom defines found in %s" trim-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
700 (return-from generate-custom-defines-1 nil))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
701 (message "Generating custom defines for %s..." trim-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
702 (princ "(defconst custom-define-current-source-file " outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
703 (prin1 (file-relative-name (buffer-file-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
704 (symbol-value-in-buffer 'default-directory
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
705 outbuf)) outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
706 (princ ")\n" outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
707
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
708 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
709 (while (not (eobp))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
710 (skip-chars-forward " \t\n\f")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
711 (cond
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
712 ((looking-at search-regexp-1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
713 ;; Read the next form and copy it to make an autoload.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
714 (let* ((form (prog1 (read (current-buffer))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
715 (or (bolp) (forward-line 1))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
716 (autoload form ;(make-autoload form load-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
717 ))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
718 (if autoload
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
719 (setq autoloads-done (cons (nth 1 form)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
720 autoloads-done))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
721 (setq autoload form))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
722 (autoload-print-form autoload outbuf ""))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
723 )
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
724 ((looking-at search-regexp-2)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
725 (search-forward search-string-2)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
726 (beep)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
727 (setq autoloads-done
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
728 (process-one-lisp-autoload autoloads-done outbuf load-name)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
729 ((looking-at ";")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
730 ;; Don't read the comment.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
731 (forward-line 1))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
732 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
733 (forward-sexp 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
734 (forward-line 1)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
735 )))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
736 (or noninteractive ; XEmacs: only need one line in -batch mode.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
737 (message "Generating custom defines for %s...done" trim-name))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
738 autoloads-done))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
739
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
740 ;; Assorted utilities for generating autoloads and pieces thereof
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
741
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
742 (defun autoload-print-form (form outbuf margin)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
743 "Print an autoload form, handling special characters.
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
744 In particular, print docstrings with escapes inserted before left parentheses
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
745 at the beginning of lines and ^L characters."
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
746 (cond
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
747 ;; If the form is a sequence, recurse.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
748 ((eq (car form) 'progn)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
749 (mapcar #'(lambda (x) (autoload-print-form x outbuf margin))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
750 (cdr form)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
751 ;; Symbols at the toplevel are meaningless.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
752 ((symbolp form) nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
753 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
754 (let ((doc-string-elt (get (car-safe form) 'doc-string-elt)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
755 (if (and doc-string-elt (stringp (nth doc-string-elt form)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
756 ;; We need to hack the printing because the doc-string must be
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
757 ;; printed specially for make-docfile (sigh).
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
758 (let* ((p (nthcdr (1- doc-string-elt) form))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
759 (elt (cdr p))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
760 (start-string (format "\n%s(" margin)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
761 (setcdr p nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
762 (princ start-string outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
763 ;; XEmacs change: don't let ^^L's get into
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
764 ;; the file or sorting is hard.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
765 (let ((print-escape-newlines t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
766 ;;#### FSF 21.2 (print-escape-nonascii t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
767 (p (point outbuf))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
768 p2)
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
769 (mapc #'(lambda (elt)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
770 (prin1 elt outbuf)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
771 (princ " " outbuf))
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
772 form)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
773 (with-current-buffer outbuf
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
774 (setq p2 (point-marker))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
775 (goto-char p)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
776 (save-match-data
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
777 (while (search-forward "\^L" p2 t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
778 (delete-char -1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
779 (insert "\\^L")))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
780 (goto-char p2)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
781 (princ "\"\\\n" outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
782 (let ((begin (point outbuf)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
783 (princ (substring (prin1-to-string (car elt)) 1) outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
784 ;; Insert a backslash before each ( that appears at the beginning
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
785 ;; of a line in the doc string.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
786 (with-current-buffer outbuf
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
787 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
788 (while (search-backward start-string begin t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
789 (forward-char 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
790 (insert "\\"))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
791 (if (null (cdr elt))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
792 (princ ")" outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
793 (princ " " outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
794 (princ (substring (prin1-to-string (cdr elt)) 1) outbuf))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
795 (terpri outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
796 (princ margin outbuf)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
797 ;; XEmacs change: another ^L hack
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
798 (let ((p (point outbuf))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
799 (print-escape-newlines t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
800 ;;#### FSF 21.2 (print-escape-nonascii t)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
801 p2)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
802 (print form outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
803 (with-current-buffer outbuf
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
804 (setq p2 (point-marker))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
805 (goto-char p)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
806 (save-match-data
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
807 (while (search-forward "\^L" p2 t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
808 (delete-char -1)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
809 (insert "\\^L")))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
810 (goto-char p2))))))))
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
811
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
812 (defun autoload-trim-file-name (file)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
813 "Returns relative pathname of FILE including the last directory.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
815 Hard-codes the directory separator as a forward slash."
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
816 (setq file (expand-file-name file))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
817 (replace-in-string
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
818 (file-relative-name file (file-name-directory
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
819 (directory-file-name
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
820 (file-name-directory file))))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
821 ;; #### is this a good idea?
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
822 "\\\\" "/"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
824 (defun autoload-read-section-header ()
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
825 "Read a section header form.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
826 Since continuation lines have been marked as comments,
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
827 we must copy the text of the form and remove those comment
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
828 markers before we call `read'."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
829 (save-match-data
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
830 (let ((beginning (point))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
831 string)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
832 (forward-line 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
833 (while (looking-at generate-autoload-section-continuation)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
834 (forward-line 1))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
835 (setq string (buffer-substring beginning (point)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
836 (with-current-buffer (get-buffer-create " *autoload*")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
837 (erase-buffer)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
838 (insert string)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
839 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
840 (while (search-forward generate-autoload-section-continuation nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
841 (replace-match " "))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
842 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
843 (read (current-buffer))))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
844
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 (defun update-file-autoloads (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 "Update the autoloads for FILE in `generated-autoload-file'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 \(which FILE might bind in its local variables).
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
849 This function is a no-op for an autoloads file (ie, a file whose name is
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
850 equal to `autoload-file-name')."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 (interactive "fUpdate autoloads for file: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 (setq file (expand-file-name file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 (when (and (file-newer-than-file-p file generated-autoload-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 (not (member (file-name-nondirectory file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 (list autoload-file-name))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 (let ((load-name (replace-in-string (file-name-nondirectory file)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
858 "\\.\\(elc?\\|c\\)$"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 ""))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 (trim-name (autoload-trim-file-name file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 section-begin form)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 (save-excursion
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
863 ;; FSF has: [[ We want to get a value for generated-autoload-file
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
864 ;; from the local variables section if it's there. ]] Not
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
865 ;; applicable in XEmacs, since we always keep the autoloads
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
866 ;; up-to-date.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
867
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
868 ;; #### FSF 21.2 adds: [[ We must read/write the file without any
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
869 ;; code conversion, but still decode EOLs. ]] Not clear if we need
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
870 ;; this. --ben
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
871 ;; (let ((coding-system-for-read 'raw-text))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 (let ((find-file-hooks nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 (set-buffer (or (get-file-buffer generated-autoload-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 (find-file-noselect generated-autoload-file))))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
875 ;; FSF 21.2 says:
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
876
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
877 ;; [[ This is to make generated-autoload-file have Unix EOLs, so
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
878 ;; that it is portable to all platforms. ]]
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
879 ;; (setq buffer-file-coding-system 'raw-text-unix))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
880 ;; Not applicable in XEmacs, since we always keep the autoloads
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
881 ;; up-to-date and recompile when we build.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
882
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
883 ;; FSF 21.2: [not applicable to XEmacs]
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
884 ; (or (> (buffer-size) 0)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
885 ; (error "Autoloads file %s does not exist" buffer-file-name))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
886 ; (or (file-writable-p buffer-file-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
887 ; (error "Autoloads file %s is not writable" buffer-file-name))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
888
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
889 ;; NOTE: The rest of this function is totally changed from FSF.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
890 ;; Hence, not synched.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
891
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 ;; Make sure we can scribble in it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 (setq buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894 ;; First delete all sections for this file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 (while (search-forward generate-autoload-section-header nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 (setq section-begin (match-beginning 0))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
898 (setq form (autoload-read-section-header))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 (when (string= (nth 2 form) load-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 (search-forward generate-autoload-section-trailer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 (delete-region section-begin (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 ;; Now find insertion point for new section
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 (block find-insertion-point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 (while (search-forward generate-autoload-section-header nil t)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
907 (setq form (autoload-read-section-header))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 (when (string< trim-name (nth 3 form))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 ;; Found alphabetically correct insertion point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 (goto-char (match-beginning 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 (return-from find-insertion-point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 (search-forward generate-autoload-section-trailer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 (when (eq (point) (point-min)) ; No existing entries?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 (goto-char (point-max)))) ; Append.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 ;; Add in new sections for file
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
917 (funcall generate-autoload-function file))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 (when (interactive-p) (save-buffer)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
921 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
922 ;; Utilities for batch updates
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
923
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
924 ;;;###autoload
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
925 (defun batch-update-directory-autoloads ()
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
926 "Update the autoloads for a directory, using a specified feature prefix.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
927 Must be used only with -batch. The feature prefix and directory to update
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
928 are taken from the first and second elements of `command-line-args-left',
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
929 respectively, and they are then removed from `command-line-args-left'.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
930
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
931 Runs `update-file-autoloads' on each file in the given directory. Always
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
932 rewrites the autoloads file, even if unchanged. Makes a feature name by
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
933 applying `autoload-make-feature-name' to the specified feature prefix.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
934
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
935 #### The API and semantics of this function are subject to change."
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
936 (unless noninteractive
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
937 (error "batch-update-directory-autoloads: may be used only with -batch"))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
938 (update-autoload-files (list (cadr command-line-args-left))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
939 (car command-line-args-left) nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
940 (setq command-line-args-left (cddr command-line-args-left)))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
941
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
942 ;;;###autoload
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
943 (defun batch-update-directory-custom-defines ()
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
944 "Update the custom defines for a directory, using a specified feature prefix.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
945 Must be used only with -batch. The feature prefix and directory to update
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
946 are taken from the first and second elements of `command-line-args-left',
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
947 respectively, and they are then removed from `command-line-args-left'.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
948
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
949 Runs `update-file-autoloads' on each file in the given directory. Always
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
950 rewrites the autoloads file, even if unchanged. Makes a feature name by
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
951 applying `autoload-make-feature-name' to the specified feature prefix.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
952
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
953 #### The API and semantics of this function are subject to change."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
954 (unless noninteractive
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
955 (error "batch-update-directory-custom-defines: may be used only with -batch"))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
956 (update-custom-define-files (list (cadr command-line-args-left))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
957 (car command-line-args-left) nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
958 (setq command-line-args-left (cddr command-line-args-left)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
959
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
960 ;;;###autoload
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
961 (defun update-autoload-files (files-or-dirs feature-prefix
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
962 &optional into-file force)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
963 "Update all the autoload files associated with FILES-OR-DIRS.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
964 FILES-OR-DIRS is a list of files and/or directories to be processed.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
965
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
966 An appropriate autoload file is chosen and a feature constructed for
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
967 each element of FILES-OR-DIRS. Fixup code testing for the autoload file's
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
968 feature and to provide the feature is added.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
969
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
970 If optional INTO-FILE is non-`nil', it should specify a file into which
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
971 the autoloads will be placed. Otherwise, the autoloads will be placed into
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
972 a file named `auto-autoloads.el' in the directory of each element in
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
973 FILES-OR-DIRS.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
974
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
975 FEATURE-PREFIX should be set to an appropriate prefix which will
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
976 be concatenated with \"-autoloads\" to produce the feature name. Otherwise
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
977 the appropriate autoload file for each file or directory (located in that
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
978 directory, or in the directory of the specified file) will be updated with
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
979 the directory's or file's autoloads and the protective forms will be added,
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
980 and the files will be saved. Use of the default here is unreliable, and
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
981 therefore deprecated.
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
982
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
983 Note that if some of FILES-OR-DIRS are directories, recursion goes only
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
984 one level deep.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
985
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
986 If FORCE is non-nil, always save out the autoload files even if unchanged."
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
987 (or (listp files-or-dirs) (setq files-or-dirs (list files-or-dirs)))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
988 (let ((defdir (directory-file-name default-directory))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
989 ;; value for all-into-one-file
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
990 (autoload-feature-name (autoload-make-feature-name feature-prefix))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
991 (enable-local-eval nil) ; Don't query in batch mode.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
992 (autoload-feature-prefix feature-prefix)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
993 ;; protect from change
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
994 (generated-autoload-file generated-autoload-file))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
995 (dolist (arg files-or-dirs)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
996 (setq arg (expand-file-name arg defdir))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
997 (cond
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
998 ((file-directory-p arg)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
999 (setq generated-autoload-file
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1000 (or into-file (expand-file-name autoload-file-name arg)))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1001 (message "Updating autoloads for directory %s..." arg)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1002 (let ((simple-dir (file-name-as-directory
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1003 (file-name-nondirectory
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1004 (directory-file-name arg))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1005 (enable-local-eval nil))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1006 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1007 (let ((find-file-hooks nil))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1008 (set-buffer (find-file-noselect generated-autoload-file)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1009 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1010 (while (search-forward generate-autoload-section-header nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1011 (let* ((begin (match-beginning 0))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1012 (form (autoload-read-section-header))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1013 (file (nth 3 form)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1014 (when (and (stringp file)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1015 (string= (file-name-directory file) simple-dir)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1016 (not (file-exists-p
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1017 (expand-file-name
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1018 (file-name-nondirectory file) arg))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1019 ;; Remove the obsolete section.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1020 (search-forward generate-autoload-section-trailer)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1021 (delete-region begin (point)))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1022 ;; Update or create autoload sections for existing files.
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
1023 (mapc 'update-file-autoloads
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
1024 (directory-files arg t "^[^=].*\\.\\(el\\|c\\)$")))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1025 ((file-exists-p arg)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1026 (setq generated-autoload-file
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1027 (or into-file (expand-file-name autoload-file-name
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1028 (file-name-directory arg))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1029 (update-file-autoloads arg))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1030 (t (error "No such file or directory: %s" arg)))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1031 (when (not into-file)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1032 (autoload-featurep-protect-autoloads
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1033 (autoload-make-feature-name
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1034 (or feature-prefix
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1035 (file-name-nondirectory (directory-file-name arg)))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1036 (if force (set-buffer-modified-p
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1037 t (find-file-noselect generated-autoload-file)))))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1038 (when into-file
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1039 (autoload-featurep-protect-autoloads autoload-feature-name)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1040 (if force (set-buffer-modified-p
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1041 t (find-file-noselect into-file))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1042 (save-some-buffers t)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1043 ))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1044
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 ;;;###autoload
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1046 (defun update-custom-define-files (files-or-dirs feature-prefix
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1047 &optional into-file force)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1048 "Update all the custom-define files associated with FILES-OR-DIRS.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1049 Works just like `update-file-autoloads'."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1050 (let* ((autoload-feature-suffix "-custom-defines")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1051 (autoload-file-name "custom-defines.el")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1052 (generate-autoload-function #'generate-custom-defines))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1053 (update-autoload-files files-or-dirs feature-prefix into-file force)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1055 (defun autoload-featurep-protect-autoloads (sym)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 (set-buffer (find-file-noselect generated-autoload-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 (goto-char (point-min))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1059 (cond ((eq (point-min) (point-max)) nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1060 ;; if there's some junk in the file but no sections, just
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1061 ;; delete everything. the junk might be stuff inserted by
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1062 ;; an older version of this function.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1063 ((not (search-forward generate-autoload-section-header nil t))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1064 (delete-region (point-min) (point-max)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1065 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1066 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1067 (when (looking-at ";;; DO NOT MODIFY THIS FILE")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1068 (delete-region (point-min)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1069 (progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1070 (search-forward generate-autoload-section-header)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1071 (match-beginning 0))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1072 ;; Determine and set the coding system for the file if under Mule.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1073 ;; If there are any extended characters in the input file, use
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1074 ;; `escape-quoted' to make sure that both binary and extended
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1075 ;; characters are output properly and distinguished properly.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1076 ;; Otherwise, use `raw-text' for maximum portability with non-Mule
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1077 ;; Emacsen.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1078 (if (or (featurep '(not mule)) ;; Don't scan if no Mule support
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1079 (progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1080 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1081 ;; mrb- There must be a better way than skip-chars-forward
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1082 (skip-chars-forward (concat (char-to-string 0) "-"
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1083 (char-to-string 255)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1084 (eq (point) (point-max))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1085 (setq buffer-file-coding-system 'raw-text-unix)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1086 (setq buffer-file-coding-system 'escape-quoted))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1087 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1088 (insert ";;; DO NOT MODIFY THIS FILE")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1089 ;; NOTE: XEmacs prior to 21.5.12 or so had a bug in that it
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1090 ;; recognized only one of the two magic-cookie styles (the -*- kind)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1091 ;; in find-file, but both of them in load. We go ahead and put both
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1092 ;; in, just to be safe.
5101
65f5d45edc87 fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents: 5076
diff changeset
1093 (insert (format " -*- coding: %s -*-\n" buffer-file-coding-system))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1094 (when (eq buffer-file-coding-system 'escape-quoted)
5101
65f5d45edc87 fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents: 5076
diff changeset
1095 (insert "(or (featurep 'mule) ")
65f5d45edc87 fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents: 5076
diff changeset
1096 (insert "(error \"Loading this file requires Mule support\"))\n"))
65f5d45edc87 fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents: 5076
diff changeset
1097 (insert (format ";;;###coding system: %s\n"
65f5d45edc87 fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents: 5076
diff changeset
1098 buffer-file-coding-system))
65f5d45edc87 fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents: 5076
diff changeset
1099 (insert "(if (featurep '" sym ")")
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1100 (insert " (error \"Feature " sym " already loaded\"))\n")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1101 (goto-char (point-max))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1102 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1103 (forward-line -1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1104 (when (looking-at "(provide")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1105 (delete-region (point) (point-max))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1106 (unless (bolp) (insert "\n"))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1107 (unless (eq (char-before (1- (point))) ?\^L)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1108 (insert "\^L\n"))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1109 (insert "(provide '" sym ")\n")))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1111 (defun autoload-make-feature-name (&optional prefix)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1112 "Generate the feature name to protect this auto-autoloads file from PREFIX.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1114 If PREFIX is nil, it defaults to the value of `autoload-feature-prefix' if
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1115 that is non-nil.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1116
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1117 The feature name must be globally unique for this version of XEmacs,
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1118 including packages.
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1119
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1120 For backward compatibility, if PREFIX and `autoload-feature-prefix' are both
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1121 `nil', PREFIX is computed as the last directory component of
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1122 `generated-autoload-file'. This is likely to result in non-uniqueness, so
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1123 do not use this feature."
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1124 (concat
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1125 (cond (prefix)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1126 (autoload-feature-prefix)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1127 ((stringp generated-autoload-file)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1128 (message "Warning: autoload computing feature prefix.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1129 You should specify it as an argument to `autoload-make-feature-name'.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1130 (file-name-nondirectory
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1131 (directory-file-name
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1132 (file-name-directory generated-autoload-file))))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1133 (t (error 'invalid-argument
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1134 "Could not compute a feature name")))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1135 autoload-feature-suffix))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1136
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1137 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1138 ;; Deprecated entry points
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1139
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1140 ;; A grep of the core and packages shows use of `batch-update-autoloads'
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1141 ;; by XEmacs.rules, pcomplete, eshell, oort-gnus; `batch-update-directory'
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1142 ;; by liece. The other two entry points (`batch-update-one-directory',
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1143 ;; `batch-force-update-one-directory') were not used at all.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1144 ;;
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1145 ;; All except the first are now history. liece has been updated.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1146 ;; XEmacs.rules has been updated. The others will be, eventually.
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1147
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1148 ;; There don't seem to be very many packages that use the first one (the
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1149 ;; "all-into-one-file" variety), and do they actually rely on this
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1150 ;; functionality? --ben
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1151
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1152 ;; but XEmacs.rules does, though maybe it doesn't "rely" on it, and
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1153 ;; modules do now, and that relies on it. --sjt
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1154
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1155 ;;;###autoload
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1156 (defun batch-update-autoloads ()
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1157 "Update the autoloads for the files or directories on the command line.
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1158 Runs `update-file-autoloads' on files and `update-directory-autoloads'
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1159 on directories. Must be used only with -batch, and kills Emacs on completion.
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1160 Each file will be processed even if an error occurred previously.
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1161 For example, invoke `xemacs -batch -f batch-update-autoloads *.el'.
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1162 The directory to which the auto-autoloads.el file must be the first parameter
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1163 on the command line."
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1164 (unless noninteractive
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1165 (error "batch-update-autoloads is to be used only with -batch"))
3431
38d1f63a6b1f [xemacs-hg @ 2006-05-29 21:25:48 by james]
james
parents: 2565
diff changeset
1166 (update-autoload-files command-line-args-left autoload-feature-prefix
38d1f63a6b1f [xemacs-hg @ 2006-05-29 21:25:48 by james]
james
parents: 2565
diff changeset
1167 generated-autoload-file t)
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1168 (kill-emacs 0))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 438
diff changeset
1169
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1170 ;; Declare obsolescence
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1171
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1172 (make-obsolete-variable 'autoload-target-directory
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1173 "Don't use this. Bind `generated-autoload-file' to an absolute path.")
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1174 (make-obsolete 'batch-update-autoloads
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1175 'autoload-update-directory-autoloads)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1176
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 (provide 'autoload)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179 ;;; autoload.el ends here