Mercurial > hg > xemacs-beta
comparison lisp/utils/autoload.el @ 163:0132846995bd r20-3b8
Import from CVS: tag r20-3b8
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:43:35 +0200 |
parents | 43dd3413c7c7 |
children | 5a88923fcbfe |
comparison
equal
deleted
inserted
replaced
162:4de2936b4e77 | 163:0132846995bd |
---|---|
329 (insert generate-autoload-section-trailer))) | 329 (insert generate-autoload-section-trailer))) |
330 (or noninteractive ; XEmacs: only need one line in -batch mode. | 330 (or noninteractive ; XEmacs: only need one line in -batch mode. |
331 (message "Generating autoloads for %s...done" file)))) | 331 (message "Generating autoloads for %s...done" file)))) |
332 | 332 |
333 | 333 |
334 (defconst autoload-file-name "auto-autoloads.el" | |
335 "Generic filename to put autoloads into. | |
336 Unless you are an XEmacs maintainer, it is probably unwise to change this.") | |
337 | |
338 (defvar autoload-target-directory "../lisp/prim/" | |
339 "Directory to put autoload declaration file into. | |
340 Unless you know what you're doing, don't mess with this.") | |
341 | |
334 (defvar generated-autoload-file | 342 (defvar generated-autoload-file |
335 (expand-file-name "../lisp/prim/auto-autoloads.el" data-directory) | 343 (expand-file-name (concat autoload-target-directory |
344 autoload-file-name) | |
345 data-directory) | |
336 "*File `update-file-autoloads' puts autoloads into. | 346 "*File `update-file-autoloads' puts autoloads into. |
337 A .el file can set this in its local variables section to make its | 347 A .el file can set this in its local variables section to make its |
338 autoloads go somewhere else.") | 348 autoloads go somewhere else.") |
339 | 349 |
350 (defconst cusload-file-name "custom-load.el" | |
351 "Generic filename ot put custom loads into. | |
352 Unless you are an XEmacs maintainr, it is probably unwise to change this.") | |
353 | |
340 (defvar generated-custom-file | 354 (defvar generated-custom-file |
341 (expand-file-name "../lisp/prim/cus-load.el" data-directory) | 355 (expand-file-name (concat autoload-target-directory |
356 cusload-file-name) | |
357 data-directory) | |
342 "*File `update-file-autoloads' puts customization into.") | 358 "*File `update-file-autoloads' puts customization into.") |
343 | 359 |
344 ;; Written by Per Abrahamsen | 360 ;; Written by Per Abrahamsen |
345 (defun autoload-snarf-defcustom (file) | 361 (defun autoload-snarf-defcustom (file) |
346 "Snarf all customizations in the current buffer." | 362 "Snarf all customizations in the current buffer." |
496 (set-buffer (find-file-noselect generated-custom-file)) | 512 (set-buffer (find-file-noselect generated-custom-file)) |
497 (erase-buffer) | 513 (erase-buffer) |
498 (insert | 514 (insert |
499 (with-output-to-string | 515 (with-output-to-string |
500 (mapatoms (lambda (symbol) | 516 (mapatoms (lambda (symbol) |
501 (let ((members (get symbol 'custom-group)) | 517 (let ((members (condition-case nil |
518 (get symbol 'custom-group) | |
519 (t nil))) | |
502 item where found) | 520 item where found) |
503 (when members | 521 (when members |
504 (princ "(put '") | 522 (princ "(put '") |
505 (princ symbol) | 523 (princ symbol) |
506 (princ " 'custom-loads '(") | 524 (princ " 'custom-loads '(") |
540 (autoload-save-customization) | 558 (autoload-save-customization) |
541 (save-some-buffers t) | 559 (save-some-buffers t) |
542 (message "Done") | 560 (message "Done") |
543 (kill-emacs 0))) | 561 (kill-emacs 0))) |
544 | 562 |
563 (defun fixup-autoload-buffer (sym) | |
564 (save-excursion | |
565 (set-buffer (find-file-noselect generated-autoload-file)) | |
566 (goto-char (point-min)) | |
567 (if (and (not (= (point-min) (point-max))) | |
568 (not (looking-at ";;; DO NOT MODIFY THIS FILE"))) | |
569 (progn | |
570 (insert ";;; DO NOT MODIFY THIS FILE\n") | |
571 (insert "(if (not (featurep '" sym "))\n") | |
572 (insert " (progn\n") | |
573 (goto-char (point-max)) | |
574 (insert "\n(provide '" sym ")\n))\n"))))) | |
575 | |
576 ;;;###autoload | |
577 (defun batch-update-directory () | |
578 "Update the autoloads for the directory on the command line. | |
579 Runs `update-file-autoloads' on each file in the given directory, and must | |
580 be used only with -batch, and kills XEmacs on completion." | |
581 (unless noninteractive | |
582 (error "batch-update-autoloads is to be used only with -batch")) | |
583 (let ((defdir default-directory) | |
584 (enable-local-eval nil)) ; Don't query in batch mode. | |
585 (dolist (arg command-line-args-left) | |
586 (setq arg (expand-file-name arg defdir)) | |
587 (let ((generated-autoload-file (concat arg "/" autoload-file-name)) | |
588 (generated-custom-file (concat arg "/" cusload-file-name))) | |
589 (cond | |
590 ((file-directory-p arg) | |
591 (message "Updating autoloads in directory %s..." arg) | |
592 (update-autoloads-from-directory arg)) | |
593 (t (error "No such file or directory: %s" arg))) | |
594 (autoload-save-customization) | |
595 (fixup-autoload-buffer (concat (file-name-nondirectory arg) | |
596 "-autoloads")) | |
597 (save-some-buffers t)) | |
598 (message "Done") | |
599 ;; (kill-emacs 0) | |
600 ))) | |
601 | |
545 (provide 'autoload) | 602 (provide 'autoload) |
546 | 603 |
547 ;;; autoload.el ends here | 604 ;;; autoload.el ends here |