From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.help Subject: Re: isearch-lax question error? Date: Thu, 04 Apr 2024 05:07:58 +0000 Message-ID: <87plv5emvl.fsf@posteo.net> References: <5cxaqmf35sbcpvdfmvd2n7nvgunqwbfsgrxa6cyng3cbpo5z7u.ref@itqcn57665a2> <5cxaqmf35sbcpvdfmvd2n7nvgunqwbfsgrxa6cyng3cbpo5z7u@itqcn57665a2> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14918"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "help-gnu-emacs@gnu.org" To: Ergus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 04 07:08:50 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rsFLG-0003fF-3J for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 04 Apr 2024 07:08:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rsFKk-0003wX-B1; Thu, 04 Apr 2024 01:08:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rsFKg-0003wE-9w for help-gnu-emacs@gnu.org; Thu, 04 Apr 2024 01:08:14 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rsFKe-0005yE-Ez for help-gnu-emacs@gnu.org; Thu, 04 Apr 2024 01:08:14 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 10072240027 for ; Thu, 4 Apr 2024 07:08:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712207290; bh=IDcoXS9ELecvTnF2+nzqtK4LwsYR7cziQoTpvViGdPs=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=YUHj5n+OCAzVP6IcS9Ls8YkvU5I5jD3tKg9dQmjWU1lJ0nibUoJi3qrhpY1Zfl5hr Zp+559IE3wyE3QsFGKLHTi0GCSSM+7yg7yLEEF9is3r18U0W6183Ptl1EMfW+VEGuX b5a12jPGEjz754LC0P8O3YwR6ajbqKjIcnBprrKcVZnFzv9nPZDHKBJ9MDeHVZv0m3 0zGeQOj1xBBOB00HED7/nKJPiCx99UckX9klpINy7HugpzFjpv/R0c1UCxTDWnMLRs kcsbSixkx8PIteiKFj/tfaVIND3AjWwO5B7oMqkWNG2qkopLA4crl09vM0nUUsbi5S zXrKBIxlOyjVw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4V98l44DzNz6txh; Thu, 4 Apr 2024 07:08:00 +0200 (CEST) In-Reply-To: <5cxaqmf35sbcpvdfmvd2n7nvgunqwbfsgrxa6cyng3cbpo5z7u@itqcn57665a2> (Ergus's message of "Wed, 3 Apr 2024 20:56:51 +0200") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146239 Archived-At: Ergus 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