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 proposal: display symbol source code in help buffers Date: Tue, 21 Sep 2021 20:56:54 +0200 Message-ID: References: <83bl4n3hys.fsf@gnu.org> <87fstz3g6z.fsf@no.workgroup> <9ada9a31-4e44-7941-e9a2-ada86ba4e36e@gmx.at> <3438b87f-b24a-3bc3-871f-84818868d445@gmx.at> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25593"; 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: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 21 20:58:25 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 1mSkyG-0006UF-CA for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Sep 2021 20:58:25 +0200 Original-Received: from localhost ([::1]:41344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSkyE-0002fQ-GV for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Sep 2021 14:58:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSkwz-0001Yj-Jz for emacs-devel@gnu.org; Tue, 21 Sep 2021 14:57:07 -0400 Original-Received: from mail-vi1eur05olkn2046.outbound.protection.outlook.com ([40.92.90.46]:15968 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 1mSkwu-0006zl-Td for emacs-devel@gnu.org; Tue, 21 Sep 2021 14:57:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QFZlXZ5lvFq0tCpXItYwGY8/PnIZyRUS33rJkRJCPvg9pdJjfxYqg7q6RzY92k31bc0ca0WFBKBfouXgfSM3WFu6YUEU/USzA9D+F8iiyIFbrJnq2ucKHAr0QtmoJv5/r6LQykYAGwJ0ledDD68+BCXZhD8F5gUnKsq56zj2Zqckbmh1KySO2S4D3A3x3vXJ/xH5p6wqms9G5PWtGwixEbM+b3VnPx7joRn2A//8rVdxpkrPFe7me+EvAAx0BeSHd+mWse7p4WD2arBYELQY0NiW96QMQQc31wdWFeGK13fIhR4xn4QgB7yROJTPVUw5QtPXnP83z0iEzCputneZ0A== 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=p79CLOQ9Oh/Xi+O+Tw00gfNXzW11lF5jM0FiHAnR5QY=; b=GeAo25Q0M1xZUyEF/KkGTBoqfxdd9Ng1ITej1QgisP+hHaUHdCFEFMEuhmasKXSutd2Ifxs9T4sv3NS03sZyL0ZbJuK0ADrJQ39xZ4qiscDo/vVAn3CyWOCMk3tOcD0QP2QzyHiKjaVNU1Go7YYKRu3yHZKiI3rhWM239ALLZgyhVutTEGU3AS20k9yacY4KergainQpyzsxqMDNHSY/Ytu7+WtOp+EI5ce1P+FqM0ns+fLBPtP1SfsX+o34wDMsc/nNyYObHe8LIISBteuIcOw9yZoQc/wpc3lvKIuzcFQ8Sx2Lsp3PBTMSFU6CRvwOF9fwQI5zDswLQRJO7ajIaw== 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=p79CLOQ9Oh/Xi+O+Tw00gfNXzW11lF5jM0FiHAnR5QY=; b=cFwFNtKTSicjgW9GlluaXRqEui9A5jg5Aw0LZWrGCvOFtauqWab4AvTEVEfeQJ3YsOS4brYg4+GIR+rGMcmU5hPYTFTTOa7P8VntfGeMk4inb8IF8l8krb3OLetWJt8qP3Ay9qC8xMVFK5pu7XExAt5mNzQfjzJXtnibwbspAmZg1APCaKmvzGBOdNcXeUNXEmFLTlYJeYn0GlhIyEpNokd8g3gblddrBaBB7oMET1R+DgiAK6+9BCxtUkFPWptSqeCwGoKRU+lsFcihuCo/JXXt/J1sSkiqjDtTjWX9340IaYy3vhXn0m0ZEpc7eBsdpnkQ3MbMrEFHGZn80tSAtA== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB2708.eurprd09.prod.outlook.com (2603:10a6:208:12c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Tue, 21 Sep 2021 18:56:57 +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.4544.013; Tue, 21 Sep 2021 18:56:57 +0000 In-Reply-To: (martin rudalics's message of "Tue, 21 Sep 2021 18:52:10 +0200") X-TMN: [1MsgCYqmbZw3l+8M3S4XyF3Oe502CmJ/] X-ClientProxiedBy: HE1PR0301CA0007.eurprd03.prod.outlook.com (2603:10a6:3:76::17) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87fstxrc3t.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by HE1PR0301CA0007.eurprd03.prod.outlook.com (2603:10a6:3:76::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Tue, 21 Sep 2021 18:56:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 01db54a7-735a-44ed-6338-08d97d31957c X-MS-TrafficTypeDiagnostic: AM0PR09MB2708: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ii+2TO8s+uY/RqapNhV2Lhi4C0X0U29/SDL+L5RnLUF6x/M66lhlwgzPuWJFRr61rJPJem4pWp8BV2e2os9Uey0TraX3nPJNe3WFlTS6fY8P6vzDU8YLPCIaeAhsytmeNLBcUrRz40ClDErALG+JejycpVsTbaRqGPW17iUmzGgA8T2oU3vsScqDSVVVMbsntchsGLeSzOanZjpzO/06g88z1kBcjLcb6SMKKZcdEbtdxJdr/RUpxFmxNZFASyFwI83ZAQSqTzqVW1jVub/We2xWNLdAhW/NOWHnKjHE1rYmn9Ny1TH8oP5o8jv1P6XM49ojE/+EuLu8q3gTbbpT6jNZLptCmnG87jTJCDA36t9bXd3gXIMEYdiwKxbazbQSmB/zD4Zx2Z8BW0AerP3COSsLsb2p6lI3xw9aEvi3T2CDJ8tyxS0roVlAgegaRps5 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R3FT795cCddruRd/5kBDb6qTWL3OcR7Q51PjBdcxVEYpfJ0tvyJrl83kPWMr/u3vkbVpKEYllfF1jpUTFF0FTYke5cvWz5N3QvGscJ40Myg4cyK2q25A2Rs7G1ETrBt7pSO0v72N3iD+MNSEAubB3w== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 01db54a7-735a-44ed-6338-08d97d31957c X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 18:56:57.0475 (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: AM0PR09MB2708 Received-SPF: pass client-ip=40.92.90.46; 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, 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:275261 Archived-At: martin rudalics writes: >>>> It would be nice to make it fit to N lines in height, and C columns in= width, >>>> i.e. to make it fit to certain size. >>> >>> Who would specify that "certain size"? >> User, of course, who else? We put some default size and a defcuctom for = user to >> change, as always? > > Do you mean "one size fits all"? Of course not :). I said "user", because I meant an user should have the final word. I just s= aid in short words that there should be a defcustom variable for users to customiz= e the default value. But also every value that is in use, has to have some defaul= t value to start with, no? I didn't proposed a hadcoded literal, I proposed a defcustom variable, so users can set this their liking. >> Let's >> have a face lift for built in help for 28. I am sure we could debate for= years >> and always someone will like it differently. Let's have something that w= orks. > > That something will take its time to be written. Certainly not before > Emacs 28 comes out. > >> I haven't read the other thread, but I have used help and why I think i= t is >> good, and some other have as well. > > There are two threads and I think you should read them if you plan to > change anything in this area. > >> Can you try what I send in yesterday, with soucre view toggle? I think i= t works >> quite nice (I did a misstake and went 1 row too far when deleting, but t= hat's a >> trivial to fix). > > Compiling it tells me > > ../../lisp/help-mode.el:530:22: Warning: the function > =E2=80=98find-function-advised-original=E2=80=99 is not known to be d= efined. > > so it should require 'find-func'. A few remarks: Thank you for spotting that one! I used to have it in fetch-c-src, but than= I removed it, and than refactored that code from 'find-function-C-source' but forgott that it might require find-func. > +(defcustom help-mode-inline-source nil > + "Display inlined source code for SYMBOL in `help-mode' buffer. > > What is SYMBOL here? Current symbol in the help buffer. There is always a 'current symbol' in th= e help buffer, as I understand the implementation, the one that help was aske= d about. I can reword the docs. I have tried to be short as possible so it fi= ts in one line. I see also now that it shoudl at least be 'the SYMBOL', but I can probably just skip "for SYMBOL" completely. > + "Find C source code for a Lisp symbol in a `file'. > + > +sym is the symbol to find. > +type is the type as obtained by 'describe-*' functions. > +file is the source file to search in." > > Arguments should be uppercase and not hyphenated. Ok, thank you, I wasn't thinking about that one. I'll fix that of course. > + (with-no-warnings (font-lock-fontify-buffer))) > > Do you know how long it takes to fontify xdisp.c? With a non-optimized > build, C-h v for 'scroll-minibuffer-conservatively' takes more than 10 > seconds here. I would't be surprised. I try to do as little work as possible: only functi= on oor defvar in question is fontified, so xdisp.c will never get fontified al= l at once in this context. If that would still be problematic for low-level CPUs= I can of course do this optionally as well, with another defcustom. I am really concerned with efficiency; I always am. I really like Helpful, = and I am not the only one, it is a popular library. What is problem is that it does not use any built-in functionality but provides everything from scratc= h. It has complete implementation of a help buffer on its own. So it is a dubble functionality when I import it. I like it's implementation too, it is simpl= er than built-in help infrastructure. So I hoped to get it into Emacs, and let= old help die out :). It won't happen so the next best thing is to re-implement = Helpful in terms of Emacs built-in features, i.e. bring Helpful features (not the s= ource code) to built-in *Help* buffers. At least some of them. > Other than that I can only say that this is _one_ possible option for > showing the source of the code. BTW, we should decide on a suitable > interface for 'help-toggle-source-view' probably using the button for > showing the code. Yes, I had my thoughts to propertize the "Source Code:" string in help buff= er to act similar as other link (or buttons as they are called in Emacs), but I j= ust haven't got to that yet. Also until there is any decision to use 'help-toggle-source-view' as an API, it can wait for a bit; but generally y= es, it should be another help-xref button. I have also explicitly coded it so it can be used from any buffer, so user = does not need to switch to a help buffer to toggle the source view on/off. I see= it as a feature that help does not switch my cursor to help buffer by default = :). Thank you for your input Martin, that was really helpful. Some pun unavaoid= ed here :).