From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: isearch hooks Date: Sat, 19 Jun 2004 21:09:43 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87u0x7u3wo.fsf@mail.jurta.org> References: <20040528.181649.25475113.wl@gnu.org> <200405291737.i4THbPJ06689@raven.dms.auburn.edu> <878yeyczec.fsf@mail.jurta.org> <87n03aa4jk.fsf@mail.jurta.org> <87d63wy6ux.fsf_-_@mail.jurta.org> <20040619011005.GA2240@fencepost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1087669549 14751 80.91.224.253 (19 Jun 2004 18:25:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 19 Jun 2004 18:25:49 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Jun 19 20:25:38 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BbkX4-0004hD-00 for ; Sat, 19 Jun 2004 20:25:38 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BbkX4-0007Xw-00 for ; Sat, 19 Jun 2004 20:25:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BbkYD-00028S-Pa for emacs-devel@quimby.gnus.org; Sat, 19 Jun 2004 14:26:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BbkYA-00028C-Uo for emacs-devel@gnu.org; Sat, 19 Jun 2004 14:26:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BbkY8-00027z-U4 for emacs-devel@gnu.org; Sat, 19 Jun 2004 14:26:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BbkY8-00027w-Rz for emacs-devel@gnu.org; Sat, 19 Jun 2004 14:26:44 -0400 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BbkWd-0008Pc-3D; Sat, 19 Jun 2004 14:25:11 -0400 Original-Received: from mail.jurta.org (80-235-35-146-dsl.mus.estpak.ee [80.235.35.146]) by knife.dreamhost.com (Postfix) with ESMTP id 047A1E4039; Sat, 19 Jun 2004 11:25:08 -0700 (PDT) Original-To: Miles Bader In-Reply-To: <20040619011005.GA2240@fencepost> (Miles Bader's message of "Fri, 18 Jun 2004 21:10:05 -0400") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25109 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25109 Miles Bader 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/