[Top][All Lists]

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

Re: isearch hooks

From: Juri Linkov
Subject: Re: isearch hooks
Date: Mon, 28 Jun 2004 01:34:59 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Richard Stallman <address@hidden> writes:
>     I added two new hooks: `isearch-push-state-function' and
>     `isearch-pop-state-function' to save/restore the current Info file
>     and node names in the search status stack.
> I don't understand the motivation for these two hooks.
> Would you please explain the idea of this design?
> Why is this the right way to extend Isearch?

The commands that move the point back to the previous search result
restore the previous point by setting it by `goto-char' to the
position saved in the search status stack `isearch-cmds'.  But this
doesn't work when the current search buffer switches during the search
like with changing the current Info node.

There is a need to save additional information to the search stack
to be able to restore the current search buffer to its previous state.
In case of Info this means going to the Info node where the previous
search point was located.  The hook `isearch-push-state-function'
returns additional information appended to the element of the
search status stack.  And `isearch-pop-state-function' calls the
function to restore the current buffer to its previous state.

Perhaps even one hook that adds to the stack a function to restore
the current search buffer would be enough.  For example,

(defun Info-isearch-push-state-function ()
 `(lambda ()
   (Info-find-node ,Info-current-file ,Info-current-node)
   (goto-char (car (cdr (cdr cmd))))))

will add a lambda expression as 12-th element of the list pushed to the
stack and which can be called later to restore the previous Info node.

I don't know what is more preferable: two hooks or one hook with lambda.

Juri Linkov

reply via email to

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