diff options
| author | Glenn Morris | 2018-02-13 14:22:16 -0800 |
|---|---|---|
| committer | Glenn Morris | 2018-02-13 14:22:16 -0800 |
| commit | 4bee1b8bacb9ce6107ea605da464d01f6bd3aa7d (patch) | |
| tree | dc5dc2098f8956b66620cc1003601f705c289cd2 /src/doc.c | |
| parent | 6c7186de3bbb2b7652cdc01a68bee035761197e5 (diff) | |
| download | emacs-4bee1b8bacb9ce6107ea605da464d01f6bd3aa7d.tar.gz emacs-4bee1b8bacb9ce6107ea605da464d01f6bd3aa7d.zip | |
Stop keeping multiple doc copies for items defined multiple times
It was always a nuisance to keep all the copies in sync.
* src/doc.c (Fsnarf_documentation): Don't skip entire files.
Instead, skip individual doc strings starting with "SKIP".
* doc/lispref/internals.texi (Writing Emacs Primitives):
Mention this skipping.
* lisp/term/ns-win.el, lisp/term/pc-win.el, src/dosfns.c:
* src/frame.c, src/nsfns.m, src/nsmenu.m, src/nsterm.m:
* src/w16select.c, src/w32fns.c, src/w32menu.c, src/w32select.c:
* src/w32term.c, src/xmenu.c: Remove duplicated doc strings.
* src/xfns.c: Merge in information from doc string duplicates.
Diffstat (limited to 'src/doc.c')
| -rw-r--r-- | src/doc.c | 42 |
1 files changed, 16 insertions, 26 deletions
| @@ -535,7 +535,6 @@ the same file name is found in the `doc-directory'. */) | |||
| 535 | EMACS_INT pos; | 535 | EMACS_INT pos; |
| 536 | Lisp_Object sym; | 536 | Lisp_Object sym; |
| 537 | char *p, *name; | 537 | char *p, *name; |
| 538 | bool skip_file = 0; | ||
| 539 | ptrdiff_t count; | 538 | ptrdiff_t count; |
| 540 | char const *dirname; | 539 | char const *dirname; |
| 541 | ptrdiff_t dirlen; | 540 | ptrdiff_t dirlen; |
| @@ -609,34 +608,24 @@ the same file name is found in the `doc-directory'. */) | |||
| 609 | { | 608 | { |
| 610 | end = strchr (p, '\n'); | 609 | end = strchr (p, '\n'); |
| 611 | 610 | ||
| 612 | /* See if this is a file name, and if it is a file in build-files. */ | 611 | /* We used to skip files not in build_files, so that when a |
| 613 | if (p[1] == 'S') | 612 | function was defined several times in different files |
| 614 | { | 613 | (typically, once in xterm, once in w32term, ...), we only |
| 615 | skip_file = 0; | 614 | paid attention to the relevant one. |
| 616 | if (end - p > 4 && end[-2] == '.' | 615 | |
| 617 | && (end[-1] == 'o' || end[-1] == 'c')) | 616 | But this meant the doc had to be kept and updated in |
| 618 | { | 617 | multiple files. Nowadays we keep the doc only in eg xterm. |
| 619 | ptrdiff_t len = end - p - 2; | 618 | The (f)boundp checks below ensure we don't report |
| 620 | char *fromfile = SAFE_ALLOCA (len + 1); | 619 | docs for eg w32-specific items on X. |
| 621 | memcpy (fromfile, &p[2], len); | 620 | */ |
| 622 | fromfile[len] = 0; | ||
| 623 | if (fromfile[len-1] == 'c') | ||
| 624 | fromfile[len-1] = 'o'; | ||
| 625 | |||
| 626 | skip_file = NILP (Fmember (build_string (fromfile), | ||
| 627 | Vbuild_files)); | ||
| 628 | } | ||
| 629 | } | ||
| 630 | 621 | ||
| 631 | sym = oblookup (Vobarray, p + 2, | 622 | sym = oblookup (Vobarray, p + 2, |
| 632 | multibyte_chars_in_text ((unsigned char *) p + 2, | 623 | multibyte_chars_in_text ((unsigned char *) p + 2, |
| 633 | end - p - 2), | 624 | end - p - 2), |
| 634 | end - p - 2); | 625 | end - p - 2); |
| 635 | /* Check skip_file so that when a function is defined several | 626 | /* Ignore docs that start with SKIP. These mark |
| 636 | times in different files (typically, once in xterm, once in | 627 | placeholders where the real doc is elsewhere. */ |
| 637 | w32term, ...), we only pay attention to the one that | 628 | if (SYMBOLP (sym)) |
| 638 | matters. */ | ||
| 639 | if (! skip_file && SYMBOLP (sym)) | ||
| 640 | { | 629 | { |
| 641 | /* Attach a docstring to a variable? */ | 630 | /* Attach a docstring to a variable? */ |
| 642 | if (p[1] == 'V') | 631 | if (p[1] == 'V') |
| @@ -644,8 +633,9 @@ the same file name is found in the `doc-directory'. */) | |||
| 644 | /* Install file-position as variable-documentation property | 633 | /* Install file-position as variable-documentation property |
| 645 | and make it negative for a user-variable | 634 | and make it negative for a user-variable |
| 646 | (doc starts with a `*'). */ | 635 | (doc starts with a `*'). */ |
| 647 | if (!NILP (Fboundp (sym)) | 636 | if ((!NILP (Fboundp (sym)) |
| 648 | || !NILP (Fmemq (sym, delayed_init))) | 637 | || !NILP (Fmemq (sym, delayed_init))) |
| 638 | && strncmp (end, "\nSKIP", 5)) | ||
| 649 | Fput (sym, Qvariable_documentation, | 639 | Fput (sym, Qvariable_documentation, |
| 650 | make_number ((pos + end + 1 - buf) | 640 | make_number ((pos + end + 1 - buf) |
| 651 | * (end[1] == '*' ? -1 : 1))); | 641 | * (end[1] == '*' ? -1 : 1))); |
| @@ -654,7 +644,7 @@ the same file name is found in the `doc-directory'. */) | |||
| 654 | /* Attach a docstring to a function? */ | 644 | /* Attach a docstring to a function? */ |
| 655 | else if (p[1] == 'F') | 645 | else if (p[1] == 'F') |
| 656 | { | 646 | { |
| 657 | if (!NILP (Ffboundp (sym))) | 647 | if (!NILP (Ffboundp (sym)) && strncmp (end, "\nSKIP", 5)) |
| 658 | store_function_docstring (sym, pos + end + 1 - buf); | 648 | store_function_docstring (sym, pos + end + 1 - buf); |
| 659 | } | 649 | } |
| 660 | else if (p[1] == 'S') | 650 | else if (p[1] == 'S') |