Mercurial > emacs
comparison lisp/emacs-lisp/autoload.el @ 47664:a0d27828cf39
(make-autoload): Add usage info to docstring.
(autoload-print-form): Also quote open-[-in-column 0.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 27 Sep 2002 23:03:17 +0000 |
parents | 7da18198e410 |
children | f91cebb0f333 |
comparison
equal
deleted
inserted
replaced
47663:e9121795960f | 47664:a0d27828cf39 |
---|---|
31 ;; source; if you're going to use this, you'd better be able to. | 31 ;; source; if you're going to use this, you'd better be able to. |
32 | 32 |
33 ;;; Code: | 33 ;;; Code: |
34 | 34 |
35 (require 'lisp-mode) ;for `doc-string-elt' properties. | 35 (require 'lisp-mode) ;for `doc-string-elt' properties. |
36 | 36 (require 'help-fns) ;for help-add-fundoc-usage. |
37 | 37 |
38 (defvar generated-autoload-file "loaddefs.el" | 38 (defvar generated-autoload-file "loaddefs.el" |
39 "*File \\[update-file-autoloads] puts autoloads into. | 39 "*File \\[update-file-autoloads] puts autoloads into. |
40 A `.el' file can set this in its local variables section to make its | 40 A `.el' file can set this in its local variables section to make its |
41 autoloads go somewhere else. The autoload file is assumed to contain a | 41 autoloads go somewhere else. The autoload file is assumed to contain a |
88 define-generic-mode easy-mmode-define-minor-mode | 88 define-generic-mode easy-mmode-define-minor-mode |
89 easy-mmode-define-global-mode | 89 easy-mmode-define-global-mode |
90 define-minor-mode defun* defmacro*)) | 90 define-minor-mode defun* defmacro*)) |
91 (let* ((macrop (memq car '(defmacro defmacro*))) | 91 (let* ((macrop (memq car '(defmacro defmacro*))) |
92 (name (nth 1 form)) | 92 (name (nth 1 form)) |
93 (args (if (memq car '(defun defmacro defun* defmacro*)) | |
94 (nth 2 form) t)) | |
93 (body (nthcdr (get car 'doc-string-elt) form)) | 95 (body (nthcdr (get car 'doc-string-elt) form)) |
94 (doc (if (stringp (car body)) (pop body)))) | 96 (doc (if (stringp (car body)) (pop body)))) |
97 (when (listp args) | |
98 ;; Add the usage form at the end where describe-function-1 | |
99 ;; can recover it. | |
100 (setq doc (help-add-fundoc-usage doc args))) | |
95 ;; `define-generic-mode' quotes the name, so take care of that | 101 ;; `define-generic-mode' quotes the name, so take care of that |
96 (list 'autoload (if (listp name) name (list 'quote name)) file doc | 102 (list 'autoload (if (listp name) name (list 'quote name)) file doc |
97 (or (and (memq car '(define-skeleton define-derived-mode | 103 (or (and (memq car '(define-skeleton define-derived-mode |
98 define-generic-mode | 104 define-generic-mode |
99 easy-mmode-define-global-mode | 105 easy-mmode-define-global-mode |
119 ,(plist-get rest :require)))))) | 125 ,(plist-get rest :require)))))) |
120 | 126 |
121 ;; nil here indicates that this is not a special autoload form. | 127 ;; nil here indicates that this is not a special autoload form. |
122 (t nil)))) | 128 (t nil)))) |
123 | 129 |
124 ;;; Forms which have doc-strings which should be printed specially. | 130 ;; Forms which have doc-strings which should be printed specially. |
125 ;;; A doc-string-elt property of ELT says that (nth ELT FORM) is | 131 ;; A doc-string-elt property of ELT says that (nth ELT FORM) is |
126 ;;; the doc-string in FORM. | 132 ;; the doc-string in FORM. |
127 ;;; Those properties are now set in lisp-mode.el. | 133 ;; Those properties are now set in lisp-mode.el. |
128 | 134 |
129 | 135 |
130 (defun autoload-trim-file-name (file) | 136 (defun autoload-trim-file-name (file) |
131 ;; Returns a relative pathname of FILE | 137 ;; Returns a relative pathname of FILE |
132 ;; starting from the directory that loaddefs.el is in. | 138 ;; starting from the directory that loaddefs.el is in. |
189 ;; Insert a backslash before each ( that | 195 ;; Insert a backslash before each ( that |
190 ;; appears at the beginning of a line in | 196 ;; appears at the beginning of a line in |
191 ;; the doc string. | 197 ;; the doc string. |
192 (with-current-buffer outbuf | 198 (with-current-buffer outbuf |
193 (save-excursion | 199 (save-excursion |
194 (while (search-backward "\n(" begin t) | 200 (while (re-search-backward "\n[[(]" begin t) |
195 (forward-char 1) | 201 (forward-char 1) |
196 (insert "\\")))) | 202 (insert "\\")))) |
197 (if (null (cdr elt)) | 203 (if (null (cdr elt)) |
198 (princ ")" outbuf) | 204 (princ ")" outbuf) |
199 (princ " " outbuf) | 205 (princ " " outbuf) |