* isearch-lax question error?
[not found] <5cxaqmf35sbcpvdfmvd2n7nvgunqwbfsgrxa6cyng3cbpo5z7u.ref@itqcn57665a2>
@ 2024-04-03 18:56 ` Ergus
2024-04-04 5:07 ` Philip Kaludercic
2024-04-04 5:15 ` Philip Kaludercic
0 siblings, 2 replies; 3+ messages in thread
From: Ergus @ 2024-04-03 18:56 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Hi:
I am trying to create a lax isearch interactive that use ".*?" but
independent from the default one very useful as well.
I already have isearch-lax-whitespace and search-whitespace-regexp to
the defaults.
And in my function I only want to change search-spaces-regexp in order
to make the command temporarily more flexible.
so far I have something simple like this:
(defun my/isearch-forward ()
(interactive)
(let ((search-spaces-regexp ".*?")) ;; I alternated this with search-whitespace-regexp
(call-interactively 'isearch-forward)))
However this does not behave as expected; it changes nothing compared to
the default behavior.
But If I set (defcustom isearch-lax-whitespace ".*?") then I get the
right behavior in the normal isearch-forward.
What I am missing here?
Thanks in advance,
Ergus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: isearch-lax question error?
2024-04-03 18:56 ` isearch-lax question error? Ergus
@ 2024-04-04 5:07 ` Philip Kaludercic
2024-04-04 5:15 ` Philip Kaludercic
1 sibling, 0 replies; 3+ messages in thread
From: Philip Kaludercic @ 2024-04-04 5:07 UTC (permalink / raw)
To: Ergus; +Cc: help-gnu-emacs@gnu.org
Ergus <spacibba@aol.com> writes:
> Hi:
>
> I am trying to create a lax isearch interactive that use ".*?" but
> independent from the default one very useful as well.
>
> I already have isearch-lax-whitespace and search-whitespace-regexp to
> the defaults.
>
> And in my function I only want to change search-spaces-regexp in order
> to make the command temporarily more flexible.
>
> so far I have something simple like this:
>
> (defun my/isearch-forward ()
> (interactive)
> (let ((search-spaces-regexp ".*?")) ;; I alternated this with search-whitespace-regexp
> (call-interactively 'isearch-forward)))
>
> However this does not behave as expected; it changes nothing compared to
> the default behavior.
>
> But If I set (defcustom isearch-lax-whitespace ".*?") then I get the
> right behavior in the normal isearch-forward.
>
> What I am missing here?
isearch-forward enabled isearch-mode, and then returns. The dynamic
binding of search-spaces-regexp will not be in effect anymore, when the
actual searching is taking place (recall that isearch doesn't take over
the event-loop, but just rebinds commands: "a" which is usually bound to
`self-insert-command' is rebound to `isearch-printing-char').
So what you would need, might be something like this
--8<---------------cut here---------------start------------->8---
(defun my/isearch-forward ()
(interactive)
(letrec ((hook 'isearch-mode-end-hook)
(reset (lambda () (remove-hook hook reset t))))
(add-hook hook reset nil t)
(setq-local search-spaces-regexp ".*?")
(call-interactively #'isearch-forward)))
--8<---------------cut here---------------end--------------->8---
(not tested extensivly)
> Thanks in advance,
> Ergus
>
>
>
--
Philip Kaludercic on peregrine
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: isearch-lax question error?
2024-04-03 18:56 ` isearch-lax question error? Ergus
2024-04-04 5:07 ` Philip Kaludercic
@ 2024-04-04 5:15 ` Philip Kaludercic
1 sibling, 0 replies; 3+ messages in thread
From: Philip Kaludercic @ 2024-04-04 5:15 UTC (permalink / raw)
To: Ergus; +Cc: help-gnu-emacs@gnu.org
Ergus <spacibba@aol.com> writes:
> Hi:
>
> I am trying to create a lax isearch interactive that use ".*?" but
> independent from the default one very useful as well.
>
> I already have isearch-lax-whitespace and search-whitespace-regexp to
> the defaults.
>
> And in my function I only want to change search-spaces-regexp in order
> to make the command temporarily more flexible.
>
> so far I have something simple like this:
>
> (defun my/isearch-forward ()
> (interactive)
> (let ((search-spaces-regexp ".*?")) ;; I alternated this with search-whitespace-regexp
> (call-interactively 'isearch-forward)))
>
> However this does not behave as expected; it changes nothing compared to
> the default behavior.
>
> But If I set (defcustom isearch-lax-whitespace ".*?") then I get the
> right behavior in the normal isearch-forward.
>
> What I am missing here?
isearch-forward enabled isearch-mode, and then returns. The dynamic
binding of search-spaces-regexp will not be in effect anymore, when the
actual searching is taking place (recall that isearch doesn't take over
the event-loop, but just rebinds commands: "a" which is usually bound to
`self-insert-command' is rebound to `isearch-printing-char').
So what you would need, might be something like this
--8<---------------cut here---------------start------------->8---
(defun my/isearch-forward ()
(interactive)
(letrec ((hook 'isearch-mode-end-hook)
(reset (lambda () (remove-hook hook reset t))))
(add-hook hook reset nil t)
(setq-local search-spaces-regexp ".*?")
(call-interactively #'isearch-forward)))
--8<---------------cut here---------------end--------------->8---
(not tested extensivly)
> Thanks in advance,
> Ergus
>
>
>
--
Philip Kaludercic on peregrine
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-04 5:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5cxaqmf35sbcpvdfmvd2n7nvgunqwbfsgrxa6cyng3cbpo5z7u.ref@itqcn57665a2>
2024-04-03 18:56 ` isearch-lax question error? Ergus
2024-04-04 5:07 ` Philip Kaludercic
2024-04-04 5:15 ` Philip Kaludercic
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.