emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unhelpful text in C-h v search-default-mode


From: Juri Linkov
Subject: Re: Unhelpful text in C-h v search-default-mode
Date: Wed, 25 Oct 2023 09:43:10 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> 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.

A good name for the new function would be 'isearch-fold-quotes-regexp'
modeled after the existing 'isearch-symbol-regexp', 'char-fold-to-regexp'.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]