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: Fri, 03 May 2019 17:28:16 +0100 Message-ID: <87muk3bizj.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> <874l6f132f.fsf@tcd.ie> <20190501112025.fnsynkbmkvllapyv@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="724"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Juri Linkov , emacs-devel@gnu.org To: Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 03 23:16:19 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 1hMfXX-0012u5-4c for ged-emacs-devel@m.gmane.org; Fri, 03 May 2019 23:16:19 +0200 Original-Received: from localhost ([127.0.0.1]:43510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMb33-0001TE-D7 for ged-emacs-devel@m.gmane.org; Fri, 03 May 2019 12:28:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMb2t-0001Qx-SE for emacs-devel@gnu.org; Fri, 03 May 2019 12:28:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMb2s-00033C-3g for emacs-devel@gnu.org; Fri, 03 May 2019 12:28:23 -0400 Original-Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]:34887) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMb2r-00031c-Tm for emacs-devel@gnu.org; Fri, 03 May 2019 12:28:22 -0400 Original-Received: by mail-ed1-x543.google.com with SMTP id p26so6697022edr.2 for ; Fri, 03 May 2019 09:28:20 -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=Q3eM8c6Jfs4N3fGtnG9K4He6adnUFccVR9Pf7eaN09o=; b=0gL8kYeeEP49F5Ddi5OhALUFrQiZ/ed/HLfEppp58DaHlxAneGFtR7q07fAsjlGCJq wNy9RWj9UGtDDYHEQVXyCd3+8s8qWLVSHfzSQAHd4nqkZfDJaqsOw10Afs4xyHoL0EHK wzjoUIEv8rR5CXdIqH9mcUjhph+qUEtzW6hV8pC/Xs7k617R5dnQLO/CYnRp5VFJQkUR tXPtYH8U2XL9IA1w9ZLCLeettLPoh/T5gRWCSFn4sEyvAisDN8snXlJnP7M75EUg4/dk 6euoPq7Kcdo/aMSzHGOsnnmJ+XiIwlwCTCakRrZyS21X8WTC4HsYTTLqpF8aSSIYV7zv ZKsg== 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=Q3eM8c6Jfs4N3fGtnG9K4He6adnUFccVR9Pf7eaN09o=; b=Q8xQSwk+Yg/tTTNnlwhbQZpl77QjBvQx8lILGIITPnYpPHzJ1LBPbnnhtHnZ8Oq052 Xlnd6zHcIWhFo0OakMPKaIOxj2K8ZcGEsGSPQ/pQR3nN4JM5J0ur5NSFXJdbmPUFiQpe hXWOztxudzUmTdRqicG5llCCPSFDl/kBq+uNKfS9ShmGkRhq6KWfM0vbgSkFAPWjhjKA 9MUjy6JzEm/eXriece40nVwewDoVrZTMHDL+d3McrPpJVmisdX/LGdopMlQNon0y/KVa S0yQ8RI1aeTs9wPuWV5QS+MyaC3/+tWI8iB3sxKEXBttsz7GCHVQdA+yrynAtxtm3vZz Sf4A== X-Gm-Message-State: APjAAAUaswdcZKkzMNYDK3g/SnFM719C9r8n5KLpZywts6hbuQi/tXe1 KgtZJAgWc03qHGucIv2AOkAZqw== X-Google-Smtp-Source: APXvYqzAvFMNcEXJuZzvdSHUTfwgAmAVemIhLrjoWjYRMFv91pToY5Ms2MnK+fp2tuK88CK7Fc12bg== X-Received: by 2002:a50:d717:: with SMTP id t23mr9639944edi.248.1556900899389; Fri, 03 May 2019 09:28:19 -0700 (PDT) Original-Received: from localhost ([89.101.223.218]) by smtp.gmail.com with ESMTPSA id c6sm679067edk.81.2019.05.03.09.28.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 03 May 2019 09:28:18 -0700 (PDT) In-Reply-To: <20190501112025.fnsynkbmkvllapyv@Ergus> (Ergus's message of "Wed, 1 May 2019 13:20:25 +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:236116 Archived-At: Ergus writes: > Here is attached a patch with all my proposed changes to isearch. Thanks, just some minor comments from me: > @@ -267,6 +267,14 @@ of the current line to the search string. If point is already at the > end of a line, it appends the next line. With a prefix argument > @var{n}, it appends the next @var{n} lines. > > +@kindex M-w @r{(Incremental search)} > +@findex isearch-yank-region > + @kbd{M-w} (@code{isearch-yank-region}) appends the text in the > +active region if @code{transient-mark-mode} is @code{non-nil}. This is I think it is more common to talk about transient-mark-mode the mode, not the variable. Emacs convention is to end all sentences with two spaces, see the sentence-end-double-space setting in the repository's dir-locals-file. > +an easy way to insert the text in the region without needing to exit > +@code{isearch-mode}. The region is deactivated during the search, but > +it is reactivated if the @code{isearch-cancel} is called. > + > @kindex C-y @r{(Incremental search)} > @kindex M-y @r{(Incremental search)} > @kindex mouse-2 @r{in the minibuffer (Incremental search)} > diff --git a/lisp/isearch.el b/lisp/isearch.el > index 6280afebdc..78414dbfcd 100644 > --- a/lisp/isearch.el > +++ b/lisp/isearch.el > @@ -937,6 +940,8 @@ Each element is an `isearch--state' struct where the slots are > > (defvar isearch--saved-overriding-local-map nil) > > +(defvar isearch--deactivated-mark nil) > + It's always nice to have docstrings. > ;; Minor-mode-alist changes - kind of redundant with the > ;; echo area, but if isearching in multiple windows, it can be useful. > ;; Also, clicking the mode-line indicator pops up > @@ -1133,6 +1140,22 @@ positive, or search for ARGth symbol backward if ARG is negative." > (isearch-push-state) > (isearch-update))))) > > +(defun isearch-forward-region (&optional arg) > + "Do incremental search forward for text in active region. > +Like ordinary incremental search except that the text in the > +active region is added to the search string initially > +if`transient-mark-mode' is enabled. See the command ^^^ Missing space. > +`isearch-forward' for more information. > +With a prefix argument, search for ARGth occurrence forward if > +ARG is positive, or ARGth occurrence backward if ARG is > +negative." > + (interactive "P") > + (isearch-forward nil 1) > + (isearch-yank-region) > + (when (and isearch--deactivated-mark > + arg) > + (isearch-repeat-forward (prefix-numeric-value arg)))) > + > > ;; isearch-mode only sets up incremental search for the minor mode. > ;; All the work is done by the isearch-mode commands. > @@ -2446,6 +2473,27 @@ If search string is empty, just beep." > ;; then it "used" the mark which we should hence deactivate. > (when select-active-regions (deactivate-mark))) > > +(defun isearch-yank-region () > + "Pull current active region text into search string. > +The text in the active region is added to the search string if > +variable `transient-mark-mode' is non nil." Ditto re: transient-mark-mode the mode, not variable. Thanks, -- Basil