diff options
| -rw-r--r-- | lisp/emacs-lisp/autoload.el | 80 |
1 files changed, 35 insertions, 45 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index c22ca66ead4..cce626f9a99 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; autoload.el --- maintain autoloads in loaddefs.el. | 1 | ;;; autoload.el --- maintain autoloads in loaddefs.el. |
| 2 | 2 | ||
| 3 | ;;; Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. | 3 | ;;; Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. |
| 4 | ;;; | 4 | ;;; |
| 5 | ;; Author: Roland McGrath <roland@gnu.ai.mit.edu> | 5 | ;; Author: Roland McGrath <roland@gnu.ai.mit.edu> |
| 6 | ;; Keywords: maint | 6 | ;; Keywords: maint |
| @@ -226,7 +226,7 @@ autoloads go somewhere else.") | |||
| 226 | (if (string-match "\\.elc?$" name) | 226 | (if (string-match "\\.elc?$" name) |
| 227 | (substring name 0 (match-beginning 0)) | 227 | (substring name 0 (match-beginning 0)) |
| 228 | name))) | 228 | name))) |
| 229 | (done nil) | 229 | (found nil) |
| 230 | (existing-buffer (get-file-buffer file))) | 230 | (existing-buffer (get-file-buffer file))) |
| 231 | (save-excursion | 231 | (save-excursion |
| 232 | ;; We want to get a value for generated-autoload-file from | 232 | ;; We want to get a value for generated-autoload-file from |
| @@ -237,52 +237,42 @@ autoloads go somewhere else.") | |||
| 237 | (save-restriction | 237 | (save-restriction |
| 238 | (widen) | 238 | (widen) |
| 239 | (goto-char (point-min)) | 239 | (goto-char (point-min)) |
| 240 | (while (search-forward generate-autoload-section-header nil t) | 240 | ;; Look for the section for LOAD-NAME. |
| 241 | (while (and (not found) | ||
| 242 | (search-forward generate-autoload-section-header nil t)) | ||
| 241 | (let ((form (condition-case () | 243 | (let ((form (condition-case () |
| 242 | (read (current-buffer)) | 244 | (read (current-buffer)) |
| 243 | (end-of-file nil)))) | 245 | (end-of-file nil)))) |
| 244 | (if (string= (nth 2 form) load-name) | 246 | (cond ((string= (nth 2 form) load-name) |
| 245 | (let ((begin (match-beginning 0)) | 247 | ;; We found the section for this file. |
| 246 | (last-time (nth 4 form)) | 248 | ;; Check if it is up to date. |
| 247 | (file-time (nth 5 (file-attributes file)))) | 249 | (let ((begin (match-beginning 0)) |
| 248 | (if (and (or (null existing-buffer) | 250 | (last-time (nth 4 form)) |
| 249 | (not (buffer-modified-p existing-buffer))) | 251 | (file-time (nth 5 (file-attributes file)))) |
| 250 | (listp last-time) (= (length last-time) 2) | 252 | (if (and (or (null existing-buffer) |
| 251 | (or (> (car last-time) (car file-time)) | 253 | (not (buffer-modified-p existing-buffer))) |
| 252 | (and (= (car last-time) (car file-time)) | 254 | (listp last-time) (= (length last-time) 2) |
| 253 | (>= (nth 1 last-time) | 255 | (or (> (car last-time) (car file-time)) |
| 254 | (nth 1 file-time))))) | 256 | (and (= (car last-time) (car file-time)) |
| 255 | (message "Autoload section for %s is up to date." | 257 | (>= (nth 1 last-time) |
| 256 | file) | 258 | (nth 1 file-time))))) |
| 257 | (search-forward generate-autoload-section-trailer) | 259 | (progn |
| 258 | (delete-region begin (point)) | 260 | (message "Autoload section for %s is up to date." |
| 259 | (generate-file-autoloads file)) | 261 | file) |
| 260 | (setq done t)))))) | 262 | (setq found 'up-to-date)) |
| 261 | (if done | 263 | (search-forward generate-autoload-section-trailer) |
| 262 | ;; There was an existing section and we have updated it. | 264 | (delete-region begin (point)) |
| 263 | () | 265 | (setq found t)))) |
| 264 | (if (save-excursion | 266 | ((string< load-name (nth 2 form)) |
| 265 | (set-buffer (find-file-noselect file)) | 267 | ;; We've come to a section alphabetically later than |
| 266 | (save-excursion | 268 | ;; LOAD-NAME. We assume the file is in order and so |
| 267 | (save-restriction | 269 | ;; there must be no section for LOAD-NAME. We will |
| 268 | (widen) | 270 | ;; insert one before the section here. |
| 269 | (goto-char (point-min)) | 271 | (goto-char (match-beginning 0)) |
| 270 | (search-forward generate-autoload-cookie nil t)))) | 272 | (setq found t))))) |
| 271 | ;; There are autoload cookies in FILE. | 273 | (if (eq found t) |
| 272 | ;; Have the user tell us where to put the new section. | 274 | (generate-file-autoloads file)) |
| 273 | (progn | 275 | (setq done t))) |
| 274 | (save-window-excursion | ||
| 275 | (switch-to-buffer (current-buffer)) | ||
| 276 | (with-output-to-temp-buffer "*Help*" | ||
| 277 | (princ (substitute-command-keys | ||
| 278 | (format "\ | ||
| 279 | Move point to where the autoload section | ||
| 280 | for %s should be inserted. | ||
| 281 | Then do \\[exit-recursive-edit]." | ||
| 282 | file)))) | ||
| 283 | (recursive-edit) | ||
| 284 | (beginning-of-line)) | ||
| 285 | (generate-file-autoloads file))))) | ||
| 286 | (if (interactive-p) (save-buffer)) | 276 | (if (interactive-p) (save-buffer)) |
| 287 | (if (and (null existing-buffer) | 277 | (if (and (null existing-buffer) |
| 288 | (setq existing-buffer (get-file-buffer file))) | 278 | (setq existing-buffer (get-file-buffer file))) |