comparison lisp/emacs-lisp/autoload.el @ 17750:f11a3a49088c

(defcustom): Add doc-string-elt property. (make-autoload): Convert defcustom into defvar.
author Richard M. Stallman <rms@gnu.org>
date Mon, 12 May 1997 01:14:36 +0000
parents b2c8fb8139c8
children 6e7bb77cd7e1
comparison
equal deleted inserted replaced
17749:52f0da9d19ff 17750:f11a3a49088c
30 ;; source; if you're going to use this, you'd better be able to. 30 ;; source; if you're going to use this, you'd better be able to.
31 31
32 ;;; Code: 32 ;;; Code:
33 33
34 (defun make-autoload (form file) 34 (defun make-autoload (form file)
35 "Turn FORM, a defun or defmacro, into an autoload for source file FILE. 35 "Turn FORM into an autoload or defvar for source file FILE.
36 Returns nil if FORM is not a defun, define-skeleton or defmacro." 36 Returns nil if FORM is not a defun, define-skeleton, defmacro or defcustom."
37 (let ((car (car-safe form))) 37 (let ((car (car-safe form)))
38 (if (memq car '(defun define-skeleton defmacro)) 38 (if (memq car '(defun define-skeleton defmacro))
39 (let ((macrop (eq car 'defmacro)) 39 (let ((macrop (eq car 'defmacro))
40 name doc) 40 name doc)
41 (setq form (cdr form) 41 (setq form (cdr form)
50 (setq doc nil)) 50 (setq doc nil))
51 (list 'autoload (list 'quote name) file doc 51 (list 'autoload (list 'quote name) file doc
52 (or (eq car 'define-skeleton) 52 (or (eq car 'define-skeleton)
53 (eq (car-safe (car form)) 'interactive)) 53 (eq (car-safe (car form)) 'interactive))
54 (if macrop (list 'quote 'macro) nil))) 54 (if macrop (list 'quote 'macro) nil)))
55 nil))) 55 (if (eq car 'defcustom)
56 (let ((varname (car-safe (cdr-safe form)))
57 (init (car-safe (cdr-safe (cdr-safe form))))
58 (doc (car-safe (cdr-safe (cdr-safe (cdr-safe form))))))
59 (list 'defvar varname init doc))
60 nil))))
56 61
57 (put 'define-skeleton 'doc-string-elt 3) 62 (put 'define-skeleton 'doc-string-elt 3)
58 63
59 (defconst generate-autoload-cookie ";;;###autoload" 64 (defconst generate-autoload-cookie ";;;###autoload"
60 "Magic comment indicating the following form should be autoloaded. 65 "Magic comment indicating the following form should be autoloaded.
96 ;;; there should be no such files. 101 ;;; there should be no such files.
97 102
98 (put 'autoload 'doc-string-elt 3) 103 (put 'autoload 'doc-string-elt 3)
99 (put 'defun 'doc-string-elt 3) 104 (put 'defun 'doc-string-elt 3)
100 (put 'defvar 'doc-string-elt 3) 105 (put 'defvar 'doc-string-elt 3)
106 (put 'defcustom 'doc-string-elt 3)
101 (put 'defconst 'doc-string-elt 3) 107 (put 'defconst 'doc-string-elt 3)
102 (put 'defmacro 'doc-string-elt 3) 108 (put 'defmacro 'doc-string-elt 3)
103 109
104 (defun autoload-trim-file-name (file) 110 (defun autoload-trim-file-name (file)
105 ;; Returns a relative pathname of FILE 111 ;; Returns a relative pathname of FILE