From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Patch: perform autoloading when docs is missing from autoload object Date: Wed, 15 Sep 2021 15:51:44 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9685"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 15 15:58:49 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mQVR1-0002Ef-JQ for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Sep 2021 15:58:48 +0200 Original-Received: from localhost ([::1]:45268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQVQy-0000e7-I7 for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Sep 2021 09:58:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQVPC-0007WE-IG for emacs-devel@gnu.org; Wed, 15 Sep 2021 09:56:54 -0400 Original-Received: from mail-vi1eur05olkn2082e.outbound.protection.outlook.com ([2a01:111:f400:7d00::82e]:35106 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQVP8-0007hY-KA for emacs-devel@gnu.org; Wed, 15 Sep 2021 09:56:53 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i4ldtI8yWdsh1U6jBE4Hvvo1/Tusr7Vx26iZbudxNaC34KScWQibufe69Quh4YaVvhDMl3QRbMhQ1D3ha71NoB9COBnEARCSydU7PIn2UP1Avx1cS0Mef8ZcF5TvATFb8Uti9iVmhDKWX+1G/+BCT6+HkOGdNp+GUsCmMZgGf3IS/KMMTP1itx3O6X3C7uLPTtJ8qgjxv8Hb2L7029Au6ut9HRj3Om4UVabD01Qstn3/fVm7eSc7m7k86JlbJ2oBX/1x5K2wqB78cojhk7iAwSzCb4P4OA/f48bW6XyH0xdFa+0Z4K/gBAZ0ihpVK9vCwsB/QCxh9THzZvbNAVeQ+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=bwTMh4R5240s0MkfHrOBFtvQs5euwbC0vJOo0pZ+iU8=; b=AMnXtsTHIknwmxT59HQArJ5OxxiCx2i8rZpLv5eItVZb/BT+muwjt4r39VwUQeznMsH4D4Awmj2AJ5aOdQEeGYD5og+glADiJInGpHCwmL42NfPnCmI0e98YgiW+cgRoVQdfD9kdSpkGwlM0VrwAkSWUtGJhF8UTHM+GphIvG0aDxycKdOTZKp6Y1gen+bHrsSR1mQAGyJ7yk9I9/JoQg/8bPDUYuV6i1+y3WKPd7NwEqzEGrjYrCUPM/8lj/rRB7TkgpcYhKMlG4Quir3LpmPp1iJE+vuOwkulB5WCBI12G46h5f1dIKX1pJljkO6Eqjr0krKUC7rVYisB6MEfYCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bwTMh4R5240s0MkfHrOBFtvQs5euwbC0vJOo0pZ+iU8=; b=dUJqXlTL9+91NoZOP9RHDkQ0/mLVhHIlgS1yFVv6wq5swOW2zVkfT++h3ROHL2X2xe+0XKfJBlKqDMrZpTzXAa9HtrMeH8oGVGqjUg7RLHw0tkpQHYA2+6LZ0wIf8EkItAy1zWPrRcazalxMqth6aZ3G/ESJJK10yLxPHPxm00ZMD9cYXL1jshPbrDN8Drc9KYOFlA7myH9Sp10ev1nqIvpjKYk8uxhgNhJzMiFcvV0bUocBG7FH2Y8gICr00wFeXzhpXgdbSX9xbdcF7wUV/elKx2e2+Sojh1Mvc5WW4WCUUGfC04ngvCb1V+rmZl0e16EHc4PNFolnkloL8HRofQ== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM9PR09MB4980.eurprd09.prod.outlook.com (2603:10a6:20b:302::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 13:51:46 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%8]) with mapi id 15.20.4500.019; Wed, 15 Sep 2021 13:51:46 +0000 X-TMN: [J4w+/3nj5h3PCVROg79UmEQReFUSbEOA] X-ClientProxiedBy: AS9PR06CA0176.eurprd06.prod.outlook.com (2603:10a6:20b:45c::14) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87r1dqvte7.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AS9PR06CA0176.eurprd06.prod.outlook.com (2603:10a6:20b:45c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 13:51:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a099896-1315-438e-a121-08d9784ff48a X-MS-TrafficTypeDiagnostic: AM9PR09MB4980: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kOvMiHX+1SvG3GeGYOuKyJBQ+uOTsWOQ4om7Hc0yrkNvB5USEnq4W3EadPtcTgoIJyBx/E0Fqs58i0sE9Nx6LDGjlCp/ktjJKVhnzThWww8xI6H3i5Yqhfp1m5Kj95DaLaW1jSy1YXT5PzhZPF4fVSQ3l0QiadDLo/YS0c03Y7vo7OYzyJyNoltRE29/3Xrh9uT7VYNHp/wsGlMaq/9Px9XG+0oWWzJkOpgIuLNY+z3eDxtBFmFE4ql7Svwh7vNWqCottPaI/qjTFsG214B5oVC9Ccr9xM2Tsrvj8zO5J4J8WmYGfu9SgqIe9uaMvbJVencdOPOZQAQguPDmB+FPJIpsFN58eMgctclHe7seVWkm/0MADpSuioi0R7uJyaFDNSca09aWxZDwejXGauGRwa1E+GlZ+QmDBFCLWs/m2VNZhkMBnA0y2k/yWZLC0lHb X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JRM1tbdKkDvBS2aFAmjx/o+2CqEy4gVRGq8eNhvWpZDVkMjBYHEN3hscR/anyihj5eHQn5uO4Xacavq5XValwkg2hTS/zU3PEWPupafFfJmrNSVlK8n/IAIMX27nyxudpAdW5fx4WwEOeWlanfgdRA== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 1a099896-1315-438e-a121-08d9784ff48a X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 13:51:46.7644 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR09MB4980 Received-SPF: pass client-ip=2a01:111:f400:7d00::82e; envelope-from=arthur.miller@live.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:274742 Archived-At: --=-=-= Content-Type: text/plain I would like help functions to autoload files when help on symbols is requestd. Built-in help do that only in limited cases, while helpful dutifully loads libraries when symbol is not loaded. I would actually prefer to just load documentation not the entire library, and I think I can do that, but it is a little bit more involved (have to find source and read the docs), unlike just performing autoloading. About the patch: there is already an help-enable-autoload option for built-in help, probably meant to do exactly what I want, but it is much more savvy what it loads (only kemaps I think?). I have introduced new variable, help-enable-symbol-autoload, and more aggressive autoloading will be performed only when this one is set to 't, so it is an opt-in option. I would gladly skip that extra variable and use original one, but that would turn it into opt-out option which might not be desired by everyone. I am not sure if understand exact usage of built-in help functions, but the main entry should be describe-* functions, and this should only affect those? I am little bit unsecure here. I have two versions, I prefer the first, help-fns.el only one, but as said, I am a bit unsure how help functions are used, so I have attached an alternative too. To note: this is only for functions, I am not sure if it is needed for variables? It is just a proposal. Best regards /a --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-only-help-fns.patch >From 45e387e15166c5194fe4b78ec01bb65f0db9bcb4 Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Wed, 15 Sep 2021 15:15:30 +0200 Subject: [PATCH] Do autoload if docs are not present in autoloads * lisp/help-fns.el ('help-enable-symbol-autoload'): New option. (help-fns--analyze-function): Perform autoloading when docs are missing from autoload objects. --- lisp/help-fns.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index a7219ede94..575c69638d 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -132,6 +132,12 @@ help-enable-completion-autoload :group 'help :version "26.3") +(defcustom help-enable-symbol-autoload nil + "Perform autoload if docs are missing from autoload objects." + :type 'boolean + :group 'help + :version "28.1") + (defun help--symbol-class (s) "Return symbol class characters for symbol S." (when (stringp s) @@ -823,6 +829,11 @@ help-fns--analyze-function f)) ((subrp def) (intern (subr-name def))) (t def)))) + + (and (autoloadp real-def) (not (nth 2 real-def)) + help-enable-symbol-autoload + (autoload-do-load real-def)) + (list real-function def aliased real-def))) (defun help-fns-function-description-header (function) -- 2.33.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-with-help.el.patch >From 1f6fd7ee99b3807e012d366d71679ae917cac096 Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Wed, 15 Sep 2021 12:40:34 +0200 Subject: [PATCH] Load symbols when docs are not present in autoloads * lisp/help-fns.el ('help-enable-symbol-autoload'): New option. * lisp/help.el (help-function-arglist): Check if docs are present in autoload object, and perform autoload if they are not. --- lisp/help-fns.el | 6 ++++++ lisp/help.el | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index a7219ede94..842bcb39fe 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -132,6 +132,12 @@ help-enable-completion-autoload :group 'help :version "26.3") +(defcustom help-enable-symbol-autoload nil + "Perform autoload when documentation is not present in autoload object." + :type 'boolean + :group 'help + :version "28.1") + (defun help--symbol-class (s) "Return symbol class characters for symbol S." (when (stringp s) diff --git a/lisp/help.el b/lisp/help.el index 29ae340481..9b6ae0c821 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1883,6 +1883,10 @@ help-function-arglist "Return a formal argument list for the function DEF. If PRESERVE-NAMES is non-nil, return a formal arglist that uses the same names as used in the original source code, when possible." + ;; Load docs for autoloads when doc is missing. + (if (and (autoloadp def) (not (nth 2 def)) help-enable-symbol-autoload + (not (and (nth 4 def) (eq (nth 4 def) 'keymap)))) + (autoload-do-load def)) ;; Handle symbols aliased to other symbols. (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def))) ;; Advice wrappers have "catch all" args, so fetch the actual underlying -- 2.33.0 --=-=-=--