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:15:20 +0000 Message-ID: <87o7apemjb.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="16746"; 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:16:12 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 1rsFSM-00042o-SP for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 04 Apr 2024 07:16:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rsFRl-0005gR-GU; Thu, 04 Apr 2024 01:15:33 -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 1rsFRh-0005fU-Lp for help-gnu-emacs@gnu.org; Thu, 04 Apr 2024 01:15:29 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rsFRf-0004kn-Ev for help-gnu-emacs@gnu.org; Thu, 04 Apr 2024 01:15:29 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7FD30240101 for ; Thu, 4 Apr 2024 07:15:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712207724; bh=IDcoXS9ELecvTnF2+nzqtK4LwsYR7cziQoTpvViGdPs=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=T6S15QJ7C3GM0FqpezMSUl8VFZ/mTLM6cj/923o1dx+wYy7+onKtScws6rhT/sOzY ojne7P5yMjtpNAPuacSMtq/ulWUFZGAcvyKHM0Oc/BFKh5DO2AHidUCWXHYYto0niG ANVDLPDDi8e7vaDcWT6MHgN78u7h+8qrnMKpRBJTj45GPEDGcUPOx/CF7/vr8fDuGE qQAMuf3BVzQoO+DFyU2UjqU8ZBctI90vT1MclDQ9RH5av3CIBai+nJ7iC7vQQ4eosW XIMt26oWHMIJnY+AA5C2FmcfJZ7H8vOFwyMCAzajibW2cWNrcM+gLKxTqEcG9qhFRr cIeKW5ndgrSnQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4V98vZ0xFxz6tvy; Thu, 4 Apr 2024 07:15:22 +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.66; envelope-from=philipk@posteo.net; helo=mout02.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_H4=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:146240 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