diff options
| author | Eli Zaretskii | 2012-11-13 16:17:18 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-11-13 16:17:18 +0200 |
| commit | 3c4ca7155293ffc2d04708007131bcbc882d8913 (patch) | |
| tree | 61787be8cd43b6fb3d5159852fbd186eea404de7 /src/doc.c | |
| parent | 5ade42a5114255c43117065494b96d480c1e1588 (diff) | |
| parent | c708524567662c8911c5ab2695acc7bda0383705 (diff) | |
| download | emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.tar.gz emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.zip | |
Merge from trunk.
Diffstat (limited to 'src/doc.c')
| -rw-r--r-- | src/doc.c | 35 |
1 files changed, 16 insertions, 19 deletions
| @@ -21,7 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | 22 | ||
| 23 | #include <sys/types.h> | 23 | #include <sys/types.h> |
| 24 | #include <sys/file.h> /* Must be after sys/types.h for USG*/ | 24 | #include <sys/file.h> /* Must be after sys/types.h for USG. */ |
| 25 | #include <fcntl.h> | 25 | #include <fcntl.h> |
| 26 | #include <unistd.h> | 26 | #include <unistd.h> |
| 27 | 27 | ||
| @@ -42,7 +42,7 @@ static ptrdiff_t get_doc_string_buffer_size; | |||
| 42 | 42 | ||
| 43 | static unsigned char *read_bytecode_pointer; | 43 | static unsigned char *read_bytecode_pointer; |
| 44 | 44 | ||
| 45 | /* readchar in lread.c calls back here to fetch the next byte. | 45 | /* `readchar' in lread.c calls back here to fetch the next byte. |
| 46 | If UNREADFLAG is 1, we unread a byte. */ | 46 | If UNREADFLAG is 1, we unread a byte. */ |
| 47 | 47 | ||
| 48 | int | 48 | int |
| @@ -338,15 +338,9 @@ string is passed through `substitute-command-keys'. */) | |||
| 338 | 338 | ||
| 339 | doc = Qnil; | 339 | doc = Qnil; |
| 340 | 340 | ||
| 341 | if (SYMBOLP (function)) | ||
| 342 | { | ||
| 343 | Lisp_Object tem = Fget (function, Qfunction_documentation); | ||
| 344 | if (!NILP (tem)) | ||
| 345 | return Fdocumentation_property (function, Qfunction_documentation, | ||
| 346 | raw); | ||
| 347 | } | ||
| 348 | |||
| 349 | fun = Findirect_function (function, Qnil); | 341 | fun = Findirect_function (function, Qnil); |
| 342 | if (CONSP (fun) && EQ (XCAR (fun), Qmacro)) | ||
| 343 | fun = XCDR (fun); | ||
| 350 | if (SUBRP (fun)) | 344 | if (SUBRP (fun)) |
| 351 | { | 345 | { |
| 352 | if (XSUBR (fun)->doc == 0) | 346 | if (XSUBR (fun)->doc == 0) |
| @@ -400,8 +394,6 @@ string is passed through `substitute-command-keys'. */) | |||
| 400 | else | 394 | else |
| 401 | return Qnil; | 395 | return Qnil; |
| 402 | } | 396 | } |
| 403 | else if (EQ (funcar, Qmacro)) | ||
| 404 | return Fdocumentation (Fcdr (fun), raw); | ||
| 405 | else | 397 | else |
| 406 | goto oops; | 398 | goto oops; |
| 407 | } | 399 | } |
| @@ -411,16 +403,19 @@ string is passed through `substitute-command-keys'. */) | |||
| 411 | xsignal1 (Qinvalid_function, fun); | 403 | xsignal1 (Qinvalid_function, fun); |
| 412 | } | 404 | } |
| 413 | 405 | ||
| 414 | /* Check for an advised function. Its doc string | 406 | /* Check for a dynamic docstring. These come with |
| 415 | has an `ad-advice-info' text property. */ | 407 | a dynamic-docstring-function text property. */ |
| 416 | if (STRINGP (doc)) | 408 | if (STRINGP (doc)) |
| 417 | { | 409 | { |
| 418 | Lisp_Object innerfunc; | 410 | Lisp_Object func |
| 419 | innerfunc = Fget_text_property (make_number (0), | 411 | = Fget_text_property (make_number (0), |
| 420 | intern ("ad-advice-info"), | 412 | intern ("dynamic-docstring-function"), |
| 421 | doc); | 413 | doc); |
| 422 | if (! NILP (innerfunc)) | 414 | if (!NILP (func)) |
| 423 | doc = call1 (intern ("ad-make-advised-docstring"), innerfunc); | 415 | /* Pass both `doc' and `function' since `function' can be needed, and |
| 416 | finding `doc' can be annoying: calling `documentation' is not an | ||
| 417 | option because it would infloop. */ | ||
| 418 | doc = call2 (func, doc, function); | ||
| 424 | } | 419 | } |
| 425 | 420 | ||
| 426 | /* If DOC is 0, it's typically because of a dumped file missing | 421 | /* If DOC is 0, it's typically because of a dumped file missing |
| @@ -528,6 +523,8 @@ store_function_docstring (Lisp_Object obj, ptrdiff_t offset) | |||
| 528 | { | 523 | { |
| 529 | tem = Fcdr (Fcdr (fun)); | 524 | tem = Fcdr (Fcdr (fun)); |
| 530 | if (CONSP (tem) && INTEGERP (XCAR (tem))) | 525 | if (CONSP (tem) && INTEGERP (XCAR (tem))) |
| 526 | /* FIXME: This modifies typically pure hash-cons'd data, so its | ||
| 527 | correctness is quite delicate. */ | ||
| 531 | XSETCAR (tem, make_number (offset)); | 528 | XSETCAR (tem, make_number (offset)); |
| 532 | } | 529 | } |
| 533 | else if (EQ (tem, Qmacro)) | 530 | else if (EQ (tem, Qmacro)) |