all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why is this thing (isearch-search-fun) coded like this?
@ 2015-12-07 21:12 Alan Mackenzie
  2015-12-07 21:20 ` John Wiegley
  2015-12-07 21:32 ` Artur Malabarba
  0 siblings, 2 replies; 3+ messages in thread
From: Alan Mackenzie @ 2015-12-07 21:12 UTC (permalink / raw)
  To: emacs-devel

Hello, Emacs.

I'm absolutely stumped.

`isearch-search-fun', when called, returns a function "to use" for
searching.  To do this, it funcalls .....

.... `isearch-search-fun-default'.  This returns a constant lambda form.

CONSTANT LAMBDA FORMS ARE NOT EASY TO INSTRUMENT FOR EDEBUG!!!!

As an alternative, isearch-search-fun-default could simply return a
named function.  Even better, such a named function could simply be, and
be returned directly from `isearch-search-fun' without all the
superfluous funcalling.

Or am I missing something here?

All this "is a function which returns a function by funcalling a
function which returns a constant lambda form" has exhausted any desire
I had to debug my problem to a finish.

I'm tempted to rip out a lot of this stuff from Isearch to be able to
debug it.  Will I regret it if I do?

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: Why is this thing (isearch-search-fun) coded like this?
  2015-12-07 21:12 Why is this thing (isearch-search-fun) coded like this? Alan Mackenzie
@ 2015-12-07 21:20 ` John Wiegley
  2015-12-07 21:32 ` Artur Malabarba
  1 sibling, 0 replies; 3+ messages in thread
From: John Wiegley @ 2015-12-07 21:20 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

>>>>> Alan Mackenzie <acm@muc.de> writes:

> As an alternative, isearch-search-fun-default could simply return a named
> function. Even better, such a named function could simply be, and be
> returned directly from `isearch-search-fun' without all the superfluous
> funcalling.

It does look like it should just return a function symbol, rather than a
lambda. It's not even a closure.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Re: Why is this thing (isearch-search-fun) coded like this?
  2015-12-07 21:12 Why is this thing (isearch-search-fun) coded like this? Alan Mackenzie
  2015-12-07 21:20 ` John Wiegley
@ 2015-12-07 21:32 ` Artur Malabarba
  1 sibling, 0 replies; 3+ messages in thread
From: Artur Malabarba @ 2015-12-07 21:32 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

2015-12-07 21:12 GMT+00:00 Alan Mackenzie <acm@muc.de>:
> CONSTANT LAMBDA FORMS ARE NOT EASY TO INSTRUMENT FOR EDEBUG!!!!

I know there's an extra layer of indirection, but I've always been
able to edebug it just fine.

> As an alternative, isearch-search-fun-default could simply return a
> named function.  Even better, such a named function could simply be, and
> be returned directly from `isearch-search-fun' without all the
> superfluous funcalling.
>
> Or am I missing something here?

IIRC, isearch-search-fun-default didn't use to return a constant
lambda. Instead, it used to return a different lambda depending on
some parameters.
We reached the current state as a result of some recent refactorings.

I agree it would be good to remove this layer of indirection.

> I'm tempted to rip out a lot of this stuff from Isearch to be able to
> debug it.  Will I regret it if I do?

You won't regret it if you do it right:
1. Define a function for that lambda.
2. Set the default value of isearch-search-fun to be this function's name.
3. Make isearch-search-fun-default return the function's name, and
mark it obsolete.



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

end of thread, other threads:[~2015-12-07 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07 21:12 Why is this thing (isearch-search-fun) coded like this? Alan Mackenzie
2015-12-07 21:20 ` John Wiegley
2015-12-07 21:32 ` Artur Malabarba

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.