From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#44858: [PATCH] Make byte-compiler warn about wide docstrings Date: Fri, 27 Nov 2020 12:15:03 +0100 Message-ID: References: <83h7pcqjxy.fsf@gnu.org> <87pn3zjivc.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39451"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44858@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 27 12:16:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kibjb-000ABK-He for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Nov 2020 12:16:15 +0100 Original-Received: from localhost ([::1]:46004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kibja-0000fZ-Jy for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Nov 2020 06:16:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kibjO-0000eD-Ke for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2020 06:16:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kibjO-0002ae-Cp for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2020 06:16:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kibjO-0002AI-75 for bug-gnu-emacs@gnu.org; Fri, 27 Nov 2020 06:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Nov 2020 11:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44858 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 44858-submit@debbugs.gnu.org id=B44858.16064757248271 (code B ref 44858); Fri, 27 Nov 2020 11:16:02 +0000 Original-Received: (at 44858) by debbugs.gnu.org; 27 Nov 2020 11:15:24 +0000 Original-Received: from localhost ([127.0.0.1]:44131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kibim-00029K-82 for submit@debbugs.gnu.org; Fri, 27 Nov 2020 06:15:24 -0500 Original-Received: from mail-ej1-f45.google.com ([209.85.218.45]:42777) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kibii-000292-Vr for 44858@debbugs.gnu.org; Fri, 27 Nov 2020 06:15:23 -0500 Original-Received: by mail-ej1-f45.google.com with SMTP id d17so5163989ejy.9 for <44858@debbugs.gnu.org>; Fri, 27 Nov 2020 03:15:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PKzCPAnkDORWYEKzSWwUC/hYnMlyj0eY9xx6Tev6wV0=; b=CDNq45dFDUzf4Wa34M9ZsX8JaBPA+CKXo5Pmeq+BX669obSnduYBfQ3sez2q1XVAr9 WYHVWNR+8BFZa3Q4fFaF0lPt1BbgqE1p2uhWAVn1MWYPC8w4v81IOYJoG1iuClRr8eYi sWoRbMyJCxRHwAwtflTD3kdkkeufw43hPD+GbvyA9tJb4X9r8Dg8MQ4ozs5MFSEzyEm6 4mfngGuoJGnylWPGw3yATe25WKFsBlydiFUmnW4tilBpmOkynqodBAg7PkDtjJTwJ1LC OxLVCHbiOo38XU14UZYqGZQoIPy+Ufhqg16YgpYou3QFU3VlYgszZQhdCHoNQECnxJKh MX4g== X-Gm-Message-State: AOAM5328d8yjWt+QkVF/LvP1xHYcZQuU86+Q0rhYtAZJP6trdIQYm4vn vQsmdHOf2LJLZnE85UELbRaQls6BUrS8fVVpNkc= X-Google-Smtp-Source: ABdhPJysYTy1WSp7PYZBB1QlJUDDXnsEvND507EtUoLb7gs7E3u1JvfKwU2uwyigWABi9O82zxqX35f2X/tD+/BGlcM= X-Received: by 2002:a17:906:2e16:: with SMTP id n22mr5661649eji.477.1606475715313; Fri, 27 Nov 2020 03:15:15 -0800 (PST) In-Reply-To: <87pn3zjivc.fsf@gnus.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:194438 Archived-At: Lars Ingebrigtsen writes: > Eli Zaretskii writes: > > >> For `substitute-command-keys', it would be nice to get it to work, but I > >> don't think we can know the values of keymaps at compile-time. Possibly > >> there is a good solution for this, but I couldn't find it. > > > > How about some simplified heuristics, like assume that the expansion > > takes no more than N characters (where N could be something like 5)? > > This should work in, like, 80% of cases, I think. > > Yup. And 15% is mostly when it expands to `M-x some-long-command' > because the keymap hasn't been loaded yet, I think? Which we could > conceivably fix by loading the file when the used `C-h f's an autoloaded > function with one of these constructs? Perhaps a bit hacky... I would be wary of using a heuristic here, because I think false positives are worse than false negatives in this case. We unfortunately don't have any way of silencing individual warnings, so a user seeing a false positive is left with two suboptimal choices: ignore the warning (a bad habit to train our users in) or change the formatting of a docstring to stop it (potentially making it subjectively worse in the process). How about using the somewhat safer heuristic of treating substitutions as one character wide? Would that make sense?