From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: isearch region or thing at point. Date: Tue, 30 Apr 2019 18:57:19 +0200 Message-ID: <20190430165719.yrcvz6oq5ktkyuug@Ergus> References: <20190427001453.isjx247kc3lu5fe4@Ergus> <87a7gcp51i.fsf@tcd.ie> <20190429004135.rn5tp2gnmbjovrxj@Ergus> <87h8agy4yf.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="38402"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: NeoMutt/20180716 Cc: "Basil L. Contovounesios" , emacs-devel@gnu.org, Juri Linkov To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 30 19:19:48 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 1hLWPz-0009nV-F4 for ged-emacs-devel@m.gmane.org; Tue, 30 Apr 2019 19:19:48 +0200 Original-Received: from localhost ([127.0.0.1]:50545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLWPx-00068P-US for ged-emacs-devel@m.gmane.org; Tue, 30 Apr 2019 13:19:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLW4S-0006N9-0D for emacs-devel@gnu.org; Tue, 30 Apr 2019 12:57:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLW4Q-0003Jw-IZ for emacs-devel@gnu.org; Tue, 30 Apr 2019 12:57:31 -0400 Original-Received: from sonic309-25.consmr.mail.ir2.yahoo.com ([77.238.179.83]:42919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLW4P-0003GW-F1 for emacs-devel@gnu.org; Tue, 30 Apr 2019 12:57:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1556643447; bh=Rc4l6YHdon1Y0BacMC+nscVN7ufoMlMeYsOOdcBmroQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=daJNMGCJjScGp0Pymj+yvpm7kc5+uDnuJprcXbKeYRJzWiq4eL+PeMMGbuRudpYw4JXMig0Tdz/FPfXHNIo7nIRYykux8MLFtw2DEeBXR5xUzXys2y5ddqRhY/3sOoWhBTdFf84juroQbdnyY0NhdwzsgJMqzXpHyMda+dhKn7BM85oqrsJGalSKy+HdgKT2CVg/3fWSWvsOxSvlNfCdpmqzPK5j4ISfSYT0f7MfBpf0C80x7Si3QZTnkFtv9WCKqxaiUOHyrKHzLxhF0fvpZ0cIlubLmpdoWhsSymhZ/k/NqfELqwR177R9ngAIJd/4N92GbxBMd9dIZTTAw1AtHg== X-YMail-OSG: 70yWvb4VM1mxRx0ursGjHQb8kjudBKnuOsjbX6bmNjk4wVavGo1XcDVQS4r.QCK rPjif5e2COBNwleG3rdGNpKbwc6M9Lcwl8Kz18IJ5uLAOVwYkRkQfWxus.kbbA9TvXgEtCez_FAQ ZM5ob1hr0e9Qpbx0MtcsIW4c3Am.rJMyi6KIQONCossFg0Jf5P71waJzzt71omL5s2aV42pelrLT Yl6SY_eTCq3Z1zyB2AlbRv9V73u0_cBJMCvt4p6uWKVKHC2_qDHCXz5ROorl8UDJJsJyXp2dHjep kiRvaz0_0qMJix6rJcznsMVj95Nqkt_lnZ5FHpIuz3aYj92uI2JcvDXHzUaGaRVAESMcri2WfSRb DhDTbp4Xyy2GTmzlhGbxlkl0yPxmcRHfyrIkiv_aeIIloRFRjolJwsOAdwe6ADqUHwt1eGr.qVww R2dDauYRE2JicOfwV1WcP2wAjjvvhL54dfa5uGTaVkC.U1Sz2yk4Ji38FoHWA17ZbMDHU5mpWmz7 VOOsSCCU4wR5JFArXu1qGjLCMNVewV2ihIZgZHDr0h84_HknkkK_b6CfrWAH0DVM73ExvzAmB9Sq dGlrI7H7MxUnpkTdSEaDaOL5NGUgWex94Zqgbm8aDfaLdrQ1qNfBaZNa9E5A4t_aIx.Dt_7W5u4U .2MpiF9SoCbpFw4laYOfUuGycjuCvlNEyiqGOLezJREkrJhY87x2nRJV2r3bvxB1tWGj9gUaqDT1 3o8.kaexIA9u3N3dl5A5sZbg4vMbhKwHiwu5v2DziQTGL3HiKkdSV6ipEyfHOjUGj_Sc9K0WEx75 BzDIqsG0axqIs4w.Ocu80PK93W09UkHoI6..8sS01k Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ir2.yahoo.com with HTTP; Tue, 30 Apr 2019 16:57:27 +0000 Original-Received: from 84.88.50.33 (EHLO Ergus) ([84.88.50.33]) by smtp430.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 88f6e6c17e64971f06222d317bfebb79; Tue, 30 Apr 2019 16:57:22 +0000 (UTC) Content-Disposition: inline In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 77.238.179.83 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:236060 Archived-At: On Tue, Apr 30, 2019 at 08:39:56AM -0700, Drew Adams wrote: >> Thanks, such addition is welcome. Currently searching the >> active region requires invocation of several commands: M-w C-s M-y >> with a bad side-effect of leaving the region in the kill-ring. >> >> However, adding a new option is not a satisfactory solution >> because often isearch is used to extend the boundaries of the >> active region, e.g. by setting the region's beginning with C-SPC, >> then searching the region's end and exiting isearch there. >> >> Fortunately, like Basil mentioned the command isearch-forward-symbol-at-point >> bound to 'M-s .' you could create a similar command bound to e.g. 'M-s r' >> that would start isearch with the text from the active region. > Hi Drew, very thanks for replying: >My own take on this: > >1. A user option is helpful (only) for users who really > want this behavior all the time. Unless, that is, > Emacs decides to let users toggle the option with a > (search-map) key. Vanilla Emacs doesn't like to do > that, opting instead for using a non-option variable > (letting you toggle that). > Ok, got it >2. It's already simple to search for the region text, as > Juri points out: `M-w C-s M-y'. And as he says, you > can easily define a command that does that from the > outset. > Of course the user could write anything, but this is a simple basic functionality available in gedit, geany, vim, qtcreator... but also in firefox, chromium, and so on... So, there is not any reason why emacs will provide no "easy" way to enable/access it somehow. Specially for the detail that we don't disable the region after the search was canceled. That's a more intuitive behavior. (Is a problem of simplicity and effort for the user) > > FWIW, as one user, I don't have a problem with `M-w' > adding the region text to the kill-ring. I don't see > that as a "bad side-effect" but rather as something > often useful. But sure, you can make searching for > selected text be independent from adding that text to > the kill-ring. > Touching the kill-ring for a simple search is unnatural, but also the command is extremely long (and sparse in the keyboard) for something that any programmed needs every 5 minutes. > If you set option `mouse-drag-copy-region' to non-nil > then text selected with the mouse is automatically > added to the kill-ring, so you can just use `M-y' > during search to yank it. > In my opinion Emacs should be equally functional with and without the mouse. There are people (like me) that still use emacs only in terminal mode. >3. There are several different ways the active region > can be useful for Isearch. Juri mentioned one: > extend the region end to a searched position. Each > way to use the region should be optional, and > sometimes some of them can be combined. Whatever you > provide, please make it optional. > > By way of example, here are some ways the region can > be used for Isearch that are offered by library > Isearch+ as optional behaviors: > > a. Search only within the active region: option > `isearchp-restrict-to-region-flag' - toggle with > `C-x n' while searching. > > b. Show match numbers only for search hits within > the region (has an effect only when search is > limited to the region): option > `isearchp-limit-match-numbers-to-region-flag' - > toggle with `M-s %' while searching. > > c. Deactivate the region for Isearch: option > `isearchp-deactivate-region-flag' - toggle with > `C-SPC C-SPC' while searching. > > d. Select the last search or query-replace target, > that is, make it the active region. Do this > either per option `isearchp-set-region-flag' > (toggle with `M-s M-SPC' while searching) or on > demand: `isearchp-set-region-around-search-target'. > > e. Create a noncontiguous region from the > lazy-highlighted text (search hits): `M-s z r' > while searching. > > f. Add/remove a text property to/from the region. > Search only areas that have that property with > particular values. Works also for overlays. > > g. Search outside the area that would normally be > searched (e.g. the region or a set of zones). > That is, complement the search space. Toggle > with `M-= ~' while searching. > > There are no doubt other ways the region can be > used for Isearch. We should not assume that > there's only one thing users might want to do > with it. Keep their, and our, options open. > >[https://www.emacswiki.org/emacs/IsearchPlus] > Actually I am only considering the option of adding a new function and bind it to M-s r. Or add a C-something like isearch-yank-word-or-char. (because I know that core option changes is complicated to agree in the list, and I don't like to spend hours on that.)