From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: isearch region or thing at point. Date: Wed, 01 May 2019 00:33:12 +0100 Message-ID: <874l6f132f.fsf@tcd.ie> References: <20190427001453.isjx247kc3lu5fe4@Ergus> <87a7gcp51i.fsf@tcd.ie> <20190429004135.rn5tp2gnmbjovrxj@Ergus> <87h8agy4yf.fsf@mail.linkov.net> <20190430162501.xmqh5r5h57sjjlq5@Ergus> <87h8af15kg.fsf@tcd.ie> <20190430231614.l423x6eqta5fbhor@Ergus> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="106100"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org, Juri Linkov To: Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 01 01:35:26 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLcHV-000ROu-5m for ged-emacs-devel@m.gmane.org; Wed, 01 May 2019 01:35:25 +0200 Original-Received: from localhost ([127.0.0.1]:55119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLcHT-0008Ru-UL for ged-emacs-devel@m.gmane.org; Tue, 30 Apr 2019 19:35:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLcFi-0006xh-7m for emacs-devel@gnu.org; Tue, 30 Apr 2019 19:33:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLcFg-0008RC-7u for emacs-devel@gnu.org; Tue, 30 Apr 2019 19:33:34 -0400 Original-Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:40055) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLcFc-0008LM-CG for emacs-devel@gnu.org; Tue, 30 Apr 2019 19:33:30 -0400 Original-Received: by mail-ed1-x543.google.com with SMTP id e56so7461672ede.7 for ; Tue, 30 Apr 2019 16:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=krKd/PSuU7joospW7C/Xob0m/X4M+3su8t22TrBYYDc=; b=OrkTYuZFg+nVcQT38ueY/pf5FC8SHiRN5OCFi0R5GPOBGRa9QLwx4b2maf/Z38FGlP rlJ0BfSJVI9EM6ghIPQYL1/+xBgKzipLhfqlWtR1tq9wWCaFxAsbWE4sVti8w/6yFtt2 D10OZppIWf23YDruwKKTNnA60PHp9gEAaAxFgLiPPnJmYQabMc1HnTLyqNYBYevUKnog ABcreFJpPQ3wAGImNPgQlmteFIEY1Uvt/xO++K32Ek9g3W+yefdUVdq9YEd3Sb6NOC8U bI3fEtyiwoWTquK2p4BaaAfm2+3TYKuo/Bp8N4zt708IWQJCSfB+CXI05eVTnmOGd/dZ E3fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=krKd/PSuU7joospW7C/Xob0m/X4M+3su8t22TrBYYDc=; b=XN1EbTTF4zVUvtfbHLC2bSlyEKuKhXsCrtjHCsoEjqMmA0cnrEcPknXzGnhKDpNZzG /xeevXcrPyWqv49GkcmF9zJH3y4PnJMysNHJoPIKMJlo96CgFoc2pRqf6fbC2xQ4Jp5N LTUkyZoFxUffOMQ5HHCxt6p1PCz3I7kQhg5t/l11IjNCoLPtvH6So7m11P9JThKVW4+x Y/5cqBXGdYIjgbydssLtwIMjPOj+eyxHdOKldswCDn5qC3w0xQA4cC4r1a1Mb3Hmsm5I QCSmnyn5Mu8s93IEBF8NMo/6CjxMgJdElXNq/+AildHt8KHZ//ZbeVe3xktCLjGbFxFR 2Xxg== X-Gm-Message-State: APjAAAU+IbUaN4atyxQfnqYrNTlKgktr9vb8VzScG+JOcNncX8lzWK14 rtvfDs7sNy3vsDF3Q7T3dDyj/7xs7f4k6tkP X-Google-Smtp-Source: APXvYqw+I9Ry79JjUekrVE5tgyCwlFw2JlDGd39Qq/ImZktzAvJrUzuUNoU+Nl+OCw8B3dttJO3USQ== X-Received: by 2002:a50:b264:: with SMTP id o91mr44197720edd.142.1556667199288; Tue, 30 Apr 2019 16:33:19 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:8cad:ae29:555d:852d]) by smtp.gmail.com with ESMTPSA id l39sm500878eda.23.2019.04.30.16.33.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 30 Apr 2019 16:33:18 -0700 (PDT) In-Reply-To: <20190430231614.l423x6eqta5fbhor@Ergus> (Ergus's message of "Wed, 1 May 2019 01:16:16 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::543 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236083 Archived-At: Ergus writes: > On Tue, Apr 30, 2019 at 11:39:11PM +0100, Basil L. Contovounesios wrote: >>Ergus writes: >> >>> (region-bounds))) >>> (contiguous (= (length bounds) 1)) ;; Region is contiguous >> >>Better to use the function region-noncontiguous-p. >> > I already had the bounds.. I didn't want to do the funcall again... but > I know it is probably not important.. I am just an obsessed. The higher-level and more flexible region-extract-function will handle this for you in any case. >>> (region-string (and (= (count-lines region-beg region-end) 1) >>> (buffer-substring-no-properties >>> region-beg region-end))) >> >>Why can't the region span multiple lines? Better to use >>region-extract-function for this, as it is more flexible. >> > I don't thing that searching multiple lines will be very useful in > practice and could potentially produce some corner cases. But I > will think about that a bit more. AFAIK, isearch is designed to work perfectly fine with multiple lines, and I use this feature a lot, especially in the context of lax whitespace matches in Info manuals, for example. Providing a dedicated region isearch command which is limited to a single line sounds hardly better than using isearch-yank-word-or-char or similar. >>> (isearch-yank-string region-string) >>> >>> (when-let (count (and arg (prefix-numeric-value arg))) >>> (isearch-repeat-forward count))) >> >>This can be simplified as per Noam's suggestion. > Yes, sorry, I was concerned if somehow the prefix could be non-nil, but > (prefix-numeric-value arg) could return nil... I don't really know the > fancy valued that prefix could potentially have. But probably there is > not any danger there. All potential prefix values are listed under (info "(elisp) Prefix Command Arguments"), and prefix-numeric-value is guaranteed to return an integer. Thanks, -- Basil