comparison src/doc.c @ 647:529171c8b71c

entered into RCS
author Jim Blandy <jimb@redhat.com>
date Mon, 18 May 1992 08:13:37 +0000
parents 63a8e7b3c547
children e95ecc378efa
comparison
equal deleted inserted replaced
646:e283d4164aca 647:529171c8b71c
103 103
104 DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, 104 DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0,
105 "Return the documentation string of FUNCTION.\n\ 105 "Return the documentation string of FUNCTION.\n\
106 Unless a non-nil second argument is given, the\n\ 106 Unless a non-nil second argument is given, the\n\
107 string is passed through `substitute-command-keys'.") 107 string is passed through `substitute-command-keys'.")
108 (fun1, raw) 108 (function, raw)
109 Lisp_Object fun1, raw; 109 Lisp_Object function, raw;
110 { 110 {
111 Lisp_Object fun; 111 Lisp_Object fun;
112 Lisp_Object funcar; 112 Lisp_Object funcar;
113 Lisp_Object tem, doc; 113 Lisp_Object tem, doc;
114 114
115 fun = fun1; 115 fun = Findirect_function (function);
116 while (XTYPE (fun) == Lisp_Symbol)
117 {
118 QUIT;
119 fun = Fsymbol_function (fun);
120 }
121 116
122 switch (XTYPE (fun)) 117 switch (XTYPE (fun))
123 { 118 {
124 case Lisp_Subr: 119 case Lisp_Subr:
125 if (XSUBR (fun)->doc == 0) return Qnil; 120 if (XSUBR (fun)->doc == 0) return Qnil;
147 142
148 case Lisp_Cons: 143 case Lisp_Cons:
149 funcar = Fcar (fun); 144 funcar = Fcar (fun);
150 if (XTYPE (funcar) != Lisp_Symbol) 145 if (XTYPE (funcar) != Lisp_Symbol)
151 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 146 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
152 if (XSYMBOL (funcar) == XSYMBOL (Qkeymap)) 147 else if (EQ (funcar, Qkeymap))
153 return build_string ("Prefix command (definition is a keymap associating keystrokes with\n\ 148 return build_string ("Prefix command (definition is a keymap associating keystrokes with\n\
154 subcommands.)"); 149 subcommands.)");
155 if (XSYMBOL (funcar) == XSYMBOL (Qlambda) 150 else if (EQ (funcar, Qlambda)
156 || XSYMBOL (funcar) == XSYMBOL (Qautoload)) 151 || EQ (funcar, Qautoload))
157 { 152 {
158 tem = Fcar (Fcdr (Fcdr (fun))); 153 tem = Fcar (Fcdr (Fcdr (fun)));
159 if (XTYPE (tem) == Lisp_String) 154 if (XTYPE (tem) == Lisp_String)
160 doc = tem; 155 doc = tem;
161 else if (XTYPE (tem) == Lisp_Int && XINT (tem) >= 0) 156 else if (XTYPE (tem) == Lisp_Int && XINT (tem) >= 0)
162 doc = get_doc_string (XFASTINT (tem)); 157 doc = get_doc_string (XFASTINT (tem));
163 else 158 else
164 return Qnil; 159 return Qnil;
160
161 break;
165 } 162 }
166 if (XSYMBOL (funcar) == XSYMBOL (Qmocklisp)) 163 else if (EQ (funcar, Qmocklisp))
167 return Qnil; 164 return Qnil;
168 if (XSYMBOL (funcar) == XSYMBOL (Qmacro)) 165 else if (EQ (funcar, Qmacro))
169 return Fdocumentation (Fcdr (fun), raw); 166 return Fdocumentation (Fcdr (fun), raw);
170 167
171 /* Fall through to the default to report an error. */ 168 /* Fall through to the default to report an error. */
172 169
173 default: 170 default: