Mercurial > emacs
comparison lisp/emacs-lisp/autoload.el @ 17851:6e7bb77cd7e1
(update-autoloads-from-directories): Renamed from
update-autoloads-from-directory. Take multiple directories as args.
Use locate-library to find loaddefs.el and the top level Lisp dir.
(batch-update-autoloads): Call update-autoloads-from-directories.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 16 May 1997 22:49:59 +0000 |
parents | f11a3a49088c |
children | 65f371a2cf00 |
comparison
equal
deleted
inserted
replaced
17850:0b163f31c39c | 17851:6e7bb77cd7e1 |
---|---|
377 (kill-buffer (current-buffer)))))))) | 377 (kill-buffer (current-buffer)))))))) |
378 (generate-file-autoloads file)))) | 378 (generate-file-autoloads file)))) |
379 (if (interactive-p) (save-buffer))))) | 379 (if (interactive-p) (save-buffer))))) |
380 | 380 |
381 ;;;###autoload | 381 ;;;###autoload |
382 (defun update-autoloads-from-directory (dir) | 382 (defun update-autoloads-from-directories (&rest dirs) |
383 "\ | 383 "\ |
384 Update loaddefs.el with all the current autoloads from DIR, and no old ones. | 384 Update loaddefs.el with all the current autoloads from DIRS, and no old ones. |
385 This uses `update-file-autoloads' (which see) do its work." | 385 This uses `update-file-autoloads' (which see) do its work." |
386 (interactive "DUpdate autoloads from directory: ") | 386 (interactive "DUpdate autoloads from directory: ") |
387 (setq dir (expand-file-name dir)) | 387 (let ((files (apply 'nconc |
388 (let ((files (directory-files dir t "^[^=].*\\.el$"))) | 388 (mapcar (function (lambda (dir) |
389 (directory-files (expand-file-name dir) | |
390 t | |
391 "^[^=].*\\.el$"))) | |
392 dirs))) | |
393 autoloads-file | |
394 top-dir) | |
395 (setq autoloads-file (locate-library generated-autoload-file)) | |
396 (setq top-dir (file-name-directory autoloads-file)) | |
389 (save-excursion | 397 (save-excursion |
390 (set-buffer (find-file-noselect | 398 (set-buffer (find-file-noselect autoloads-file)) |
391 (if (file-exists-p generated-autoload-file) | |
392 (expand-file-name generated-autoload-file) | |
393 (expand-file-name generated-autoload-file | |
394 dir)))) | |
395 (save-excursion | 399 (save-excursion |
396 (goto-char (point-min)) | 400 (goto-char (point-min)) |
397 (while (search-forward generate-autoload-section-header nil t) | 401 (while (search-forward generate-autoload-section-header nil t) |
398 (let* ((form (condition-case () | 402 (let* ((form (condition-case () |
399 (read (current-buffer)) | 403 (read (current-buffer)) |
400 (end-of-file nil))) | 404 (end-of-file nil))) |
401 (file (nth 3 form))) | 405 (file (nth 3 form))) |
402 (cond ((not (stringp file))) | 406 (cond ((not (stringp file))) |
403 ((not (file-exists-p (expand-file-name file dir))) | 407 ((not (file-exists-p (expand-file-name file top-dir))) |
404 ;; Remove the obsolete section. | 408 ;; Remove the obsolete section. |
405 (let ((begin (match-beginning 0))) | 409 (let ((begin (match-beginning 0))) |
406 (search-forward generate-autoload-section-trailer) | 410 (search-forward generate-autoload-section-trailer) |
407 (delete-region begin (point)))) | 411 (delete-region begin (point)))) |
408 (t | 412 (t |
413 (save-buffer)))) | 417 (save-buffer)))) |
414 | 418 |
415 ;;;###autoload | 419 ;;;###autoload |
416 (defun batch-update-autoloads () | 420 (defun batch-update-autoloads () |
417 "Update loaddefs.el autoloads in batch mode. | 421 "Update loaddefs.el autoloads in batch mode. |
418 Calls `update-autoloads-from-directory' on each command line argument." | 422 Calls `update-autoloads-from-directories' on the command line arguments." |
419 (mapcar 'update-autoloads-from-directory command-line-args-left) | 423 (apply 'update-autoloads-from-directories command-line-args-left) |
420 (setq command-line-args-left nil)) | 424 (setq command-line-args-left nil)) |
421 | 425 |
422 (provide 'autoload) | 426 (provide 'autoload) |
423 | 427 |
424 ;;; autoload.el ends here | 428 ;;; autoload.el ends here |