Mercurial > hg > xemacs-beta
comparison lisp/autoload.el @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 84b14dcb0985 |
children | 223736d75acb |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
1 ;;; autoload.el --- maintain autoloads in loaddefs.el. | 1 ;;; autoload.el --- maintain autoloads in loaddefs.el. |
2 | 2 |
3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. |
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. | 4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. |
5 ;; Copyright (C) 1996 Ben Wing. | 5 ;; Copyright (C) 1996, 2000 Ben Wing. |
6 | 6 |
7 ;; Author: Roland McGrath <roland@gnu.ai.mit.edu> | 7 ;; Author: Roland McGrath <roland@gnu.ai.mit.edu> |
8 ;; Keywords: maint | 8 ;; Keywords: maint |
9 | 9 |
10 ;; This file is part of XEmacs. | 10 ;; This file is part of XEmacs. |
85 the section of autoloads for a file.") | 85 the section of autoloads for a file.") |
86 | 86 |
87 (defvar generate-autoload-section-trailer "\n;;;***\n" | 87 (defvar generate-autoload-section-trailer "\n;;;***\n" |
88 "String which indicates the end of the section of autoloads for a file.") | 88 "String which indicates the end of the section of autoloads for a file.") |
89 | 89 |
90 (defvar autoload-package-name nil) | |
91 | |
90 ;;; Forms which have doc-strings which should be printed specially. | 92 ;;; Forms which have doc-strings which should be printed specially. |
91 ;;; A doc-string-elt property of ELT says that (nth ELT FORM) is | 93 ;;; A doc-string-elt property of ELT says that (nth ELT FORM) is |
92 ;;; the doc-string in FORM. | 94 ;;; the doc-string in FORM. |
93 ;;; | 95 ;;; |
94 ;;; There used to be the following note here: | 96 ;;; There used to be the following note here: |
112 (put 'defmacro 'doc-string-elt 3) | 114 (put 'defmacro 'doc-string-elt 3) |
113 | 115 |
114 (defun autoload-trim-file-name (file) | 116 (defun autoload-trim-file-name (file) |
115 "Returns a relative pathname of FILE including the last directory." | 117 "Returns a relative pathname of FILE including the last directory." |
116 (setq file (expand-file-name file)) | 118 (setq file (expand-file-name file)) |
117 (file-relative-name file (file-name-directory | 119 (replace-in-string |
118 (directory-file-name | 120 (file-relative-name file (file-name-directory |
119 (file-name-directory file))))) | 121 (directory-file-name |
122 (file-name-directory file)))) | |
123 "\\\\" "/")) | |
120 | 124 |
121 ;;;###autoload | 125 ;;;###autoload |
122 (defun generate-file-autoloads (file &optional funlist) | 126 (defun generate-file-autoloads (file &optional funlist) |
123 "Insert at point a loaddefs autoload section for FILE. | 127 "Insert at point a loaddefs autoload section for FILE. |
124 autoloads are generated for defuns and defmacros in FILE | 128 autoloads are generated for defuns and defmacros in FILE |
337 | 341 |
338 (defconst autoload-file-name "auto-autoloads.el" | 342 (defconst autoload-file-name "auto-autoloads.el" |
339 "Generic filename to put autoloads into. | 343 "Generic filename to put autoloads into. |
340 Unless you are an XEmacs maintainer, it is probably unwise to change this.") | 344 Unless you are an XEmacs maintainer, it is probably unwise to change this.") |
341 | 345 |
342 (defvar autoload-target-directory "../lisp/prim/" | 346 (defvar autoload-target-directory "../lisp/" |
343 "Directory to put autoload declaration file into. | 347 "Directory to put autoload declaration file into. |
344 Unless you know what you're doing, don't mess with this.") | 348 Unless you know what you're doing, don't mess with this.") |
345 | 349 |
346 (defvar generated-autoload-file | 350 (defvar generated-autoload-file |
347 (expand-file-name (concat autoload-target-directory | 351 (expand-file-name (concat autoload-target-directory |
348 autoload-file-name) | 352 autoload-file-name) |
349 data-directory) | 353 data-directory) |
350 "*File `update-file-autoloads' puts autoloads into. | 354 "*File `update-file-autoloads' puts autoloads into. |
351 A .el file can set this in its local variables section to make its | 355 A .el file can set this in its local variables section to make its |
352 autoloads go somewhere else.") | 356 autoloads go somewhere else. |
357 | |
358 Note that `batch-update-directory' binds this variable to its own value, | |
359 generally the file named `autoload-file-name' in the directory being | |
360 updated.") | |
353 | 361 |
354 (defconst cusload-file-name "custom-load.el" | 362 (defconst cusload-file-name "custom-load.el" |
355 "Generic filename ot put custom loads into. | 363 "Generic filename to put custom loads into. |
356 Unless you are an XEmacs maintainr, it is probably unwise to change this.") | 364 Unless you are an XEmacs maintainer, it is probably unwise to change this.") |
357 | 365 |
358 ;;;###autoload | 366 ;;;###autoload |
359 (defun update-file-autoloads (file) | 367 (defun update-file-autoloads (file) |
360 "Update the autoloads for FILE in `generated-autoload-file' | 368 "Update the autoloads for FILE in `generated-autoload-file' |
361 \(which FILE might bind in its local variables). | 369 \(which FILE might bind in its local variables). |
456 | 464 |
457 ;;;###autoload | 465 ;;;###autoload |
458 (defun update-autoloads-from-directory (dir) | 466 (defun update-autoloads-from-directory (dir) |
459 "Update `generated-autoload-file' with all the current autoloads from DIR. | 467 "Update `generated-autoload-file' with all the current autoloads from DIR. |
460 This runs `update-file-autoloads' on each .el file in DIR. | 468 This runs `update-file-autoloads' on each .el file in DIR. |
461 Obsolete autoload entries for files that no longer exist are deleted." | 469 Obsolete autoload entries for files that no longer exist are deleted. |
470 Note that, if this function is called from `batch-update-directory', | |
471 `generated-autoload-file' was rebound in that function." | |
462 (interactive "DUpdate autoloads for directory: ") | 472 (interactive "DUpdate autoloads for directory: ") |
463 (setq dir (expand-file-name dir)) | 473 (setq dir (expand-file-name dir)) |
464 (let ((simple-dir (file-name-as-directory | 474 (let ((simple-dir (file-name-as-directory |
465 (file-name-nondirectory | 475 (file-name-nondirectory |
466 (directory-file-name dir)))) | 476 (directory-file-name dir)))) |
532 (goto-char (point-max)) | 542 (goto-char (point-max)) |
533 (insert "\n(provide '" sym ")\n"))))) | 543 (insert "\n(provide '" sym ")\n"))))) |
534 | 544 |
535 (defvar autoload-package-name nil) | 545 (defvar autoload-package-name nil) |
536 | 546 |
547 ;; #### this function is almost identical to, but subtly different from, | |
548 ;; batch-update-autoloads. Both of these functions, unfortunately, are | |
549 ;; used in various build scripts in xemacs-packages. They should be | |
550 ;; merged. (However, it looks like no scripts pass more than one arg, | |
551 ;; making merging easy.) --ben | |
552 | |
537 ;;;###autoload | 553 ;;;###autoload |
538 (defun batch-update-directory () | 554 (defun batch-update-directory () |
539 "Update the autoloads for the directory on the command line. | 555 "Update the autoloads for the directories on the command line. |
540 Runs `update-file-autoloads' on each file in the given directory, must | 556 Runs `update-file-autoloads' on each file in the given directory, and must |
541 be used only with -batch and kills XEmacs on completion." | 557 be used only with -batch." |
542 (unless noninteractive | 558 (unless noninteractive |
543 (error "batch-update-directory is to be used only with -batch")) | 559 (error "batch-update-directory is to be used only with -batch")) |
544 (let ((defdir default-directory) | 560 (let ((defdir default-directory) |
545 (enable-local-eval nil)) ; Don't query in batch mode. | 561 (enable-local-eval nil)) ; Don't query in batch mode. |
546 (dolist (arg command-line-args-left) | 562 (dolist (arg command-line-args-left) |
547 (setq arg (expand-file-name arg defdir)) | 563 (setq arg (expand-file-name arg defdir)) |
548 (let ((generated-autoload-file (concat arg "/" autoload-file-name))) | 564 (let ((generated-autoload-file (expand-file-name autoload-file-name |
565 arg))) | |
549 (cond | 566 (cond |
550 ((file-directory-p arg) | 567 ((file-directory-p arg) |
551 (message "Updating autoloads in directory %s..." arg) | 568 (message "Updating autoloads in directory %s..." arg) |
552 (update-autoloads-from-directory arg)) | 569 (update-autoloads-from-directory arg)) |
553 (t (error "No such file or directory: %s" arg))) | 570 (t (error "No such file or directory: %s" arg))) |
559 ;; (message "Done") | 576 ;; (message "Done") |
560 ;; (kill-emacs 0) | 577 ;; (kill-emacs 0) |
561 ) | 578 ) |
562 (setq command-line-args-left nil))) | 579 (setq command-line-args-left nil))) |
563 | 580 |
581 ;; #### i created the following. this one and the last should be merged into | |
582 ;; batch-update-autoloads and batch-update-one-directory. --ben | |
583 | |
584 ;;;###autoload | |
585 (defun batch-update-one-directory () | |
586 "Update the autoloads for a single directory on the command line. | |
587 Runs `update-file-autoloads' on each file in the given directory, and must | |
588 be used only with -batch." | |
589 (unless noninteractive | |
590 (error "batch-update-directory is to be used only with -batch")) | |
591 (let ((defdir default-directory) | |
592 (enable-local-eval nil)) ; Don't query in batch mode. | |
593 (let ((arg (car command-line-args-left))) | |
594 (setq command-line-args-left (cdr command-line-args-left)) | |
595 (setq arg (expand-file-name arg defdir)) | |
596 (let ((generated-autoload-file (expand-file-name autoload-file-name | |
597 arg))) | |
598 (cond | |
599 ((file-directory-p arg) | |
600 (message "Updating autoloads in directory %s..." arg) | |
601 (update-autoloads-from-directory arg)) | |
602 (t (error "No such file or directory: %s" arg))) | |
603 (fixup-autoload-buffer (concat (if autoload-package-name | |
604 autoload-package-name | |
605 (file-name-nondirectory arg)) | |
606 "-autoloads")) | |
607 (save-some-buffers t)) | |
608 ;; (message "Done") | |
609 ))) | |
610 | |
564 (provide 'autoload) | 611 (provide 'autoload) |
565 | 612 |
566 ;;; autoload.el ends here | 613 ;;; autoload.el ends here |