From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie 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 17:09:53 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32737"; mail-complaints-to="usenet@ciao.gmane.io" To: 66750@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 25 19:10:58 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 1qvhPG-0008OA-6Q for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Oct 2023 19:10:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvhOt-00074w-6K; Wed, 25 Oct 2023 13:10:35 -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 1qvhOq-00074Z-HN for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 13:10:32 -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 1qvhOq-0000Uq-9F for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 13:10:32 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qvhPK-0005c5-40 for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 13:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Oct 2023 17:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66750 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.169825386021567 (code B ref -1); Wed, 25 Oct 2023 17:11:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Oct 2023 17:11:00 +0000 Original-Received: from localhost ([127.0.0.1]:59930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvhPI-0005bn-6O for submit@debbugs.gnu.org; Wed, 25 Oct 2023 13:11:00 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:52740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvhPD-0005bW-EU for submit@debbugs.gnu.org; Wed, 25 Oct 2023 13:10:59 -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 1qvhOc-0006vl-VC for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 13:10:19 -0400 Original-Received: from mail.muc.de ([193.149.48.3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvhOW-00009i-Mo for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2023 13:10:18 -0400 Original-Received: (qmail 93521 invoked by uid 3782); 25 Oct 2023 19:09:57 +0200 Original-Received: from acm.muc.de (p4fe15c94.dip0.t-ipconnect.de [79.225.92.148]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 25 Oct 2023 19:09:57 +0200 Original-Received: (qmail 29068 invoked by uid 1000); 25 Oct 2023 17:09:53 -0000 Content-Disposition: inline X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.3; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:273203 Archived-At: 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. -- Alan Mackenzie (Nuremberg, Germany).