From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#66750: Unhelpful text in C-h v for variables with a lambda form as value Date: Wed, 25 Oct 2023 16:53:38 -0400 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="32544"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66750@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 25 22:55:05 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 1qvku9-0008BC-GW for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Oct 2023 22:55:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvktd-0004gQ-AZ; Wed, 25 Oct 2023 16:54:33 -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 1qvktb-0004gB-Kt for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 16:54:31 -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 1qvktb-0005ia-Cd for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 16:54:31 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qvku5-0003TD-NL for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 16:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Oct 2023 20:55: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.169826725913282 (code B ref 66750); Wed, 25 Oct 2023 20:55:01 +0000 Original-Received: (at 66750) by debbugs.gnu.org; 25 Oct 2023 20:54:19 +0000 Original-Received: from localhost ([127.0.0.1]:60087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvktO-0003S9-Dk for submit@debbugs.gnu.org; Wed, 25 Oct 2023 16:54:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvktM-0003Ru-5C for 66750@debbugs.gnu.org; Wed, 25 Oct 2023 16:54:17 -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 1qvksl-0005WJ-P9; Wed, 25 Oct 2023 16:53:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=g1oXGmOeDLw2WNN0xG5oOjsVX5IC5DZoXY2aqhh1Gdg=; b=aod1yFGwcsVFBTTJzF9l ASpoHNn7pnNOkDMppEl/INwEjUdAY6GfkBGahoerabbRshqVH3yMybegoIRE0OCcb1BPvVZL+ypaF Q/PGdX/rfcizHpdkbpKLUEL9o7hQyfc68lC/rgnsdh5ionhBldKsowAZzyQbPv1bnU5epgvpDiD1I k/n3khYlu0l4+rtT8SHJcfUEyuu9nFco4DCXTePJ9aLSdu2KAEAdY0PqCI8T5sitFZToLddUeqpZ8 mWjjUF54AIdlAeE+b5V76CftpYs0tTj6k/nO0lLrzpvn6VvpQ2jWKcpLG61oYoChMcC6zgiIBEyAg y6yUziw6NqriiQ==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1qvksk-0006yB-V4; Wed, 25 Oct 2023 16:53:39 -0400 In-Reply-To: (Alan Mackenzie's message of "Wed, 25 Oct 2023 17:09:53 +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:273213 Archived-At: Alan Mackenzie writes: > Hello, Emacs. > > Supposing a variable has as a value a lambda function. On doing C-h v > for this variable, there ensues a useless lack of information about the > lambda. All one gets told is that it is a lambda function, not where the > source code for it is, or anything useful like that. > > A typical example is C-h v search-default-mode, which prints something > like the following: > > Its value is > # > Original value was nil > Local in buffer *info*<3>; global value is nil > > .. When native compilation is not enabled, the printout is only slightly > better. > > Merely amongst the customisable options (i.e. not ordinary defvars and > defconsts) there are approximately 63 places where these options get set > to lambda functions. The following list lists the file and line number > where it's done, and the customisable option it gets done to: > > ../autorevert.el:471 before-save-hook > ../emacs-lisp/pp.el:320 temp-buffer-show-function > ../emulation/viper.el:950 eshell-mode-hook > ../erc/erc-pcomplete.el:99 pcomplete-default-completion-function > ../eshell/em-cmpl.el:191 eshell-command-completion-function > ../eshell/em-cmpl.el:202 eshell-default-completion-function > ../eshell/em-cmpl.el:280 eshell-mode-hook > ../eshell/em-prompt.el:50 eshell-prompt-function > ../eshell/em-smart.el:187 eshell-post-command-hook > ../gnus/gnus-art.el:3077 gnus-exit-gnus-hook > ../gnus/gnus-delay.el:150 message-send-hook > ../gnus/gnus-diary.el:213 gnus-summary-menu-hook > ../gnus/gnus-diary.el:370 nndiary-request-accept-article-functions > ../gnus/gnus-draft.el:274 message-post-method > ../gnus/gnus-msg.el:1145 message-reply-to-function > ../gnus/gnus-msg.el:387 message-header-setup-hook > ../gnus/gnus-msg.el:392 message-mode-hook > ../gnus/gnus-registry.el:1000 gnus-summary-menu-hook > ../gnus/gnus-sum.el:1321 gnus-alter-articles-to-read-function > ../gnus/gnus-util.el:1205 iswitchb-make-buflist-hook > ../gnus/message.el:3157 facemenu-add-face-function > ../gnus/message.el:701 message-cite-level-function > ../gnus/nnmairix.el:286 nnmairix-widget-select-window-function > ../help.el:1946 temp-buffer-max-height > ../help.el:1963 temp-buffer-max-width > ../isearch.el:4685 search-default-mode > ../locate.el:670 locate-make-command-line > ../mail/emacsbug.el:466 message-sent-hook > ../mail/emacsbug.el:540 message-send-hook > ../mail/feedmail.el:1400 feedmail-queue-runner-mode-setter > ../mail/feedmail.el:1436 feedmail-queue-runner-message-sender > ../mail/feedmail.el:1457 feedmail-queue-runner-cleaner-upper > ../net/mairix.el:176 mairix-widget-select-window-function > ../obsolete/gulp.el:103 mail-setup-hook > ../org/ob-core.el:1524 org-mode-hook > ../org/ob-latex.el:101 org-babel-latex-end-env > ../org/ob-latex.el:79 org-babel-latex-preamble > ../org/ob-latex.el:90 org-babel-latex-begin-env > ../org/ob-python.el:208 python-shell-first-prompt-hook > ../org/ol-bibtex.el:268 org-bibtex-headline-format-function > ../org/org-compat.el:1272 imenu-after-jump-hook > ../org/org-compat.el:1276 org-mode-hook > ../org/org-compat.el:1339 speedbar-visiting-tag-hook > ../org/org-crypt.el:317 org-mode-hook > ../org/org-ctags.el:196 org-mode-hook > ../org/org.el:15220 after-save-hook > ../org/org.el:18651 occur-mode-find-occurrence-hook > ../org/org-mouse.el:866 org-mode-hook > ../org/ox-ascii.el:378 org-ascii-format-drawer-function > ../org/ox-html.el:657 org-html-format-drawer-function > ../org/ox-latex.el:888 org-latex-format-drawer-function > ../org/ox-odt.el:635 org-odt-format-drawer-function > ../org/ox-texinfo.el:334 org-texinfo-format-drawer-function > ../pcomplete.el:305 pcomplete-command-completion-function > ../pcomplete.el:315 pcomplete-default-completion-function > ../play/gametree.el:118 gametree-make-heading-function > ../progmodes/cperl-mode.el:1848 add-log-current-defun-function > ../progmodes/octave.el:607 fill-nobreak-predicate > ../progmodes/ps-mode.el:108 ps-mode-print-function > ../vc/add-log.el:1129 fill-nobreak-predicate > ../vc/emerge.el:2086 temp-buffer-show-function > ../vc/smerge-mode.el:1358 ediff-quit-hook > ../window.el:6662 pop-up-frame-function > > .. Additionally there are about 29 instances in the doc strings where > users are urged to use lambda functions (rather than defuns) for this > purpose. They are at: > > ../calendar/calendar.el:395 calendar-move-hook > ../calendar/cal-tex.el:154 cal-tex-hook > ../comint.el:189 comint-mode-hook > ../dired-loaddefs.el:646 dired-mode-hook > ../dired-x.el:152 dired-mode-hook > ../erc/erc-log.el:218 erc-enable-logging > ../erc/erc-page.el:55 erc-page-function > ../files.el:466 auto-save-visited-predicate > ../font-lock.el:704 c-mode-hook > ../gnus/gnus-sum.el:1044 gnus-select-group-hook > ../gnus/nnmail.el:179 nnmail-expiry-wait-function > ../gnus/nnmail.el:286 nnmail-read-incoming-hook > ../gnus/nnmail.el:299 nnmail-read-incoming-hook > ../icomplete.el:154 icomplete-minibuffer-setup-hook > ../ido.el:890 ido-minibuffer-setup-hook > ../ielm.el:63 ielm-mode-hook > ../ldefs-boot.el:29820 sql-mode-hook > ../ldefs-boot.el:5069 c-mode-hook > ../loaddefs.el:29950 sql-mode-hook > ../loaddefs.el:5069 c-mode-hook > ../obsolete/nnir.el:415 nnir-notmuch-filter-group-names-function > ../org/org-keys.el:688 org-use-speed-commands > ../org/ox-html.el:968 org-html-table-row-open-tag > ../progmodes/compile.el:885 c-mode-hook > ../progmodes/prog-mode.el:296 emacs-lisp-mode-hook > ../progmodes/sql.el:4134 sql-mode-hook > ../progmodes/sql.el:4256 sql-interactive-mode-hook > ../textmodes/tildify.el:156 tildify-foreach-region-function > ../transient.el:278 transient-substitute-key-function > > .. Furthermore there are, perhaps, around 150 such settings of ordinary > defvars or defconsts to lambda functions. > > ######################################################################### > > I see two ways to fix this bug: > (i) Systematically to replace each of these lambda functions by a named > defun. > (ii) To adopt git branch feature/named-lambdas, which attaches to every > lambda function the name of the defun (or defvar) in which it was > defined. This extra information could then be printed out for C-h v, > something like this: > > Its value is > {isearch-fold-quotes-mode} # > Original value was nil > Local in buffer *info*<3>; global value is nil > > , thus enabling the user quickly to locate the source of the lambda form > in isearch.el. Hi Alan, what (if any) do you think are the downsides of option ii? Thanks Andrea