annotate lisp/autoload.el @ 5512:4aa8ee813265

Add a DESTDIR variable to all Makefiles, defaulting to the empty string, and use it in install targets. See xemacs-patches message <BANLkTinRnwk9qsCfBj_xkcyf7H4sH9fn7A@mail.gmail.com>.
author Jerry James <james@xemacs.org>
date Wed, 25 May 2011 09:15:20 -0600
parents 308d34e9f07d
children 4a6f90020a59
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))))
eb1a409c317b Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents: 4695
diff changeset
286 (if (memq car '(defmacro defmacro* defun defun*))
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 5070
diff changeset
287 (let ((arglist (nth 2 form)))
4702
eb1a409c317b Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents: 4695
diff changeset
288 (setq doc (concat (or doc "")
eb1a409c317b Unbreak autoload.el
Mike Sperber <sperber@deinprogramm.de>
parents: 4695
diff changeset
289 "\n\narguments: "
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 5070
diff changeset
290 (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
291 "\n"))))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
292 ;; `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
293 (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
294 (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
295 define-generic-mode
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
296 easy-mmode-define-global-mode
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
297 easy-mmode-define-minor-mode
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
298 define-minor-mode)) t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
299 (eq (car-safe (car body)) 'interactive))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
300 (if macrop (list 'quote 'macro) nil))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
301
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
302 ;; 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
303 ;; 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
304 ((eq car 'defcustom)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
305 (let ((varname (car-safe (cdr-safe form)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
306 (init (car-safe (cdr-safe (cdr-safe form))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
307 (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
308 (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
309 (if (not (plist-get rest :require))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
310 `(defvar ,varname ,init ,doc)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
311 `(progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
312 (defvar ,varname ,init ,doc)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
313 (custom-add-to-group ,(plist-get rest :group)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
314 ',varname 'custom-variable)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
315 (custom-add-load ',varname
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
316 ,(plist-get rest :require))))))
4303
cee827542370 [xemacs-hg @ 2007-12-04 20:18:33 by aidan]
aidan
parents: 4256
diff changeset
317 ;; 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
318 ((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
319 `(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
320 ;; 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
321 (t nil))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
323 (defun make-c-autoload (module)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
324 "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
325 Returns nil if the DEFUN is malformed."
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
326 (and
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
327 ;; Match the DEFUN
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
328 (search-forward "DEFUN" nil t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
329 ;; Match the opening parenthesis
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
330 (progn
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
331 (skip-syntax-forward " ")
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
332 (eq (char-after) ?\())
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
333 ;; 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
334 (progn
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
335 (forward-char)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
336 (skip-syntax-forward " ")
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
337 (eq (char-after) ?\"))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
338 ;; 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
339 (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
340 (search-forward "\"" nil t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
341 (backward-char)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
342 (intern (buffer-substring begin (point)))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
343 (interact (progn
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
344 (search-forward "," nil t 4)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
345 (skip-syntax-forward " ")
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
346 (not (eq (char-after) ?0))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
347 (begin (progn
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
348 (search-forward "/*" nil t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
349 (forward-line 1)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
350 (point))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
351 (search-forward "*/" nil t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
352 (goto-char (match-beginning 0))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
353 (skip-chars-backward " \t\n\f")
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
354 (list 'autoload (list 'quote func-name) module
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
355 (buffer-substring begin (point)) interact nil))))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
356
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
357 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
358 ;; Generating autoloads for a single file
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 ;;;###autoload
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
361 (defun generate-file-autoloads (file)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
362 "Insert at point an autoload section for FILE.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 autoloads are generated for defuns and defmacros in FILE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 marked by `generate-autoload-cookie' (which see).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 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
366 are used."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 (interactive "fGenerate autoloads for file: ")
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
368 (cond ((string-match "\\.el$" file)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
369 (generate-autoload-type-section
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
370 file
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
371 (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
372 nil #'generate-lisp-file-autoloads-1))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
373 ;; #### jj, are C++ modules possible?
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
374 ((string-match "\\.c$" file)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
375 (generate-autoload-type-section
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
376 file
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
377 (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
378 t #'generate-c-file-autoloads-1))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
379 (t
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
380 (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
381
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
382 (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
383 "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
384 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
385 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
386 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
387 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
388 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
389 (let ((outbuf (current-buffer))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
390 (trim-name (autoload-trim-file-name file))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 (autoloads-done '())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 (print-length nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 (print-readably t) ; XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 (float-output-format nil)
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
395 (visited (get-file-buffer file))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
396 suppress-form
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 ;; (done-any nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 output-end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 ;; If the autoload section we create here uses an absolute
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 ;; pathname for FILE in its header, and then Emacs is installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 ;; under a different path on another system,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 ;; `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
404 ;; autoloaded. So, if FILE is in the same directory or a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 ;; subdirectory of the current buffer's directory, we'll make it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 ;; relative to the current buffer's directory.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 (setq file (expand-file-name file))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
408 ;; #### FSF 21.2. Do we want this?
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
409 ; (let* ((source-truename (file-truename file))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
410 ; (dir-truename (file-name-as-directory
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
411 ; (file-truename default-directory)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
412 ; (len (length dir-truename)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
413 ; (if (and (< len (length source-truename))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
414 ; (string= dir-truename (substring source-truename 0 len)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
415 ; (setq file (substring source-truename len))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
416
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
417 ;; Check for suppression form (XEmacs)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
418 (let* ((dir (file-name-directory file))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
419 (_pkg (expand-file-name "_pkg.el" dir))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
420 (pkg-vis (get-file-buffer _pkg))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
421 pkg-buf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
422 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
423 (when (file-readable-p _pkg)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
424 (unwind-protect
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
425 (progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
426 (let ((find-file-hooks nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
427 (enable-local-variables nil))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
428 (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
429 (set-syntax-table emacs-lisp-mode-syntax-table))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
430 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
431 (save-restriction
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
432 (widen)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
433 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
434 (block nil
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
435 (while (search-forward "(package-suppress" nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
436 ;; skip over package-name
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
437 (forward-sexp 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
438 (let ((supfile (read (current-buffer))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
439 (when (equal supfile load-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
440 (setq suppress-form (eval (read (current-buffer))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
441 (return))))))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
442 (unless pkg-vis
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
443 ;; 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
444 (if pkg-buf (kill-buffer pkg-buf)))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 (progn
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
449 (let (;(find-file-hooks nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
450 ;(enable-local-variables nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
451 )
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
452 (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
453 )))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
454 ;; 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
455 ;; 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
456 ;; function name.
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 442
diff changeset
457 (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
458 ; (if visited
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
459 ; (set-buffer visited)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
460 ; ;; It is faster to avoid visiting the file.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
461 ; (set-buffer (get-buffer-create " *generate-autoload-file*"))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
462 ; (kill-all-local-variables)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
463 ; (erase-buffer)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
464 ; (setq buffer-undo-list t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
465 ; buffer-read-only nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
466 ; ;; 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
467 ; ;; 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
468 ; ;; function name.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
469 ; (emacs-lisp-mode)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
470 ; (if literal
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
471 ; (insert-file-contents-literally file nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
472 ; (insert-file-contents file nil)))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
473 (unless (setq autoloads-done
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
474 (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
475 (return-from generate-autoload-type-section))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
476 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 (unless visited
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
478 ;; 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
479 (kill-buffer (current-buffer)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 (set-buffer outbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 (setq output-end (point-marker))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 (if t ;; done-any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 ;; XEmacs -- always do this so that we cache the information
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 ;; that we've processed the file already.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 (progn
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
486 ;; Insert the section-header line
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
487 ;; 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
488 (insert generate-autoload-section-header)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
489 (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
490 ;; 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
491 ;; deleted from XEmacs.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
492 ;; (nth 5 (file-attributes file))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
493 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 outbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (terpri outbuf)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
496 ;; #### 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
497 ;; 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
498 ;; 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
499 ;; 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
500 ;; update autoloads -- hence, to build.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
501 ; ;; 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
502 ; ;; Make each sub-line into a comment.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
503 ; (with-current-buffer outbuf
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
504 ; (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
505 ; (forward-line -1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
506 ; (while (not (eolp))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
507 ; (move-to-column 64)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
508 ; (skip-chars-forward "^ \n")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
509 ; (or (eolp)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
510 ; (insert "\n" generate-autoload-section-continuation)))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
511 ;; XEmacs: This was commented out before. #### Correct?
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
512 ; (insert ";;; Generated autoloads from "
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
513 ; (autoload-trim-file-name file) "\n")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
514 ;; XEmacs -- handle suppression
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
515 (when suppress-form
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
516 (insert "\n;;; Suppress form from _pkg.el\n")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
517 (insert "(unless " (prin1-to-string suppress-form) "\n\n"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 (goto-char output-end)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
519 ;; XEmacs -- handle suppression
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
520 (when suppress-form
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
521 (insert "\n) ;; unless (suppressed)\n"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 (insert generate-autoload-section-trailer)))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
523 ))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
524
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
526 (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
527 "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
528 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
529 Updates AUTOLOADS-DONE and returns the new value."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
530 (skip-chars-forward " \t")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
531 ;; (setq done-any t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
532 (if (eolp)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
533 ;; Read the next form and make an autoload.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
534 (let* ((form (prog1 (read (current-buffer))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
535 (or (bolp) (forward-line 1))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
536 (autoload (make-autoload form load-name)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
537 (if autoload
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
538 (setq autoloads-done (cons (nth 1 form)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
539 autoloads-done))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
540 (setq autoload form))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
541 (autoload-print-form autoload outbuf ""))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
542 ;; 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
543 (cond ((looking-at "immediate\\s *$") ; XEmacs
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
544 ;; This is here so that you can automatically
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
545 ;; have small hook functions copied to
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
546 ;; 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
547 ;; 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
548 ;; do-nothing find-file-hook... --Stig
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
549 (forward-line 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
550 (let ((begin (point)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
551 (forward-sexp)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
552 (forward-line 1)
4332
6ad202d453cb Insert <immediate> into section header for immediate autoloads.
Mike Sperber <sperber@deinprogramm.de>
parents: 4303
diff changeset
553 (princ (buffer-substring begin (point)) outbuf))
6ad202d453cb Insert <immediate> into section header for immediate autoloads.
Mike Sperber <sperber@deinprogramm.de>
parents: 4303
diff changeset
554 (setq autoloads-done (cons '<immediate> autoloads-done)))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
555 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
556 (princ (buffer-substring
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
557 (progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
558 ;; Back up over whitespace, to preserve it.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
559 (skip-chars-backward " \f\t")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
560 (if (= (char-after (1+ (point))) ? )
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
561 ;; Eat one space.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
562 (forward-char 1))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
563 (point))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
564 (progn (forward-line 1) (point)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
565 outbuf))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
566 autoloads-done)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
567
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
568 (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
569 "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
570 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
571 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
572 `generate-autoload-cookie' (which see)."
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
573 (let ((autoloads-done '())
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
574 )
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
575 (save-excursion
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
576 (save-restriction
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
577 (widen)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
578 (goto-char (point-min))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
579 (unless (search-forward generate-autoload-cookie nil t)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
580 (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
581 (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
582
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
583 (message "Generating autoloads for %s..." trim-name)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
584 (goto-char (point-min))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
585 (while (not (eobp))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
586 (skip-chars-forward " \t\n\f")
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
587 (cond
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
588 ((looking-at (regexp-quote generate-autoload-cookie))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
589 (search-forward generate-autoload-cookie)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
590 (setq autoloads-done
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
591 (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
592 ((looking-at ";")
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
593 ;; Don't read the comment.
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
594 (forward-line 1))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
595 (t
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
596 (forward-sexp 1)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
597 (forward-line 1)))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
598 )))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
599 (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
600 (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
601 autoloads-done))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
602
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
603 (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
604 &optional funlist)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
605 "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
606 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
607 marked by `generate-c-autoload-cookie' (which see).
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
608 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
609 are used."
1733
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
610 (let ((exists-p-format
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
611 "(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
612 autoloads-done)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
613 (save-excursion
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
614 (save-restriction
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
615 (widen)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
616 (goto-char (point-min))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
617 ;; Is there a module name comment?
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
618 (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
619 (skip-chars-forward " \t")
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
620 (let ((begin (point)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
621 (skip-chars-forward "^ \t\n\f")
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
622 (setq load-name (buffer-substring begin (point)))))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
623 (if funlist
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
624 (progn
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
625 (message "Generating autoloads for %s..." trim-name)
1733
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
626 (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
627 (dolist (arg funlist)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
628 (goto-char (point-min))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
629 (re-search-forward
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
630 (concat "DEFUN (\""
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
631 (regexp-quote (symbol-name arg))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
632 "\""))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
633 (goto-char (match-beginning 0))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
634 (let ((autoload (make-c-autoload load-name)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
635 (when autoload
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
636 (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
637 (autoload-print-form autoload outbuf " "))))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
638 ;; close the princ'd `when' form
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
639 (princ ")" outbuf))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
640 (goto-char (point-min))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
641 (let ((match
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
642 (search-forward generate-c-autoload-cookie nil t)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
643 (unless match
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
644 (message "No autoloads found in %s" trim-name)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
645 (return-from generate-c-file-autoloads-1 nil))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
646
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
647 (message "Generating autoloads for %s..." trim-name)
1733
5903b079bee1 [xemacs-hg @ 2003-10-07 21:52:12 by james]
james
parents: 1495
diff changeset
648 (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
649 (while match
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
650 (forward-line 1)
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
651 (let ((autoload (make-c-autoload load-name)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
652 (when autoload
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
653 (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
654 (autoload-print-form autoload outbuf " ")))
1298
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
655 (setq match
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
656 (search-forward generate-c-autoload-cookie nil t)))
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
657 ;; close the princ'd `when' form
1b4bc72f433e [xemacs-hg @ 2003-02-14 12:05:06 by ben]
ben
parents: 1232
diff changeset
658 (princ ")" outbuf)))))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
659 (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
660 (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
661 autoloads-done))
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
662
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
663 ;;;###autoload
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
664 (defun generate-custom-defines (file)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
665 "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
666 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
667 are used."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
668 (interactive "fGenerate custom defines for file: ")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
669 (cond ((string-match "\\.el$" file)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
670 (generate-autoload-type-section
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
671 file
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
672 (replace-in-string (file-name-nondirectory file) "\\.elc?$" "")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
673 nil #'generate-custom-defines-1))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
674 ((string-match "\\.c$" file)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
675 ;; 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
676 ;; but cannot signal an error.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
677 nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
678 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
679 (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
680
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
681 (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
682 "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
683 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
684 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
685 (let* ((search-regexp-1 "^(\\(defcustom\\|defgroup\\) ")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
686 (search-string-2 ";;;###custom-define")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
687 (search-regexp-2 (regexp-quote search-string-2))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
688 (autoloads-done '()))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
689 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
690 (save-restriction
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
691 (widen)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
692 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
693 (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
694 (re-search-forward search-regexp-2 nil t))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
695 (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
696 (return-from generate-custom-defines-1 nil))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
697 (message "Generating custom defines for %s..." trim-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
698 (princ "(defconst custom-define-current-source-file " outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
699 (prin1 (file-relative-name (buffer-file-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
700 (symbol-value-in-buffer 'default-directory
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
701 outbuf)) outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
702 (princ ")\n" outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
703
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
704 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
705 (while (not (eobp))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
706 (skip-chars-forward " \t\n\f")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
707 (cond
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
708 ((looking-at search-regexp-1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
709 ;; 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
710 (let* ((form (prog1 (read (current-buffer))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
711 (or (bolp) (forward-line 1))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
712 (autoload form ;(make-autoload form load-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
713 ))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
714 (if autoload
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
715 (setq autoloads-done (cons (nth 1 form)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
716 autoloads-done))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
717 (setq autoload form))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
718 (autoload-print-form autoload outbuf ""))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
719 )
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
720 ((looking-at search-regexp-2)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
721 (search-forward search-string-2)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
722 (beep)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
723 (setq autoloads-done
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
724 (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
725 ((looking-at ";")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
726 ;; Don't read the comment.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
727 (forward-line 1))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
728 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
729 (forward-sexp 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
730 (forward-line 1)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
731 )))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
732 (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
733 (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
734 autoloads-done))
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 ;; Assorted utilities for generating autoloads and pieces thereof
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
737
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
738 (defun autoload-print-form (form outbuf margin)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
739 "Print an autoload form, handling special characters.
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
740 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
741 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
742 (cond
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
743 ;; If the form is a sequence, recurse.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
744 ((eq (car form) 'progn)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
745 (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
746 (cdr form)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
747 ;; Symbols at the toplevel are meaningless.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
748 ((symbolp form) nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
749 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
750 (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
751 (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
752 ;; 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
753 ;; printed specially for make-docfile (sigh).
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
754 (let* ((p (nthcdr (1- doc-string-elt) form))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
755 (elt (cdr p))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
756 (start-string (format "\n%s(" margin)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
757 (setcdr p nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
758 (princ start-string outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
759 ;; 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
760 ;; the file or sorting is hard.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
761 (let ((print-escape-newlines t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
762 ;;#### FSF 21.2 (print-escape-nonascii t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
763 (p (point outbuf))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
764 p2)
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
765 (mapc #'(lambda (elt)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
766 (prin1 elt outbuf)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
767 (princ " " outbuf))
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
768 form)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
769 (with-current-buffer outbuf
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
770 (setq p2 (point-marker))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
771 (goto-char p)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
772 (save-match-data
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
773 (while (search-forward "\^L" p2 t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
774 (delete-char -1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
775 (insert "\\^L")))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
776 (goto-char p2)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
777 (princ "\"\\\n" outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
778 (let ((begin (point outbuf)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
779 (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
780 ;; 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
781 ;; of a line in the doc string.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
782 (with-current-buffer outbuf
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
783 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
784 (while (search-backward start-string begin t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
785 (forward-char 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
786 (insert "\\"))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
787 (if (null (cdr elt))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
788 (princ ")" outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
789 (princ " " outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
790 (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
791 (terpri outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
792 (princ margin outbuf)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
793 ;; XEmacs change: another ^L hack
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
794 (let ((p (point outbuf))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
795 (print-escape-newlines t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
796 ;;#### FSF 21.2 (print-escape-nonascii t)
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
797 p2)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
798 (print form outbuf)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
799 (with-current-buffer outbuf
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
800 (setq p2 (point-marker))
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
801 (goto-char p)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
802 (save-match-data
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
803 (while (search-forward "\^L" p2 t)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
804 (delete-char -1)
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
805 (insert "\\^L")))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
806 (goto-char p2))))))))
996
25e260cb7994 [xemacs-hg @ 2002-09-10 15:27:02 by james]
james
parents: 969
diff changeset
807
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
808 (defun autoload-trim-file-name (file)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
809 "Returns relative pathname of FILE including the last directory.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
811 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
812 (setq file (expand-file-name file))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
813 (replace-in-string
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
814 (file-relative-name file (file-name-directory
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
815 (directory-file-name
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
816 (file-name-directory file))))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
817 ;; #### is this a good idea?
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
818 "\\\\" "/"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
820 (defun autoload-read-section-header ()
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
821 "Read a section header form.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
822 Since continuation lines have been marked as comments,
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
823 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
824 markers before we call `read'."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
825 (save-match-data
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
826 (let ((beginning (point))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
827 string)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
828 (forward-line 1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
829 (while (looking-at generate-autoload-section-continuation)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
830 (forward-line 1))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
831 (setq string (buffer-substring beginning (point)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
832 (with-current-buffer (get-buffer-create " *autoload*")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
833 (erase-buffer)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
834 (insert string)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
835 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
836 (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
837 (replace-match " "))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
838 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
839 (read (current-buffer))))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
840
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 (defun update-file-autoloads (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 "Update the autoloads for FILE in `generated-autoload-file'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 \(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
845 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
846 equal to `autoload-file-name')."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 (interactive "fUpdate autoloads for file: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 (setq file (expand-file-name file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 (when (and (file-newer-than-file-p file generated-autoload-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 (not (member (file-name-nondirectory file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 (list autoload-file-name))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 (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
854 "\\.\\(elc?\\|c\\)$"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 ""))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 (trim-name (autoload-trim-file-name file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 section-begin form)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 (save-excursion
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
859 ;; 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
860 ;; 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
861 ;; 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
862 ;; up-to-date.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
863
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
864 ;; #### 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
865 ;; 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
866 ;; this. --ben
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
867 ;; (let ((coding-system-for-read 'raw-text))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 (let ((find-file-hooks nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 (set-buffer (or (get-file-buffer generated-autoload-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 (find-file-noselect generated-autoload-file))))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
871 ;; FSF 21.2 says:
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
872
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
873 ;; [[ 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
874 ;; that it is portable to all platforms. ]]
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
875 ;; (setq buffer-file-coding-system 'raw-text-unix))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
876 ;; 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
877 ;; up-to-date and recompile when we build.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
878
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
879 ;; FSF 21.2: [not applicable to XEmacs]
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
880 ; (or (> (buffer-size) 0)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
881 ; (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
882 ; (or (file-writable-p buffer-file-name)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
883 ; (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
884
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
885 ;; 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
886 ;; Hence, not synched.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
887
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 ;; Make sure we can scribble in it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 (setq buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 ;; First delete all sections for this file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 (while (search-forward generate-autoload-section-header nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 (setq section-begin (match-beginning 0))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
894 (setq form (autoload-read-section-header))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 (when (string= (nth 2 form) load-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 (search-forward generate-autoload-section-trailer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 (delete-region section-begin (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 ;; Now find insertion point for new section
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 (block find-insertion-point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 (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
903 (setq form (autoload-read-section-header))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 (when (string< trim-name (nth 3 form))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 ;; Found alphabetically correct insertion point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 (goto-char (match-beginning 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 (return-from find-insertion-point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 (search-forward generate-autoload-section-trailer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 (when (eq (point) (point-min)) ; No existing entries?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 (goto-char (point-max)))) ; Append.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 ;; Add in new sections for file
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
913 (funcall generate-autoload-function file))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 (when (interactive-p) (save-buffer)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
917 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
918 ;; Utilities for batch updates
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
919
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
920 ;;;###autoload
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
921 (defun batch-update-directory-autoloads ()
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
922 "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
923 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
924 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
925 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
926
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
927 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
928 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
929 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
930
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
931 #### 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
932 (unless noninteractive
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
933 (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
934 (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
935 (car command-line-args-left) nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
936 (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
937
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
938 ;;;###autoload
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
939 (defun batch-update-directory-custom-defines ()
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
940 "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
941 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
942 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
943 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
944
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
945 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
946 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
947 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
948
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
949 #### 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
950 (unless noninteractive
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
951 (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
952 (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
953 (car command-line-args-left) nil t)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
954 (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
955
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
956 ;;;###autoload
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
957 (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
958 &optional into-file force)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
959 "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
960 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
961
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
962 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
963 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
964 feature and to provide the feature is added.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
965
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
966 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
967 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
968 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
969 FILES-OR-DIRS.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
970
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
971 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
972 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
973 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
974 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
975 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
976 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
977 therefore deprecated.
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
978
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
979 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
980 one level deep.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
981
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
982 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
983 (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
984 (let ((defdir (directory-file-name default-directory))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
985 ;; value for all-into-one-file
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
986 (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
987 (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
988 (autoload-feature-prefix feature-prefix)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
989 ;; protect from change
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
990 (generated-autoload-file generated-autoload-file))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
991 (dolist (arg files-or-dirs)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
992 (setq arg (expand-file-name arg defdir))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
993 (cond
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
994 ((file-directory-p arg)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
995 (setq generated-autoload-file
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
996 (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
997 (message "Updating autoloads for directory %s..." arg)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
998 (let ((simple-dir (file-name-as-directory
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
999 (file-name-nondirectory
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1000 (directory-file-name arg))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1001 (enable-local-eval nil))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1002 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1003 (let ((find-file-hooks nil))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1004 (set-buffer (find-file-noselect generated-autoload-file)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1005 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1006 (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
1007 (let* ((begin (match-beginning 0))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1008 (form (autoload-read-section-header))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1009 (file (nth 3 form)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1010 (when (and (stringp file)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1011 (string= (file-name-directory file) simple-dir)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1012 (not (file-exists-p
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1013 (expand-file-name
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1014 (file-name-nondirectory file) arg))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1015 ;; Remove the obsolete section.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1016 (search-forward generate-autoload-section-trailer)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1017 (delete-region begin (point)))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1018 ;; 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
1019 (mapc 'update-file-autoloads
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4702
diff changeset
1020 (directory-files arg t "^[^=].*\\.\\(el\\|c\\)$")))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1021 ((file-exists-p arg)
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1022 (setq generated-autoload-file
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1023 (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
1024 (file-name-directory arg))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1025 (update-file-autoloads arg))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1026 (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
1027 (when (not into-file)
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1028 (autoload-featurep-protect-autoloads
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1029 (autoload-make-feature-name
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1030 (or feature-prefix
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1031 (file-name-nondirectory (directory-file-name arg)))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1032 (if force (set-buffer-modified-p
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1033 t (find-file-noselect generated-autoload-file)))))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1034 (when into-file
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1035 (autoload-featurep-protect-autoloads autoload-feature-name)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1036 (if force (set-buffer-modified-p
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1037 t (find-file-noselect into-file))))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1038 (save-some-buffers t)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1039 ))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1040
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 ;;;###autoload
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1042 (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
1043 &optional into-file force)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1044 "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
1045 Works just like `update-file-autoloads'."
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1046 (let* ((autoload-feature-suffix "-custom-defines")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1047 (autoload-file-name "custom-defines.el")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1048 (generate-autoload-function #'generate-custom-defines))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1049 (update-autoload-files files-or-dirs feature-prefix into-file force)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1051 (defun autoload-featurep-protect-autoloads (sym)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 (set-buffer (find-file-noselect generated-autoload-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 (goto-char (point-min))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1055 (cond ((eq (point-min) (point-max)) nil)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1056 ;; 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
1057 ;; 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
1058 ;; an older version of this function.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1059 ((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
1060 (delete-region (point-min) (point-max)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1061 (t
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1062 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1063 (when (looking-at ";;; DO NOT MODIFY THIS FILE")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1064 (delete-region (point-min)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1065 (progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1066 (search-forward generate-autoload-section-header)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1067 (match-beginning 0))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1068 ;; 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
1069 ;; 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
1070 ;; `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
1071 ;; characters are output properly and distinguished properly.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1072 ;; 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
1073 ;; Emacsen.
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1074 (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
1075 (progn
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1076 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1077 ;; 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
1078 (skip-chars-forward (concat (char-to-string 0) "-"
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1079 (char-to-string 255)))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1080 (eq (point) (point-max))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1081 (setq buffer-file-coding-system 'raw-text-unix)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1082 (setq buffer-file-coding-system 'escape-quoted))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1083 (goto-char (point-min))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1084 (insert ";;; DO NOT MODIFY THIS FILE")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1085 ;; 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
1086 ;; 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
1087 ;; 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
1088 ;; 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
1089 (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
1090 (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
1091 (insert "(or (featurep 'mule) ")
65f5d45edc87 fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents: 5076
diff changeset
1092 (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
1093 (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
1094 buffer-file-coding-system))
65f5d45edc87 fix auto-autoloads when default coding system is utf-8
Ben Wing <ben@xemacs.org>
parents: 5076
diff changeset
1095 (insert "(if (featurep '" sym ")")
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1096 (insert " (error \"Feature " sym " already loaded\"))\n")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1097 (goto-char (point-max))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1098 (save-excursion
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1099 (forward-line -1)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1100 (when (looking-at "(provide")
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1101 (delete-region (point) (point-max))))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1102 (unless (bolp) (insert "\n"))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1103 (unless (eq (char-before (1- (point))) ?\^L)
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1104 (insert "\^L\n"))
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1105 (insert "(provide '" sym ")\n")))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1107 (defun autoload-make-feature-name (&optional prefix)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1108 "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
1109
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1110 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
1111 that is non-nil.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1112
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1113 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
1114 including packages.
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1115
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1116 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
1117 `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
1118 `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
1119 do not use this feature."
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1120 (concat
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1121 (cond (prefix)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1122 (autoload-feature-prefix)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1123 ((stringp generated-autoload-file)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1124 (message "Warning: autoload computing feature prefix.
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1125 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
1126 (file-name-nondirectory
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1127 (directory-file-name
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1128 (file-name-directory generated-autoload-file))))
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1129 (t (error 'invalid-argument
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1130 "Could not compute a feature name")))
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1131 autoload-feature-suffix))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1132
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1133 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1134 ;; Deprecated entry points
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1135
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1136 ;; 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
1137 ;; 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
1138 ;; 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
1139 ;; `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
1140 ;;
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1141 ;; 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
1142 ;; 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
1143
2548
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1144 ;; 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
1145 ;; "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
1146 ;; functionality? --ben
c4c8a36043be [xemacs-hg @ 2005-02-03 07:11:19 by ben]
ben
parents: 1753
diff changeset
1147
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1148 ;; 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
1149 ;; 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
1150
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1151 ;;;###autoload
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1152 (defun batch-update-autoloads ()
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1153 "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
1154 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
1155 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
1156 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
1157 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
1158 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
1159 on the command line."
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1160 (unless noninteractive
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1161 (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
1162 (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
1163 generated-autoload-file t)
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 460
diff changeset
1164 (kill-emacs 0))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 438
diff changeset
1165
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1166 ;; Declare obsolescence
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1167
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1168 (make-obsolete-variable 'autoload-target-directory
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1169 "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
1170 (make-obsolete 'batch-update-autoloads
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1171 'autoload-update-directory-autoloads)
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 1048
diff changeset
1172
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 (provide 'autoload)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 ;;; autoload.el ends here