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: Re: Patch: perform autoloading when docs is missing from autoload object Date: Fri, 17 Sep 2021 23:09:29 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37500"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 17 23:11:43 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 1mRL93-0009Yk-UL for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 23:11:43 +0200 Original-Received: from localhost ([::1]:47650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRL92-0005h1-RD for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 17:11:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRL74-0004Az-Jk for emacs-devel@gnu.org; Fri, 17 Sep 2021 17:09:38 -0400 Original-Received: from mail-oln040092067102.outbound.protection.outlook.com ([40.92.67.102]:43171 helo=EUR02-AM5-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 1mRL70-000839-12 for emacs-devel@gnu.org; Fri, 17 Sep 2021 17:09:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=klnG1QkoUPOg2BhiMrGWW9aLRvAMsSDpxEbk6JUXgLTtf7AQrB0q4JDpf81V+14BQM0sH21fi3+wAfiuH2oF3fNShpR0fDhq8TCAgrFiMpFnOxiFGN2hu0TL6fw0kVzKHMerH5I8vk29YKueA/3j++X5G2UskUX9aK4yBqL5T7EwmVU0+ir1hgmHqMoRn7mNQHUr+arzY+pYexQZSCJ3UQy7fQIjkfMljEyCa4+wL6ZnX476O8bMpL78Cbte51ue4ZITAQ3N7qcrOLSzgRB26IRpR5RlI7/h6oRUqSAxl4FSH/U/dSmgnXcZYC6RUyn0fCmbRFhgpzeXiVse4Wvgyg== 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=B72XLHEeJThsCKu/NyXX0Oi03MNY1yyvSzhqSh5w0dw=; b=JuQQItyCXSw210zPql1sfDyJJ114l9pwRbvFFlSfvilr6N7YFJUld6VliMvgqIox5xtPh9eH0ilN8C+UVJBYrEJwQ3xz/v7SP3NZ8cgPAL5TmVB+I+/pwk3WAL/XyaRMfS8UA5p5OaWhdKboM2fPV/4C4V0gRYZEe2oDROWm6FEIHcaRPzfv9WujdONKus9CFBbAKybNAH1U/QfUNvZSgKWG9Blzb7nGLsjqfiC06BUxxvyHUxMjzOd/tW//DdBwUsiVbVq741wVIXHBFU0rs0MKs3T9uso7U63GAqSYgn6VTu/hl9bF9hhmuQH7xS+rlvOCPD+Dg90EHnU90nNpGw== 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=B72XLHEeJThsCKu/NyXX0Oi03MNY1yyvSzhqSh5w0dw=; b=J/M7QvTTHX6o1j/LJrc0eru5foHSWJz+82Jg9KmPLkCvmBxvqR0zpj3IKdGRvOdBwg97FKTIQT9YspkQgy4aDK63lNF9AcJGRTpCKQ+5pjC3NCbSMIg0Hl88Ny4O4KCk5LUYI85DcAL/M/3rkqx5a9onW0YoDntGuctUYnl0JBIIewh7eNLlTvmF8pAsjS+yb/+7YJLIFhDV8mJfX+KpmJ54lBPYNmZpnKd645pgFKn87pZW0hEa9HOkRrnKbZSvoxPcyIgX0EknNHNtYmHNz8ZB2iupMq6fBfjDlfSKaHC/IZrLj9ltWM2dZWyMsPfcGkF/kWaNMYQfJkSwY1OGSw== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB4147.eurprd09.prod.outlook.com (2603:10a6:208:192::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Fri, 17 Sep 2021 21:09:30 +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%9]) with mapi id 15.20.4523.018; Fri, 17 Sep 2021 21:09:30 +0000 In-Reply-To: (Stefan Monnier's message of "Fri, 17 Sep 2021 12:38:00 -0400") X-TMN: [hsFim3rydWglXdDJH8MjEqxP5Tk2wt+1] X-ClientProxiedBy: AM6P191CA0066.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::43) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <878rzu52pi.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM6P191CA0066.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Fri, 17 Sep 2021 21:09:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0ea95206-d114-49c0-c310-08d97a1f7076 X-MS-TrafficTypeDiagnostic: AM0PR09MB4147: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FXGf28clzSMy8NAYhOs3MFf/+aI9EXldrw1fN3Wm3AROXJJUay33MdiFrhX05phI6CI7fQua3/LEaogZZZOvujPAlIJ1hglRaxB5jS8KLRSf+XsiNRjgWHhkunVKpetZRyQHW9iyRjKZUucof++i+xwO08NTMNAjTYm4kWJKnpweMfHSzUY5CMCFDiv9e01TFSxwgoviFWWjQr4NhSpFtwrxArcX2RlgElxsyOBvFZkCrWBjRLRBvxz9d7GTLGzSUthIb2JaBIdaC+Um3a6qSLhIOe1OfM8g5fDLxGOxQ7VISAQ7sS5RmIjZWQnQrfJaA3CMhbsNKAbYcniU3JMa6RIoSEt8pZFX20dI279P8XVuWZiSdrnmhawlhxtt++BFkn4HUW7gC4tSwWSLaNjnr4YI9lm+U2k2K0pC3m3murWdQFUTwvRMimgIL2VBJQjY X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yZqWCZXUDcE7kCd2GWOyLLL/wEeD5LjsIClAUb/RDUxyEFSVZAXOKsTRG4sS7kB74VppQZzJBnqfPdIssfcgoFI2FV8A6qOW9fM4X7kZfxXDVY0wl/0NNpBDLbFoPcOApO2O17afTBVydkczk3VukQ== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 0ea95206-d114-49c0-c310-08d97a1f7076 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2021 21:09:30.3711 (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: AM0PR09MB4147 Received-SPF: pass client-ip=40.92.67.102; envelope-from=arthur.miller@live.com; helo=EUR02-AM5-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, RCVD_IN_MSPIKE_H2=-0.001, 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:274941 Archived-At: Stefan Monnier writes: >> Indeed. My thoughts were to read .elc when avialable, > > I'm not sure you're familiar with the way it works for functions, but > basically the docstring is replaced by a "pointer" that's a cons cell > that combines the name of the file from which the function was loaded > together with an integer indicating at which byte-offset the docstring > can be found (the filename string is the same string used in all the > docstring of that file as well as the string used in `load-history`, in > terms of memory cost, it only really costs a single con-cell). Actually I was quite aware of that part, and how it works there. I looked at that very explicitly. I am quite aware that it costs just an offset there, and I don't have anything against that. I have no intention to do anything for that case, it works as it is. I am not sure that we speak about the same thing. I am talking about the case when there is a nil for doc, and library needs to be autoloaded. When I ask for the help form describe-function, if there is a 'nil in the autoload object itself, I would prefer not to load the entire library just to load the symbol documentation for the use in help-mode buffer. Lars expressed some concerns about loading library just for the doc purpose, so it might be more appropriate in that case. > So there'd be no need for "when available" heuristic. Yes, in case you have that pointer, which I wasn't objecting to at all, but not when you have a nil instead of that pointer. Or am I wrong there? > And all the code is already there to do the same for autoloads. You mean to start generating those pointers instead of embedding the docs? It would be an improvement indeed :). Still the case of hand-crafted code or code generating but something else than supplied autoloading routines leaves for a fully valid nil to be a part of the autoload object. > All it takes is to start compiling the autoloads files. Ok, but it does not seem that it works the way you say, at least not atm. This is what I see in my Emacs, correct me if I do something wrong here. I just tested with generated package-quickstart.el file. Below is what I get when I M-: (symbol-function 'winum-select-window-0), as both before I byte-compiled and after I byte-compiled: (autoload "winum" "Jump to window 0. If prefix ARG is given, delete the window instead of selecting it. (fn &optional ARG)" t nil) It is also fully possible that someone prefer to omit anything optional :): #+begin_src emacs-lisp (autoload 'academic-phrases "academic-phrases") (autoload 'academic-phrases-by-section "academic-phrases") (autoload 'ace-select-window "ace-window") (autoload 'ace-delete-window "ace-window") (autoload 'ace-swap-window "ace-window") (autoload 'ace-delete-other-windows "ace-window") (autoload 'ace-display-buffer "ace-window") (autoload 'ace-window "ace-window") (autoload 'ace-window-display-mode "ace-window") ( ... ) #+end_src That is a fragment of what I use instead of quickstart file. I do compile entire autoloads file together with my init.el, but I don't get any pointers to doc by default. After compilining my own autoload.el, byte compiling it, loading and evaling same (symbol-function 'winum-select-window-0): Loading /home/arthur/.emacs.d/autoloads.elc...done Mark set (autoload "winum" nil nil nil) Mark set I thought maybe I needed to tell byte compiler that those autoloads are all functions: #+begin_src emacs-lisp (autoload 'academic-phrases "academic-phrases"nil nil t) (autoload 'academic-phrases-by-section "academic-phrases"nil nil t) (autoload 'ace-select-window "ace-window"nil nil t) (autoload 'ace-delete-window "ace-window"nil nil t) (autoload 'ace-swap-window "ace-window"nil nil t) (autoload 'ace-delete-other-windows "ace-window"nil nil t) (autoload 'ace-display-buffer "ace-window"nil nil t) (autoload 'ace-window "ace-window"nil nil t) (autoload 'ace-window-display-mode "ace-window"nil nil t) ( ... ) #+end_src After recompile and reload I get this: (autoload "winum" nil nil t) So the entire business of docs in autoloads is due to autoload file generation, seems to me, if I don't misunderstanding something? I certainly have no problems if autoloads generation is fixed and built-in autoloads file generator emitted byte offsets instead of kilo bytes of fully embedded docs. But there is the case that nil is a valid value for doc in autoload object, and thus I think it is still important to fix help system, to fetch docs on demand.