emacs-devel
[Top][All Lists]
Advanced

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

Re: isearch hooks


From: Juri Linkov
Subject: Re: isearch hooks
Date: Sat, 19 Jun 2004 21:09:43 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Miles Bader <address@hidden> writes:
> On Fri, Jun 18, 2004 at 11:00:09PM +0300, Juri Linkov wrote:
>> The patch below adds two hooks `isearch-wrapped-hook' and
>> `isearch-failed-hook'.
>
> I like the idea, but a few comments:
>
>  (1) I'm a bit confused about why there should be two hooks -- both are
>      really instances of search failure, right?  Can they be combined?

I initially thought two hooks might be useful because that allows to
put into hooks something more than planned switching buffers or Info nodes.
But perhaps one hook and one variable which enables wrapping immediately
after failing is enough.

>  (2) The name `isearch-wrapped-hook' seems wrong anyway: the hook appears to
>      be an _alternative_ to wrapping, not something that runs _after_
>      wrapping, so something like `isearch-wrap-hook' seems more appropriate,
>      (if this hook cannot be combined with the other hook).

Yes, `isearch-wrap-hook' is a better name, even for a combined hook.

>  (3) It seems that these should be `-function' variables, not `-hook'
>      variables, as they modify behavior instead of merely extending it, and
>      multiple entries don't seem likely to work correctly.

Perhaps the plural form `isearch-wrap-functions' is better when using
`run-hook-with-args-until-success', as Richard suggested, to try
multiple functions until one of them returns a non-nil value.

>  (4) Should the code set `isearch-wrapped' even when the user-function is
>      run instead of the default code?

I think `isearch-wrapped' should be set to t even when the
user-function is run.  As I can see from isearch.el, the variable
`isearch-wrapped' is used only to display the proper message
(either "wrapped" or "overwrapped").  I already added the condition
in the previous patch I sent that if `isearch-wrapped-hook' is defined,
to not display the prefix "over" since this makes no sense for cases
with switching buffers.  But the message "wrapped" still seems
appropriate to indicate that the search was moved into another buffer
or Info node.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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