aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.c
diff options
context:
space:
mode:
authorRoland McGrath1992-03-06 23:46:21 +0000
committerRoland McGrath1992-03-06 23:46:21 +0000
commitee04dc54f4e86c57e64312ae5b0b48b260fbf781 (patch)
tree5ecf5f8f0a6a344e44badb8dfd5ba0734de24597 /src/doc.c
parent7c163413f12bf62efa4a4d2ada8f80a027d770ad (diff)
downloademacs-ee04dc54f4e86c57e64312ae5b0b48b260fbf781.tar.gz
emacs-ee04dc54f4e86c57e64312ae5b0b48b260fbf781.zip
*** empty log message ***
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/src/doc.c b/src/doc.c
index 98585f89b2e..ee6c87d5231 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -101,14 +101,16 @@ get_doc_string (filepos)
101 return make_string (buf, p - buf); 101 return make_string (buf, p - buf);
102} 102}
103 103
104DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 1, 0, 104DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0,
105 "Return the documentation string of FUNCTION.") 105 "Return the documentation string of FUNCTION.
106 (fun1) 106Unless a non-nil second argument is given, the
107 Lisp_Object fun1; 107string is passed through `substitute-command-keys'.")
108 (fun1, raw)
109 Lisp_Object fun1, raw;
108{ 110{
109 Lisp_Object fun; 111 Lisp_Object fun;
110 Lisp_Object funcar; 112 Lisp_Object funcar;
111 Lisp_Object tem; 113 Lisp_Object tem, doc;
112 114
113 fun = fun1; 115 fun = fun1;
114 while (XTYPE (fun) == Lisp_Symbol) 116 while (XTYPE (fun) == Lisp_Symbol)
@@ -122,20 +124,22 @@ DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 1, 0,
122 case Lisp_Subr: 124 case Lisp_Subr:
123 if (XSUBR (fun)->doc == 0) return Qnil; 125 if (XSUBR (fun)->doc == 0) return Qnil;
124 if ((int) XSUBR (fun)->doc >= 0) 126 if ((int) XSUBR (fun)->doc >= 0)
125 return Fsubstitute_command_keys (build_string (XSUBR (fun)->doc)); 127 doc = build_string (XSUBR (fun)->doc);
126 else 128 else
127 return 129 doc = get_doc_string (- (int) XSUBR (fun)->doc);
128 Fsubstitute_command_keys (get_doc_string (- (int) XSUBR (fun)->doc)); 130 break;
129 131
130 case Lisp_Compiled: 132 case Lisp_Compiled:
131 if (XVECTOR (fun)->size <= COMPILED_DOC_STRING) 133 if (XVECTOR (fun)->size <= COMPILED_DOC_STRING)
132 return Qnil; 134 return Qnil;
133 tem = XVECTOR (fun)->contents[COMPILED_DOC_STRING]; 135 tem = XVECTOR (fun)->contents[COMPILED_DOC_STRING];
134 if (XTYPE (tem) == Lisp_String) 136 if (XTYPE (tem) == Lisp_String)
135 return Fsubstitute_command_keys (tem); 137 doc = tem;
136 if (XTYPE (tem) == Lisp_Int && XINT (tem) >= 0) 138 else if (XTYPE (tem) == Lisp_Int && XINT (tem) >= 0)
137 return Fsubstitute_command_keys (get_doc_string (XFASTINT (tem))); 139 doc = get_doc_string (XFASTINT (tem));
138 return Qnil; 140 else
141 return Qnil;
142 break;
139 143
140 case Lisp_String: 144 case Lisp_String:
141 case Lisp_Vector: 145 case Lisp_Vector:
@@ -153,37 +157,45 @@ subcommands.)");
153 { 157 {
154 tem = Fcar (Fcdr (Fcdr (fun))); 158 tem = Fcar (Fcdr (Fcdr (fun)));
155 if (XTYPE (tem) == Lisp_String) 159 if (XTYPE (tem) == Lisp_String)
156 return Fsubstitute_command_keys (tem); 160 doc = tem;
157 if (XTYPE (tem) == Lisp_Int && XINT (tem) >= 0) 161 else if (XTYPE (tem) == Lisp_Int && XINT (tem) >= 0)
158 return Fsubstitute_command_keys (get_doc_string (XFASTINT (tem))); 162 doc = get_doc_string (XFASTINT (tem));
159 return Qnil; 163 else
164 return Qnil;
160 } 165 }
161 if (XSYMBOL (funcar) == XSYMBOL (Qmocklisp)) 166 if (XSYMBOL (funcar) == XSYMBOL (Qmocklisp))
162 return Qnil; 167 return Qnil;
163 if (XSYMBOL (funcar) == XSYMBOL (Qmacro)) 168 if (XSYMBOL (funcar) == XSYMBOL (Qmacro))
164 return Fdocumentation (Fcdr (fun)); 169 return Fdocumentation (Fcdr (fun), raw);
165 170
166 /* Fall through to the default to report an error. */ 171 /* Fall through to the default to report an error. */
167 172
168 default: 173 default:
169 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 174 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
170 } 175 }
176
177 if (NULL (raw))
178 doc = Fsubstitute_command_keys (doc);
179 return doc;
171} 180}
172 181
173DEFUN ("documentation-property", Fdocumentation_property, 182DEFUN ("documentation-property", Fdocumentation_property,
174 Sdocumentation_property, 2, 2, 0, 183 Sdocumentation_property, 2, 2, 0,
184
175 "Return the documentation string that is SYMBOL's PROP property.\n\ 185 "Return the documentation string that is SYMBOL's PROP property.\n\
176This differs from using `get' only in that it can refer to strings\n\ 186This is like `get', but it can refer to strings stored in the\n\
177stored in the `share-lib/DOC' file.") 187`share-lib/DOC' file; and if the value is a string, it is passed through\n\
178 (sym, prop) 188`substitute-command-keys'. A non-nil third argument avoids this
179 Lisp_Object sym, prop; 189translation."
190 (sym, prop, raw)
191 Lisp_Object sym, prop, raw;
180{ 192{
181 register Lisp_Object tem; 193 register Lisp_Object tem;
182 194
183 tem = Fget (sym, prop); 195 tem = Fget (sym, prop);
184 if (XTYPE (tem) == Lisp_Int) 196 if (XTYPE (tem) == Lisp_Int)
185 tem = get_doc_string (XINT (tem) > 0 ? XINT (tem) : - XINT (tem)); 197 tem = get_doc_string (XINT (tem) > 0 ? XINT (tem) : - XINT (tem));
186 if (XTYPE (tem) == Lisp_String) 198 if (NULL (raw) && XTYPE (tem) == Lisp_String)
187 return Fsubstitute_command_keys (tem); 199 return Fsubstitute_command_keys (tem);
188 return tem; 200 return tem;
189} 201}