From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66750: Unhelpful text in C-h v for variables with a lambda form as value Date: Sat, 28 Oct 2023 21:38:36 +0300 Message-ID: <838r7md237.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19243"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acorallo@gnu.org, 66750@debbugs.gnu.org, monnier@iro.umontreal.ca, stefankangas@gmail.com To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 28 20:39:45 2023 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 1qwoDo-0004q7-Q6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Oct 2023 20:39:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwoDb-0001cg-Gh; Sat, 28 Oct 2023 14:39:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qwoDa-0001cG-1k for bug-gnu-emacs@gnu.org; Sat, 28 Oct 2023 14:39:30 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwoDZ-0002Dk-Pi for bug-gnu-emacs@gnu.org; Sat, 28 Oct 2023 14:39:29 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qwoE5-0005Yv-Kb for bug-gnu-emacs@gnu.org; Sat, 28 Oct 2023 14:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Oct 2023 18:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66750 X-GNU-PR-Package: emacs Original-Received: via spool by 66750-submit@debbugs.gnu.org id=B66750.169851836921331 (code B ref 66750); Sat, 28 Oct 2023 18:40:01 +0000 Original-Received: (at 66750) by debbugs.gnu.org; 28 Oct 2023 18:39:29 +0000 Original-Received: from localhost ([127.0.0.1]:39548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qwoDY-0005Xy-Md for submit@debbugs.gnu.org; Sat, 28 Oct 2023 14:39:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qwoDX-0005Xl-Jx for 66750@debbugs.gnu.org; Sat, 28 Oct 2023 14:39:28 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qwoCv-0001p9-Ln; Sat, 28 Oct 2023 14:38:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1JRNHzxtWwmnW9+Dd9R+5wdMDSdcLn0+EgwEVhHAkVY=; b=IYoS7ISFsY+8 3xQIdURX/goNRjWUB3QyZjSd8KtFnbEzDKdJBSVi0qqmXKDwjhmlm4CwInHPB2cOEVOUttRfT3hYg eJhGY/5pBC3DTWunNbDn4OawOyNBeK/zXrS42RKcqMMts0VpRbVBip9qJ+eZGYh7BZRZOQ3XE/UPF wLXEvFmTeA7gCya6j5W4/0Hoj8Dp560cqfyqT5uCms6nLri6QbZvN59A+RI2a+ok+xuU/YbBERJ0g zemOpzimFzLuTZa4i1gWCuLqGgaHLFuXS4M52nFg3YtXdtUANsvFD4gZElmo9og7X2Zxd1OBOcTkC Ics+GsLmQTE2Ay8sjmNpCQ==; In-Reply-To: (message from Alan Mackenzie on Sat, 28 Oct 2023 18:17:04 +0000) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273463 Archived-At: > Cc: 66750@debbugs.gnu.org, Andrea Corallo , > Stefan Kangas , acm@muc.de > Date: Sat, 28 Oct 2023 18:17:04 +0000 > From: Alan Mackenzie > > > but that's 127kB, so ... could [you] briefly describe the overall design > > (IOW, how it's seen by ELisp programmers, byte-compiler hackers, and > > ELisp users)? > > Certainly. Each lambda expression has (usually) a defun within which it > is defined. Sometimes it's in a defvar, or defcustom. That > @dfn{defining symbol} is recorded in the lambda form in one of three > ways: > (i) For a cons form, it's (cadr form), a new field inserted between the > symbol `lambda' and the argument list. > (ii) For a byte-compiled form, it's (aref form 5), this new field going > after the doc string and before any interactive form in the compiled > form. > (iii) For a native-compiled subr it's (subr-native-defining-symbol > subr), a function defined in data.c. It accesses a new field in struct > Lisp_Subr called defining_symbol. > > There are lots of detailed changes in eval.c and bytecomp.el (and > friends). Also the macro `lambda' in subr.el has been amended to insert > the current global defining-symbol if there isn't already a non-nil > symbol in that position. cl-print-object/compiled-function has been > amended to print the defining-symbol, and there is a new > cl-print-object/subr which does the same. > > The intention is that compiled objects from earlier Emacsen can still be > loaded and run by feature/named-lambdas, just without the defining > symbols (which will appear to be nil). > > > Also, what other approaches have you considered/tried and what were the > > problems you've encountered, if any? > > feature/named-lambdas was originally intended for use in backtraces. > > For the current bug, I've considered individually replacing each lambda > with a named defun, so that C-h v will show that name rather than an > unhelpful byte/native compiled anonymous function. That would be a lot > of work - my scripting found 63 defcustoms set to lambdas, 29 uses in > doc strings, and 215 suspicious occurrences with ordinary variables > (quite a few of which will be harmless). Amending all these (I guess > around 200 lambdas) would probably be too much work. Thanks. However, now I'm confused: what exactly does this feature give us, if it doesn't handle all the lambdas in the Emacs tree and (AFAIU) will not affect lambdas in third-party packages? Which lambdas will now have a defining symbol, and which will not?