From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: isearch region or thing at point. Date: Tue, 30 Apr 2019 08:39:56 -0700 (PDT) Message-ID: 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 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="74778"; mail-complaints-to="usenet@blaine.gmane.org" Cc: "Basil L. Contovounesios" , emacs-devel@gnu.org To: Juri Linkov , Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 30 17:45:31 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 1hLUwl-000JGO-9i for ged-emacs-devel@m.gmane.org; Tue, 30 Apr 2019 17:45:31 +0200 Original-Received: from localhost ([127.0.0.1]:48781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLUwk-0000Cj-5H for ged-emacs-devel@m.gmane.org; Tue, 30 Apr 2019 11:45:30 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLUuN-0007OU-J9 for emacs-devel@gnu.org; Tue, 30 Apr 2019 11:43:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLUrY-0008Vv-6k for emacs-devel@gnu.org; Tue, 30 Apr 2019 11:40:09 -0400 Original-Received: from aserp2130.oracle.com ([141.146.126.79]:51032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hLUrX-0008VV-VV for emacs-devel@gnu.org; Tue, 30 Apr 2019 11:40:08 -0400 Original-Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3UFYE7M129426; Tue, 30 Apr 2019 15:40:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=Bt+PSXG8zIpBdQf5K8qpkKTGzxYzK1tWsnIm+Hb3HHw=; b=F9J8i1Xn+E3sfJXOpSOWZNKccOh1OH714pNJRdDEpNZ4192gMv2FE55QIG+PerpWLhjE xIO0jymmGEmFn8rlERTbjOE0y3ShiXu8GwAcsyMD6Syx7M1cFFmaBhE7APTOi0r0W5U8 Rx5xhkHXADWdaKp+ZW5/RBi5/nUGwgQS6kzkyTxoh2puuubsTCikXJzuwJb3vZTrIUTi rc+z2+fNMWORzljWQvUlY+VJs4k2ANPZSbE2QDzkCTDZkmquZO+reEqcC7dZYlQJzPdt 1Q+8+QlDbZfYpdQ+JgYjzEPdfNVx6Ohyp5KtfsabuSaH8qGr1ZkcUro5T4gaqdNkrpa+ BA== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 2s4ckddm2j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Apr 2019 15:40:02 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3UFciel162583; Tue, 30 Apr 2019 15:40:01 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2s4ew1aj8r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Apr 2019 15:40:01 +0000 Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3UFdvkE020575; Tue, 30 Apr 2019 15:39:58 GMT In-Reply-To: <87h8agy4yf.fsf@mail.linkov.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4834.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9243 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904300096 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9243 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904300096 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 141.146.126.79 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:236053 Archived-At: > 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. >=20 > 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. >=20 > Fortunately, like Basil mentioned the command isearch-forward-symbol-at-p= oint > 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. 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). 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. 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. 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. 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-=3D ~' 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]