all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Unhelpful text in C-h v search-default-mode
@ 2023-10-24  9:45 Alan Mackenzie
  2023-10-25  6:43 ` Juri Linkov
  2023-12-29  7:12 ` Juri Linkov
  0 siblings, 2 replies; 13+ messages in thread
From: Alan Mackenzie @ 2023-10-24  9:45 UTC (permalink / raw)
  To: emacs-devel

Hello, Emacs.

In a recent master branch Emacs, (not with -Q), from an info buffer, I
did C-h v search-default-mode.  The text printed in *Help* included this:

    Its value is
    #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_109>
    Original value was nil
    Local in buffer *info*<3>; global value is nil

..  This is quite frankly entirely unhelpful; it gives no way to find out
what the lambda is, in particular, no way to get to its source code.  It
isn't even possible to disassemble the function.

After a good deal of searching, I think I found the pertinent source
code, but am not sure, namely in isearch.el L4685, right near the end:

      (setq-local isearch-fold-quotes-mode--state
                  (buffer-local-set-state
                   search-default-mode
                   (lambda (string &optional _lax)
                     (thread-last
                       (regexp-quote string)
                       (replace-regexp-in-string "`" "[`‘]")
                       (replace-regexp-in-string "'" "['’]")
                       (replace-regexp-in-string "\"" "[\"""]")))))

..  Here, this customisable variable search-default-mode gets set to a
lambda function.  The problem could have been avoided if the extra effort
to come up with a symbol for this function had been expended, and the
function written separately as a defun with a name.

I am asking people to be careful not to use lambda forms like this,
instead always prefering defun and a name.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-12-31  3:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-24  9:45 Unhelpful text in C-h v search-default-mode Alan Mackenzie
2023-10-25  6:43 ` Juri Linkov
2023-12-29  7:12 ` Juri Linkov
2023-12-29  7:21   ` Emanuel Berg
2023-12-29  7:50   ` Eli Zaretskii
2023-12-29  7:54     ` Eli Zaretskii
2023-12-30 17:40       ` Juri Linkov
2023-12-29 10:01   ` Alan Mackenzie
2023-12-29 10:58     ` Emanuel Berg
2023-12-30 17:43       ` Juri Linkov
2023-12-31  3:23         ` Emanuel Berg
2023-12-29 11:45     ` Eli Zaretskii
2023-12-29 20:19       ` Andrea Corallo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.