From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*' Date: Fri, 12 Jan 2018 19:16:09 -0500 Message-ID: References: <83373d5xbz.fsf@gnu.org> <83y3l54g8i.fsf@gnu.org> <3f373c5h9x.fsf@fencepost.gnu.org> <836088408p.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1515802517 7338 195.159.176.226 (13 Jan 2018 00:15:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 13 Jan 2018 00:15:17 +0000 (UTC) User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) Cc: 30068@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 13 01:15:12 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ea9TZ-0001LS-8y for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Jan 2018 01:15:09 +0100 Original-Received: from localhost ([::1]:50304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea9VY-00045v-Ga for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jan 2018 19:17:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea9VQ-00045m-1n for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2018 19:17:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ea9VP-00075Z-0t for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2018 19:17:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46396) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ea9VO-00075G-TO for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2018 19:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ea9VO-0001P9-K5 for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2018 19:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Jan 2018 00:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30068 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30068-submit@debbugs.gnu.org id=B30068.15158025805346 (code B ref 30068); Sat, 13 Jan 2018 00:17:02 +0000 Original-Received: (at 30068) by debbugs.gnu.org; 13 Jan 2018 00:16:20 +0000 Original-Received: from localhost ([127.0.0.1]:54292 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ea9Ui-0001OA-E5 for submit@debbugs.gnu.org; Fri, 12 Jan 2018 19:16:20 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ea9Uf-0001Nw-Il for 30068@debbugs.gnu.org; Fri, 12 Jan 2018 19:16:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ea9UY-0005mr-Rb for 30068@debbugs.gnu.org; Fri, 12 Jan 2018 19:16:12 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ea9UY-0005mh-O3 for 30068@debbugs.gnu.org; Fri, 12 Jan 2018 19:16:10 -0500 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1ea9UY-0006sr-5S; Fri, 12 Jan 2018 19:16:10 -0500 X-Spook: Secret Service Gazprom Mara salvatrucha Craig Livingstone X-Ran: :=6s/*Ptkg&"V1^6fqL~G4mQW&tMiY>\O*#zEfrY{VlO~Eu$Khg!-T{xt0di (Eli Zaretskii's message of "Thu, 11 Jan 2018 22:19:18 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:142113 Archived-At: Eli Zaretskii wrote: >> Keep the real doc only in xfns.c, makes the others just say , or >> , and change Fsnarf_documentation to respect . > > Sounds fine. Are there any downsides? I can't think of any. >> Related: I see Fsnarf_documentation already has skip_file, but it >> doesn't handle lisp files. Maybe it could be taught about >> preloaded-file-list, which would have avoided this particular problem. > > Not sure how: pc-win.el is preloaded (on some platforms). Or maybe I > misunderstand you. If Fsnarf_documentation had skipped the pc-win definition on platforms that did not load pc-win, the problem would have been confined to platforms that do load pc-win. There's only one such: MS-DOS, where no-one's interested in the doc of these functions, so it wouldn't matter. > Btw, there's another, perhaps easier alternative: have only one > definition of the function, with the single copy of the doc string, > and then make it call the platform-dependent parts on the C level. That would be (much) better, but I think it's (much) harder (bug#4402 saw no interest in 8+ years). If anyone ever does it, we won't need a workaround any more. Here's the basic patch for my suggestion. Turns out we can (and must) get rid of skip_files. In addition, all the X/W32/NS "x-" doc-strings need to be combined so that the X version describes all platforms. I thought this was already done, but in one of the first cases I looked it, it wasn't. But this has to be done anyway in the "real" solution, so the effort won't be wasted. --- i/src/doc.c +++ w/src/doc.c @@ -535,7 +535,6 @@ it specifies the file name (without a directory) of the DOC file. EMACS_INT pos; Lisp_Object sym; char *p, *name; - bool skip_file = 0; ptrdiff_t count; char const *dirname; ptrdiff_t dirlen; @@ -609,34 +608,24 @@ it specifies the file name (without a directory) of the DOC file. { end = strchr (p, '\n'); - /* See if this is a file name, and if it is a file in build-files. */ - if (p[1] == 'S') - { - skip_file = 0; - if (end - p > 4 && end[-2] == '.' - && (end[-1] == 'o' || end[-1] == 'c')) - { - ptrdiff_t len = end - p - 2; - char *fromfile = SAFE_ALLOCA (len + 1); - memcpy (fromfile, &p[2], len); - fromfile[len] = 0; - if (fromfile[len-1] == 'c') - fromfile[len-1] = 'o'; - - skip_file = NILP (Fmember (build_string (fromfile), - Vbuild_files)); - } - } + /* We used to skip files not in build_files, so that when a + function is defined several times in different files + (typically, once in xterm, once in w32term, ...), we only + pay attention to the one that matters. + + But this means the doc has to be kept and updated in + multiple files. Nowadays we keep the doc only in eg xterm. + The (f)boundp checks below ensure we don't report + docs for eg w32-specific items on X. + */ sym = oblookup (Vobarray, p + 2, multibyte_chars_in_text ((unsigned char *) p + 2, end - p - 2), end - p - 2); - /* Check skip_file so that when a function is defined several - times in different files (typically, once in xterm, once in - w32term, ...), we only pay attention to the one that - matters. */ - if (! skip_file && SYMBOLP (sym)) + /* Ignore docs that start with SKIP. These mark + placeholders where the real doc is elsewhere. */ + if (SYMBOLP (sym)) { /* Attach a docstring to a variable? */ if (p[1] == 'V') @@ -644,8 +633,9 @@ it specifies the file name (without a directory) of the DOC file. /* Install file-position as variable-documentation property and make it negative for a user-variable (doc starts with a `*'). */ - if (!NILP (Fboundp (sym)) + if ((!NILP (Fboundp (sym)) || !NILP (Fmemq (sym, delayed_init))) + && strncmp (end, "\nSKIP", 5)) Fput (sym, Qvariable_documentation, make_number ((pos + end + 1 - buf) * (end[1] == '*' ? -1 : 1))); @@ -654,7 +644,7 @@ it specifies the file name (without a directory) of the DOC file. /* Attach a docstring to a function? */ else if (p[1] == 'F') { - if (!NILP (Ffboundp (sym))) + if (!NILP (Ffboundp (sym)) && strncmp (end, "\nSKIP", 5)) store_function_docstring (sym, pos + end + 1 - buf); } else if (p[1] == 'S')