From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 08 13:05:17 2020 Received: (at submit) by debbugs.gnu.org; 8 Feb 2020 18:05:17 +0000 Received: from localhost ([127.0.0.1]:51768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0UTg-0002qx-I5 for submit@debbugs.gnu.org; Sat, 08 Feb 2020 13:05:17 -0500 Received: from lists.gnu.org ([209.51.188.17]:59156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0UTe-0002qp-FU for submit@debbugs.gnu.org; Sat, 08 Feb 2020 13:05:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37244) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0UTc-0003ow-SS for bug-gnu-emacs@gnu.org; Sat, 08 Feb 2020 13:05:10 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j0UTb-0006Zh-9E for bug-gnu-emacs@gnu.org; Sat, 08 Feb 2020 13:05:08 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:39805) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j0UTb-0006YC-0t for bug-gnu-emacs@gnu.org; Sat, 08 Feb 2020 13:05:07 -0500 Received: by mail-wr1-x42f.google.com with SMTP id y11so2625119wrt.6 for ; Sat, 08 Feb 2020 10:05:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=PbL6lRxJosvn+LCnXeLo9LdnOiPrUicIvTcebKxgmhA=; b=qkA1M6jWqGZVusXnPYIS/WvorkZM5dp3u0CKQCWBEfCeAs1V0yMv4hQL/CWX6i+/oH JPcMWsqjH7UielcNDr51PWCpaCwwKtFn/h62Z0UQbaljAvJ0/FWMW7FGZRIymPxTSGSK sb2IsbvUawSvYtQXdzBepvn7bvwK33NXyvPRoj8rn9uw9g13eFxIIaQjWWFAX2q4gRra II3BsE+0P1wUylrZ3hiKG5dPn30lFTbCWBt9ekXb/9cj8f66MxIqlhei5LG2c4+6qtXu PUR72ycaKowSCrK0CsrDTB7Co3MQ+tynEdNp65IUSCMauAOPj5kQHCz1RIwXKeqC+Ih/ 7YiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=PbL6lRxJosvn+LCnXeLo9LdnOiPrUicIvTcebKxgmhA=; b=XYtOv6/GUjm2ndYb5ZWEpDKG5S0up5Sfh5Eke2IrR3gSZT5ZoI6KFsDCKtEJ/z7d2G 3ebGqFc8NSdG0yG7j0YeG7qRQvp7JBdjJlAe2jkAy56gQYneXHWeAEx86CJcFPgfS6Jq E5lVOkwjYDyCNkSR3eoJwOlDxLTr+hMzFJ4Ol+UGGMg+q9eaCBWuY9TH49zUXoJ+6g7m Ac+K1s4FCWsys3tV0OZplUHyg7ULZX6WVLLcvFNvk9Nr0OEAGZoNRlMJI6Kex3UHmiC/ JMLkAp4nOmVLYhtfEPd2VI4uWMndDOVkP6i8Qj6p8sfZ6KzInfg5eLzeJatDCkDCBkkm 2WTg== X-Gm-Message-State: APjAAAWOSjndwYNXnKhZ5Ju2eauabvSEtHHjm5dkVELOmbdJ4+EUFHuE GhVCQMbrGelg98bvK36tPJzyK7y+wfU= X-Google-Smtp-Source: APXvYqyJ9edx/hhOI9j0W1B4dpsp+ssZn1P3D/mOxSxXLARkdJBoP4HN7s8xdw722ziVv7VxTsyQiA== X-Received: by 2002:adf:f3d1:: with SMTP id g17mr6040111wrp.378.1581185104477; Sat, 08 Feb 2020 10:05:04 -0800 (PST) Received: from calancha-pc.dy.bbexcite.jp ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id w26sm7914115wmi.8.2020.02.08.10.05.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Feb 2020 10:05:03 -0800 (PST) From: Tino Calancha To: bug-gnu-emacs@gnu.org Subject: 28.0.50; Add command isearch-yank-region Date: Sat, 08 Feb 2020 19:04:57 +0100 Message-ID: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42f X-Spam-Score: 2.3 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Severity: wishlist Tags: patch X-Debbugs-Cc: spacibba@aol.com, juri@linkov.net, drew.adams@oracle.com, npostavs@gmail.com, contovob@tcd.ie, eliz@gnu.org I wish to have this command; it naturally completes other isearch-yank-... cases. Content analysis details: (2.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: gnu.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tino.calancha[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [209.51.188.17 listed in list.dnswl.org] 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Severity: wishlist Tags: patch X-Debbugs-Cc: spacibba@aol.com,juri@linkov.net,drew.adams@oracle.com,npostavs@gmail.com,contovob@tcd.ie,eliz@gnu.org I wish to have this command; it naturally completes other isearch-yank-... cases. This topic has been already discussed in the following links: https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg01125.html https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00003.html Note that in those threads there were plenty of discussions; here I'd like to focus just in this proposed command. If needed, I'd recommend to open further bugs to discuss about other commands. I let this command to start the interactive search if we are not already there; from the above links I realized that such a functionality was also missing. This is consistent with `isearch-yank-kill' (I think we should mention that in its docstring). --8<-----------------------------cut here---------------start------------->8--- commit 1ea1939929fbf22c6d635b075cfcb2b77a4b8243 Author: Tino Calancha Date: Sat Feb 8 18:39:44 2020 +0100 Add command isearch-yank-region During an incremental search, this command appends the region to the search string. Otherwise, start an incremental search using the region as the search string. * lisp/isearch.el (isearch-yank-region): New command; bound to 'M-.' in isearch-mode-map. * doc/emacs/search.texi (Isearch Yank): Document it. * etc/NEWS: Announce this change. diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 16916617a2..b443300b6d 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -285,6 +285,11 @@ Isearch Yank a prefix numeric argument of @var{n}, the command appends everything from point to the @var{n}th occurrence of the specified character. +@kindex M-. @r{(Incremental search)} +@findex isearch-yank-region + Likewise, @kbd{M-.} (@code{isearch-yank-region}) appends to +the search string the selected region. + @kindex C-y @r{(Incremental search)} @kindex M-y @r{(Incremental search)} @kindex mouse-2 @r{in the minibuffer (Incremental search)} diff --git a/etc/NEWS b/etc/NEWS index 55c1a47fbf..cf63176124 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -91,6 +91,13 @@ shows equivalent key bindings for all commands that have them. * Changes in Specialized Modes and Packages in Emacs 28.1 +** Search and Replace + ++++ +*** New isearch bindings. +'M-.' invokes new fnction 'isearch-yank-region', which yanks the selected +region into the search string. + ** Help +++ diff --git a/lisp/isearch.el b/lisp/isearch.el index ddf9190dc6..266c311c3d 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -514,6 +514,9 @@ isearch-menu-bar-yank-map (define-key map [isearch-yank-kill] '(menu-item "Current kill" isearch-yank-kill :help "Append current kill to search string")) + (define-key map [isearch-yank-region] + '(menu-item "Active region" isearch-yank-region + :help "Append active region to search string")) (define-key map [isearch-yank-until-char] '(menu-item "Until char..." isearch-yank-until-char :help "Yank from point to specified character into search string")) @@ -708,6 +711,7 @@ isearch-mode-map (define-key map "\M-\C-d" 'isearch-del-char) (define-key map "\M-\C-y" 'isearch-yank-char) (define-key map "\C-y" 'isearch-yank-kill) + (define-key map "\M-." 'isearch-yank-region) (define-key map "\M-\C-z" 'isearch-yank-until-char) (define-key map "\M-s\C-e" 'isearch-yank-line) @@ -1007,6 +1011,7 @@ isearch-forward Type \\[isearch-yank-line] to yank rest of line onto end of search string\ and search for it. Type \\[isearch-yank-kill] to yank the last string of killed text. +Type \\[isearch-yank-region] to yank the active region. Type \\[isearch-yank-pop] to replace string just yanked into search prompt with string killed before it. Type \\[isearch-quote-char] to quote control character to search for it. @@ -2473,6 +2478,17 @@ isearch-yank-kill (unless isearch-mode (isearch-mode t)) (isearch-yank-string (current-kill 0))) +(defun isearch-yank-region () + "Pull region into search string. +If called out of an incremental search, then start an incremental +search with the region as the search string." + (interactive) + (cond ((use-region-p) + (unless isearch-mode (isearch-mode t)) + (isearch-yank-string (funcall region-extract-function)) + (deactivate-mark)) + (t (user-error "No selected region")))) + (defun isearch-yank-pop () "Replace just-yanked search string with previously killed string." (interactive) --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 28.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2020-02-08 built on calancha-pc.dy.bbexcite.jp Repository revision: fe903c5ab7354b97f80ecf1b01ca3ff1027be446 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 08 18:47:29 2020 Received: (at 39512) by debbugs.gnu.org; 8 Feb 2020 23:47:29 +0000 Received: from localhost ([127.0.0.1]:51943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0Zou-0004I7-W7 for submit@debbugs.gnu.org; Sat, 08 Feb 2020 18:47:29 -0500 Received: from sonic311-15.consmr.mail.bf2.yahoo.com ([74.6.131.125]:45303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0Zor-0004Hp-W2 for 39512@debbugs.gnu.org; Sat, 08 Feb 2020 18:47:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1581205640; bh=D0ecjj6SL2ZA/KeJvmPxYsOSQOMdmfsI9PVp9fVz3GM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=BkzxGsNbiuCXBEI4xaUBqMj7CqK5Rx5qb6zTqH5Zl1N1GQx6CQZ82NSNl0akH/jiJ22pSPnpL1uG24YxsCniiUdQjomFl3rIpPsBb31oeWfYFVk+oaJzrWt6OvBia1IxUrX+nn0g0w2NEynaWeLBxqAAJqTDktwo0kYIGko6rjM1fOBz8BReVaNy0KtWjCLfspC4gj0IK1qjO/CBz55scP+JZt+KwaW0WlsRyX/G39mWgtoC0MQuVSwtK5uZDhfCrtQj6121ODoyZ4w3D8tmX8bYiTYOKqdISaMvWxFKOCRGrT5+uEfjCIuxU4d220nCgY1YJQyMuF0xAQBquAl/gA== X-YMail-OSG: COSxQQ0VM1nSG.4Ov0irBlRZ7SAundWzuTd.KvZyrd0uKzlhYxh9fCtSN9QQUB6 X1rp3.rZti1vAxxle7uSiDyXk_dWa5SG0NQDoyy1fteKDkHbqyzbYVeZmYkUX4mnDNWL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 0SwHR2NQ5hEL0OO55zF98ycxOFFmS2qvu4rXuTLdkZdIC0l3sJcil5ylPuS_.RduFfIdKnMvOJ52 Ry8RHh8g8Sdv2OJ5oXe77DPBgeUiTfIjou1aWu5yECl6Qt.VN1LZa8f8w2XMltL7qHhy5ZPkCbYo VtGbuBcq2jPh_yNDvOZ7DJxxwYsn7A1dGoTtvqVt8o4v99COsNPJB Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Sat, 8 Feb 2020 23:47:20 +0000 Received: by smtp421.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID a1bda407d9ec9c63b9a4f5e6e9ba703f; Sat, 08 Feb 2020 23:47:15 +0000 (UTC) Date: Sun, 9 Feb 2020 00:47:13 +0100 From: Ergus To: Tino Calancha Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Message-ID: <20200208234713.tlenu5tmna6ezvb7@Ergus> References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> X-Mailer: WebService/1.1.15199 hermes Apache-HttpAsyncClient/4.1.4 (Java/1.8.0_181) Content-Length: 6021 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: npostavs@gmail.com, juri@linkov.net, contovob@tcd.ie, eliz@gnu.org, 39512@debbugs.gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Tino: It is good to see that someone else is interested on this. I just forgot it after not having a good agreement about the bindings to use. The patch seems good for me, I only want to comment that there was a race condition when the selected region is not contiguous (ex: rectangular selection). Did you tried that case? If possible, please consider adding also some function like the one I proposed in one of the mails (isearch-forward-region) to start the search directly with the selected region text. A good improvement to my function would be to use thing-at-point if not region is active (or modify isearch-forward-symbol-at-point) to do so. Best, Ergus On Sat, Feb 08, 2020 at 07:04:57PM +0100, Tino Calancha wrote: >Severity: wishlist >Tags: patch >X-Debbugs-Cc: spacibba@aol.com,juri@linkov.net,drew.adams@oracle.com,npostavs@gmail.com,contovob@tcd.ie,eliz@gnu.org > >I wish to have this command; it naturally completes other >isearch-yank-... cases. > >This topic has been already discussed in the following links: > >https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg01125.html >https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00003.html > >Note that in those threads there were plenty of discussions; here I'd >like to focus just in this proposed command. If needed, I'd recommend >to open further bugs to discuss about other commands. > >I let this command to start the interactive search if we are >not already there; from the above links I realized that >such a functionality was also missing. This is consistent with >`isearch-yank-kill' (I think we should mention that in its docstring). > > >--8<-----------------------------cut here---------------start------------->8--- >commit 1ea1939929fbf22c6d635b075cfcb2b77a4b8243 >Author: Tino Calancha >Date: Sat Feb 8 18:39:44 2020 +0100 > > Add command isearch-yank-region > > During an incremental search, this command appends the region > to the search string. Otherwise, start an incremental search > using the region as the search string. > > * lisp/isearch.el (isearch-yank-region): New command; bound to 'M-.' > in isearch-mode-map. > > * doc/emacs/search.texi (Isearch Yank): Document it. > * etc/NEWS: Announce this change. > >diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi >index 16916617a2..b443300b6d 100644 >--- a/doc/emacs/search.texi >+++ b/doc/emacs/search.texi >@@ -285,6 +285,11 @@ Isearch Yank > a prefix numeric argument of @var{n}, the command appends everything > from point to the @var{n}th occurrence of the specified character. > >+@kindex M-. @r{(Incremental search)} >+@findex isearch-yank-region >+ Likewise, @kbd{M-.} (@code{isearch-yank-region}) appends to >+the search string the selected region. >+ > @kindex C-y @r{(Incremental search)} > @kindex M-y @r{(Incremental search)} > @kindex mouse-2 @r{in the minibuffer (Incremental search)} >diff --git a/etc/NEWS b/etc/NEWS >index 55c1a47fbf..cf63176124 100644 >--- a/etc/NEWS >+++ b/etc/NEWS >@@ -91,6 +91,13 @@ shows equivalent key bindings for all commands that have them. > > * Changes in Specialized Modes and Packages in Emacs 28.1 > >+** Search and Replace >+ >++++ >+*** New isearch bindings. >+'M-.' invokes new fnction 'isearch-yank-region', which yanks the selected >+region into the search string. >+ > ** Help > > +++ >diff --git a/lisp/isearch.el b/lisp/isearch.el >index ddf9190dc6..266c311c3d 100644 >--- a/lisp/isearch.el >+++ b/lisp/isearch.el >@@ -514,6 +514,9 @@ isearch-menu-bar-yank-map > (define-key map [isearch-yank-kill] > '(menu-item "Current kill" isearch-yank-kill > :help "Append current kill to search string")) >+ (define-key map [isearch-yank-region] >+ '(menu-item "Active region" isearch-yank-region >+ :help "Append active region to search string")) > (define-key map [isearch-yank-until-char] > '(menu-item "Until char..." isearch-yank-until-char > :help "Yank from point to specified character into search string")) >@@ -708,6 +711,7 @@ isearch-mode-map > (define-key map "\M-\C-d" 'isearch-del-char) > (define-key map "\M-\C-y" 'isearch-yank-char) > (define-key map "\C-y" 'isearch-yank-kill) >+ (define-key map "\M-." 'isearch-yank-region) > (define-key map "\M-\C-z" 'isearch-yank-until-char) > (define-key map "\M-s\C-e" 'isearch-yank-line) > >@@ -1007,6 +1011,7 @@ isearch-forward > Type \\[isearch-yank-line] to yank rest of line onto end of search string\ > and search for it. > Type \\[isearch-yank-kill] to yank the last string of killed text. >+Type \\[isearch-yank-region] to yank the active region. > Type \\[isearch-yank-pop] to replace string just yanked into search prompt > with string killed before it. > Type \\[isearch-quote-char] to quote control character to search for it. >@@ -2473,6 +2478,17 @@ isearch-yank-kill > (unless isearch-mode (isearch-mode t)) > (isearch-yank-string (current-kill 0))) > >+(defun isearch-yank-region () >+ "Pull region into search string. >+If called out of an incremental search, then start an incremental >+search with the region as the search string." >+ (interactive) >+ (cond ((use-region-p) >+ (unless isearch-mode (isearch-mode t)) >+ (isearch-yank-string (funcall region-extract-function)) >+ (deactivate-mark)) >+ (t (user-error "No selected region")))) >+ > (defun isearch-yank-pop () > "Replace just-yanked search string with previously killed string." > (interactive) > >--8<-----------------------------cut here---------------end--------------->8--- > > >In GNU Emacs 28.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) > of 2020-02-08 built on calancha-pc.dy.bbexcite.jp >Repository revision: fe903c5ab7354b97f80ecf1b01ca3ff1027be446 >Repository branch: master >Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 >System Description: Debian GNU/Linux 10 (buster) > > > From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 08 19:43:58 2020 Received: (at 39512) by debbugs.gnu.org; 9 Feb 2020 00:43:58 +0000 Received: from localhost ([127.0.0.1]:51960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0ahZ-0005f0-QH for submit@debbugs.gnu.org; Sat, 08 Feb 2020 19:43:58 -0500 Received: from cheetah.birch.relay.mailchannels.net ([23.83.209.34]:11846) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0ahX-0005er-BC for 39512@debbugs.gnu.org; Sat, 08 Feb 2020 19:43:56 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 04ABB21452; Sun, 9 Feb 2020 00:43:54 +0000 (UTC) Received: from pdx1-sub0-mail-a62.g.dreamhost.com (100-96-215-16.trex.outbound.svc.cluster.local [100.96.215.16]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id CCFD221735; Sun, 9 Feb 2020 00:43:52 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a62.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Sun, 09 Feb 2020 00:43:53 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Imminent-Average: 67c557221ae72100_1581209033733_2632352009 X-MC-Loop-Signature: 1581209033732:1855016014 X-MC-Ingress-Time: 1581209033732 Received: from pdx1-sub0-mail-a62.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTP id 8B579803F9; Sat, 8 Feb 2020 16:43:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=XbuLCAOz+nX62xiK8Z0kXbS9pBM=; b= kefSMG2CiMos5hDOW8I+GpfWLzGXj4qyGOdxfq1HVUOFwrBhtRMsJq4rR6VY6A7e IOb1zCPVkBbhLLvJVHMeSXZpvJo82p1wO0VTp6vf9P1elKnpip9MjEj1G5BsQTEj k7Bm84DZ71lMa+PYruemFIboEWqSRJLXWYJ6ke4kDlI= Received: from mail.jurta.org (m91-129-105-126.cust.tele2.ee [91.129.105.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTPSA id DB3277FF8F; Sat, 8 Feb 2020 16:43:42 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a62 From: Juri Linkov To: Tino Calancha Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> Date: Sun, 09 Feb 2020 02:31:50 +0200 In-Reply-To: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> (Tino Calancha's message of "Sat, 08 Feb 2020 19:04:57 +0100") Message-ID: <877e0wiosp.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrheekgddvudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuffhomhgrihhnpehgnhhurdhorhhgnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehtihhnohdrtggrlhgrnhgthhgrsehgmhgrihhlrdgtohhm X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: spacibba@aol.com, npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > I wish to have this command; it naturally completes other > isearch-yank-... cases. > > This topic has been already discussed in the following links: > > https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg01125.html > https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00003.html > > Note that in those threads there were plenty of discussions; here I'd > like to focus just in this proposed command. If needed, I'd recommend > to open further bugs to discuss about other commands. Thanks for creating a new feature request that unlike these discussions on emacs-devel won't fall into oblivion. > I let this command to start the interactive search if we are > not already there; from the above links I realized that > such a functionality was also missing. This is consistent with > `isearch-yank-kill' (I think we should mention that in its docstring). Please add this useful feature of `isearch-yank-kill' to the documentation. Maybe it should be bound to a special key on the global `M-s' prefix map. The most natural key would be `M-s C-y'. > Add command isearch-yank-region > > During an incremental search, this command appends the region > to the search string. Otherwise, start an incremental search > using the region as the search string. What use cases do you think it could be used for? I don't see any useful case for appending the region to the search string. I see only 2 useful cases that don't append the region to the search string: 1. Before starting isearch, the user selects the region, then types a special command bound to a key on the global `M-s' prefix that yanks the region to the initially empty search string (i.e. it doesn't append, it replaces the empty search string) I used such command to do this: (defun isearch-forward-region () "Do incremental search forward for text from the active region. Like ordinary incremental search except that text from the region is added to the search string initially if the region is active." (interactive) (isearch-forward nil 1) (cond ((use-region-p) (when (< (mark) (point)) (exchange-point-and-mark)) (isearch-yank-string (buffer-substring-no-properties (region-beginning) (region-end))) (deactivate-mark)) (t (setq isearch-error "No active region") (isearch-push-state) (isearch-update)))) (define-key search-map "\M-." 'isearch-forward-region) 2. The second useful case is to activate the region, start isearch, use isearch to find the string at the region end, thus moving the region end to a new position, replace (don't append) the search string with region text - this is what isearch-yank-region could do. IOW, sync the region with the search string. > +(defun isearch-yank-region () > + "Pull region into search string. > +If called out of an incremental search, then start an incremental > +search with the region as the search string." > + (interactive) > + (cond ((use-region-p) > + (unless isearch-mode (isearch-mode t)) > + (isearch-yank-string (funcall region-extract-function)) Here (funcall region-extract-function) signals the error (wrong-number-of-arguments (1 . 1) 0) Have you tested your patch? From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 09 06:21:26 2020 Received: (at 39512) by debbugs.gnu.org; 9 Feb 2020 11:21:26 +0000 Received: from localhost ([127.0.0.1]:52151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0keT-00062T-PG for submit@debbugs.gnu.org; Sun, 09 Feb 2020 06:21:26 -0500 Received: from mail-wr1-f53.google.com ([209.85.221.53]:35868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0keR-00062H-Oq for 39512@debbugs.gnu.org; Sun, 09 Feb 2020 06:21:24 -0500 Received: by mail-wr1-f53.google.com with SMTP id z3so4049384wru.3 for <39512@debbugs.gnu.org>; Sun, 09 Feb 2020 03:21:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=io/LW17DHfDcZOUPm293J6Do6Vw96cBnfD2t9udLdao=; b=njYN+MXNX2yDc/l+OpvgFXY5cChoVYGbL/JCWCI5zOg4GD8snoD9G/qe9S74ysTOOY jQsEv5OmiYCWJ2VXdsPGNXjdqblh3K/S3w2F8F2Dzn9maFecYWzk1SY7L5MHy+H5/kxs JwXClAt0EQLGkXViZDtyXpVedgGxPoVb3A9XYTKy6oCpn+m1Z1q1xBRzM/ggZt+YUPz7 9USWodOLXV7vbNB8XmgGXG2pYGF47FSCBuGuf5k91zdymEuVItu4dDwv19COmrPbVNId dqNzfp4CTc7NfcSf7qjrIiKNZSYqfhDnfXCTsoT/rDPqUjsdkbMN3L8dQB2e7hVie2Gp SvPQ== 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=io/LW17DHfDcZOUPm293J6Do6Vw96cBnfD2t9udLdao=; b=Ozu6crIQwFYwwvlEUNjWBzRf57hLshD463DumtDdU79ZocmuA0I39uLIwLt83qa5oO RQHUj6pCjJPJaOSKgN7AJjE0HoSvJHSpNzy8L951FCcmX2R6O7X/NUPKQzAcFZt8ZeIi lQ/PvlRfejmvDYQFveawy3FSWZMzFm8pBKYJ17Bm/DJLDI6zKRgrUU/j8aPdfY25zYZn BZ+qsG9AuA/TppaW/gchTASSz+an455sCvNG/8EyzXvJRkuZII63iA8SmvASXNpykx3c 7stRb3ZltkkVgWXGXS9pJXvV7mG8nfjacKEwck+zS5RKmFkxh26VAle3uFk6bwarUb91 c7vw== X-Gm-Message-State: APjAAAXvKwIPdCHylYWx/nRVDCKcMmAyy820F/8ECMHXEdUfgwQiDNjb YPao+APK43WEwPvUO25Je0U= X-Google-Smtp-Source: APXvYqwCsZXb4zykDoYS+XHDWOzaTbHqTYb04ZgZTWW2OXjTfl29wpFv/OmIk57jlI91mzX9buo1fA== X-Received: by 2002:a5d:5347:: with SMTP id t7mr10742477wrv.401.1581247277905; Sun, 09 Feb 2020 03:21:17 -0800 (PST) Received: from calancha-pc.dy.bbexcite.jp ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id 21sm10628887wmo.8.2020.02.09.03.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Feb 2020 03:21:17 -0800 (PST) From: Tino Calancha To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> Date: Sun, 09 Feb 2020 12:21:10 +0100 In-Reply-To: <877e0wiosp.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 09 Feb 2020 02:31:50 +0200") Message-ID: <87blq82ehl.fsf@calancha-pc.dy.bbexcite.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: spacibba@aol.com, npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: >> During an incremental search, this command appends the region >> to the search string. Otherwise, start an incremental search >> using the region as the search string. > > What use cases do you think it could be used for? > I don't see any useful case for appending the region to the search string. Me either. I believe I have copied such an append wording from elsewhere. What I have in mind is just to set the search string = to the region. > I see only 2 useful cases that don't append the region to the search string: > > 1. Before starting isearch, the user selects the region, > then types a special command bound to a key on the global `M-s' prefix > that yanks the region to the initially empty search string > (i.e. it doesn't append, it replaces the empty search string) > 2. The second useful case is to activate the region, start isearch, > use isearch to find the string at the region end, thus moving the region end > to a new position, replace (don't append) the search string with region text - > this is what isearch-yank-region could do. > IOW, sync the region with the search string. I was motivated with a scenario similar to 1. 1. I select a region that I want to search for 2. C-s ; I start an interactive search 3. `some keybinding here'; that sets the search string = to the region. I think on 3. as an alternative of `isearch-yank-until-char' (and family). Sure, having the command to start the search directly with a M-s prefix is desirable too. My mind finds easy to remember that I always can do the patter: C-s ;; Now some keybinding that sets the search string with `isearch-yank- (whatever) >> +(defun isearch-yank-region () >> + "Pull region into search string. >> +If called out of an incremental search, then start an incremental >> +search with the region as the search string." >> + (interactive) >> + (cond ((use-region-p) >> + (unless isearch-mode (isearch-mode t)) >> + (isearch-yank-string (funcall region-extract-function)) > > Here (funcall region-extract-function) signals the error > > (wrong-number-of-arguments (1 . 1) 0) > > Have you tested your patch? Opps, I tested without emacs -Q. sorry for that! I have some advice in that function that lets me call it with no arguments. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 09 07:38:25 2020 Received: (at 39512) by debbugs.gnu.org; 9 Feb 2020 12:38:25 +0000 Received: from localhost ([127.0.0.1]:52173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0lqz-0001Tw-DY for submit@debbugs.gnu.org; Sun, 09 Feb 2020 07:38:25 -0500 Received: from mail-wr1-f53.google.com ([209.85.221.53]:36128) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0lqx-0001Tj-4y for 39512@debbugs.gnu.org; Sun, 09 Feb 2020 07:38:23 -0500 Received: by mail-wr1-f53.google.com with SMTP id z3so4173999wru.3 for <39512@debbugs.gnu.org>; Sun, 09 Feb 2020 04:38:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GXjp6AWeDOZr76ps8eK/xFBcTI+6zCRcm6obH7KBbe4=; b=GPETkJSYa2tRfl8u4SQ4MwI4i1qkk2EPuI/mLKC/Y1BO+7qBqNMcwsBL4swUQg6m+a NHkVNBr1h3t2+LFwFfU/+ZIiyBepVqKswkHejChd7CsDoZBSPdMZJVvERli+wlgBEpfz qE3VQX9nCExBskcSECQTBXwnXHGkb30c8TxQWSuYKK2woTvzgQtN8nSe5Pen8B+HNP1e U0E0uNeBdE38qiXTqLR4CVXslPUcNVK8ODZUgjJ3QuiGx3FPev5poJft8n+UoZ63qfUl WMTTJxMh2paBl/p2IrC1qOxBJ6Hq4wmOV85w9OQ8SwOXQLbbHv4iPzqJvESpjKGAeEwM P8Fg== 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=GXjp6AWeDOZr76ps8eK/xFBcTI+6zCRcm6obH7KBbe4=; b=lfr/ljo4dMYEDdtvV1PMC520iF5N93FsNrwKtxWM/fq/Mbb9OiXGeO9CWs5Oayqhm7 pzbMhAEsLPdYMM0aM72YKNM5tbN09wpj341CZz5GWc/ZqGwxWy+yTz41D2fjSnOiDdoW ppCRJDjaTG3E/GMGiJDJwzYFRIEczJlzfAnvTJXP8dvbPyGesbK2i/4Zwg5nDipXCESF 5/vwhdl8WbQZd12f7nVfmr6suHYdhYiiNtDD5mlP0h35nwIdE6PC2/5+mzkNdlFWI159 nLpOThjloeWnEUge1B+Qu/Y/44Hb62oDmDGXAPSGAZPUBV7ywr7dCCNnn9Aa349OKN4c xHfA== X-Gm-Message-State: APjAAAXOhOI/lrOuPfX1ZzBFPy9cU7DJCLOUMutQh92nNy0mMdHY03/E j4ROAAF+8obgX6KpaCfX31o= X-Google-Smtp-Source: APXvYqzjXIGuKrqBFERT44jx2Z6z0v0Cgn2/ZEPkzXv4vPly9HYdrOdQC3jYgnObu857jPKhq8LbPw== X-Received: by 2002:adf:f28c:: with SMTP id k12mr11454697wro.360.1581251897091; Sun, 09 Feb 2020 04:38:17 -0800 (PST) Received: from calancha-pc.dy.bbexcite.jp ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id t13sm11668435wrw.19.2020.02.09.04.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Feb 2020 04:38:16 -0800 (PST) From: Tino Calancha To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> Date: Sun, 09 Feb 2020 13:38:14 +0100 In-Reply-To: <877e0wiosp.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 09 Feb 2020 02:31:50 +0200") Message-ID: <878slc2ax5.fsf@calancha-pc.dy.bbexcite.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: spacibba@aol.com, npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: >> such a functionality was also missing. This is consistent with >> `isearch-yank-kill' (I think we should mention that in its docstring). > > Please add this useful feature of `isearch-yank-kill' to the documentation. > Maybe it should be bound to a special key on the global `M-s' prefix map. > The most natural key would be `M-s C-y'. Done. Added global binding `M-s C-y' for `isearch-yank-kill'. Updated its docstring and the NEWS. > (defun isearch-forward-region () > "Do incremental search forward for text from the active region. > Like ordinary incremental search except that text from the region > is added to the search string initially if the region is active." > (interactive) > (isearch-forward nil 1) > (cond > ((use-region-p) > (when (< (mark) (point)) > (exchange-point-and-mark)) > (isearch-yank-string > (buffer-substring-no-properties (region-beginning) (region-end))) > (deactivate-mark)) > (t > (setq isearch-error "No active region") > (isearch-push-state) > (isearch-update)))) I got inspired by your function; I took you default case in the `cond' to not exit the interactive search, as I was doing. I have added global keybinding `M-s M-.' for my `isearch-yank-region'. This naturally open the following question. `isearch-yank-kill' and `isearch-yank-region' are good names for the use case of calling them once we are in an interactive search. The names are not any good for the use case of calling them directly (from a global keybinding). We might want: 1. aliases `isearch-forward-kill', `isearch-forward-region' 2. restrict the use of them for just inside the interactive search, and define the new commands (`isearch-forward-kill',`isearch-forward-region') as those calling `isearch-mode' at the beginning. [might case a regression of Bug#21419.] --8<-----------------------------cut here---------------start------------->8--- commit 9cfe28b2b9661ca5cb11b0a99649faad5d6cf708 Author: Tino Calancha Date: Sun Feb 9 13:19:51 2020 +0100 Add command isearch-yank-region Right after start an interactive search, set the search string equal to the active region; this is analogous to other 'isearch-yank-...' commands. Calling the command out of an interactive search, then it starts an interactive search with the region as the search string. This is consistent with `isearch-yank-kill'. * lisp/isearch.el (isearch-yank-region): New command; bound to 'M-.' in isearch-mode-map. Bind it globally to 'M-s M-.'. (isearch-yank-kill): Update dosctring. Bind this command globally to 'M-s C-y'. * doc/emacs/search.texi (Isearch Yank): Document these changes. * etc/NEWS: Announce these changes. diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 16916617a2..07a40c18cf 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -250,6 +250,16 @@ Isearch Yank search string. The commands described in this subsection let you do that conveniently. +@kindex M-. @r{(Incremental search)} +@kindex M-s M-. +@findex isearch-yank-region + @kbd{M-.} (@code{isearch-yank-region}) sets the search string equal +to the active region. This is useful when you have selected a string +that you now want to search for. Then you can start the interactive +search and use @kbd{M-.}. Alternatively, you can use @kbd{M-s M-.} +to start directly an interactive search with the region as the +search string. + @kindex C-w @r{(Incremental search)} @findex isearch-yank-word-or-char @kbd{C-w} (@code{isearch-yank-word-or-char}) appends the next @@ -287,6 +297,7 @@ Isearch Yank @kindex C-y @r{(Incremental search)} @kindex M-y @r{(Incremental search)} +@kindex M-s C-y @kindex mouse-2 @r{in the minibuffer (Incremental search)} @findex isearch-yank-kill @findex isearch-yank-pop diff --git a/etc/NEWS b/etc/NEWS index 55c1a47fbf..ecb8048ade 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -91,6 +91,14 @@ shows equivalent key bindings for all commands that have them. * Changes in Specialized Modes and Packages in Emacs 28.1 +** Search and Replace + ++++ +*** New isearch bindings. +'M-.' invokes new command 'isearch-yank-region', which yanks the selected +region into the search string. It's globally bound to 'M-s M-.'. +'isearch-yank-kill' now is globally bound to 'M-s C-y'. + ** Help +++ diff --git a/lisp/isearch.el b/lisp/isearch.el index ddf9190dc6..c5ae96033d 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -514,6 +514,9 @@ isearch-menu-bar-yank-map (define-key map [isearch-yank-kill] '(menu-item "Current kill" isearch-yank-kill :help "Append current kill to search string")) + (define-key map [isearch-yank-region] + '(menu-item "Active region" isearch-yank-region + :help "Append active region to search string")) (define-key map [isearch-yank-until-char] '(menu-item "Until char..." isearch-yank-until-char :help "Yank from point to specified character into search string")) @@ -708,6 +711,7 @@ isearch-mode-map (define-key map "\M-\C-d" 'isearch-del-char) (define-key map "\M-\C-y" 'isearch-yank-char) (define-key map "\C-y" 'isearch-yank-kill) + (define-key map "\M-." 'isearch-yank-region) (define-key map "\M-\C-z" 'isearch-yank-until-char) (define-key map "\M-s\C-e" 'isearch-yank-line) @@ -973,6 +977,8 @@ isearch--saved-overriding-local-map (defvar-local isearch-mode nil) ;; Name of the minor mode, if non-nil. (define-key global-map "\C-s" 'isearch-forward) +(define-key global-map "\M-s\M-." 'isearch-yank-region) +(define-key global-map "\M-s\C-y" 'isearch-yank-kill) (define-key esc-map "\C-s" 'isearch-forward-regexp) (define-key global-map "\C-r" 'isearch-backward) (define-key esc-map "\C-r" 'isearch-backward-regexp) @@ -1007,6 +1013,7 @@ isearch-forward Type \\[isearch-yank-line] to yank rest of line onto end of search string\ and search for it. Type \\[isearch-yank-kill] to yank the last string of killed text. +Type \\[isearch-yank-region] to yank the active region. Type \\[isearch-yank-pop] to replace string just yanked into search prompt with string killed before it. Type \\[isearch-quote-char] to quote control character to search for it. @@ -2468,11 +2475,28 @@ isearch-yank-string string (mapconcat 'isearch-text-char-description string ""))) (defun isearch-yank-kill () - "Pull string from kill ring into search string." + "Pull string from kill ring into search string. +If called out of an incremental search, then start an incremental +search with the last string of killed text as the search string." (interactive) (unless isearch-mode (isearch-mode t)) (isearch-yank-string (current-kill 0))) +(defun isearch-yank-region () + "Pull region into search string. +If called out of an incremental search, then start an incremental +search with the region as the search string." + (interactive) + (unless isearch-mode (isearch-mode t)) + (cond ((use-region-p) + (isearch-yank-string (funcall region-extract-function nil)) + (deactivate-mark)) + (t + (setq isearch-error "No active region") + (isearch-push-state) + (isearch-update)))) + + (defun isearch-yank-pop () "Replace just-yanked search string with previously killed string." (interactive) --8<-----------------------------cut here---------------end--------------->8--- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 09 19:51:35 2020 Received: (at 39512) by debbugs.gnu.org; 10 Feb 2020 00:51:35 +0000 Received: from localhost ([127.0.0.1]:53492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0xIV-0004Rj-EJ for submit@debbugs.gnu.org; Sun, 09 Feb 2020 19:51:35 -0500 Received: from bisque.elm.relay.mailchannels.net ([23.83.212.18]:31482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j0xIT-0004Ra-5Z for 39512@debbugs.gnu.org; Sun, 09 Feb 2020 19:51:34 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D6F65340BDB; Mon, 10 Feb 2020 00:51:31 +0000 (UTC) Received: from pdx1-sub0-mail-a69.g.dreamhost.com (100-96-0-7.trex.outbound.svc.cluster.local [100.96.0.7]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 3EB53340BD3; Mon, 10 Feb 2020 00:51:31 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a69.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Mon, 10 Feb 2020 00:51:31 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Stupid-Spill: 6ed9b67a46962da6_1581295891520_9545616 X-MC-Loop-Signature: 1581295891520:2107439328 X-MC-Ingress-Time: 1581295891520 Received: from pdx1-sub0-mail-a69.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a69.g.dreamhost.com (Postfix) with ESMTP id A8FBB81B25; Sun, 9 Feb 2020 16:51:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:message-id:mime-version:content-type; s=linkov.net; bh=SxYTA3o/ECoheAdrJnSH5ikqiOk=; b=ERvvLz9/pftSLd a7qFBWh8E6O0p8TQWZ5DE5QjgLLU9SxVFFh5nxaYhrnQCwV75X01gioBZfptPHjR Hc7X6s/nCVD9qkCfNZ2lYax27gzRooNcYkeJ7XUNYaq7Xceq0m+y7LeVPwgCu2fs J1cLGV2xQbWwWMLbmxhZSRMHzAY2o= Received: from mail.jurta.org (m91-129-105-126.cust.tele2.ee [91.129.105.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a69.g.dreamhost.com (Postfix) with ESMTPSA id EB86D81B1F; Sun, 9 Feb 2020 16:51:20 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a69 From: Juri Linkov To: Tino Calancha Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <878slc2ax5.fsf@calancha-pc.dy.bbexcite.jp> Date: Mon, 10 Feb 2020 02:45:17 +0200 Message-ID: <87o8u75lfe.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrheelgdduieekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehtihhnohdrtggrlhgrnhgthhgrsehgmhgrihhlrdgtohhm X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: spacibba@aol.com, npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > I have added global keybinding `M-s M-.' for my `isearch-yank-region'. Thanks. > `isearch-yank-kill' and `isearch-yank-region' are good names for the > use case of calling them once we are in an interactive search. > > The names are not any good for the use case of calling them directly > (from a global keybinding). We might want: > > 1. aliases `isearch-forward-kill', `isearch-forward-region' Aliases might add more confusion and make impression that these are separate commands when displayed in a list of isearch commands, e.g. in completion list, in documentation. > 2. restrict the use of them for just inside the interactive search, and > define the new commands (`isearch-forward-kill',`isearch-forward-region') > as those calling `isearch-mode' at the beginning. Restricting would be worse. So maybe `isearch-yank-kill' and `isearch-yank-region' still are not too bad names to use as entry points to enable isearch mode. > + (define-key map "\M-." 'isearch-yank-region) Some doubts are about `M-.' - what if some users might want to use `M-.' to exit isearch and run its global binding `xref-find-definitions' on the found symbol? Maybe better to bind `isearch-yank-region' to `M-s M-.' in isearch-mode too? > I have some advice in that function that lets me call it with no arguments. Maybe a new function could be added as a wrapper around `(funcall region-extract-function)' and with its argument optional. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 12 19:27:38 2020 Received: (at 39512) by debbugs.gnu.org; 13 Feb 2020 00:27:38 +0000 Received: from localhost ([127.0.0.1]:59226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j22Ly-0007eH-2c for submit@debbugs.gnu.org; Wed, 12 Feb 2020 19:27:38 -0500 Received: from bumble.birch.relay.mailchannels.net ([23.83.209.25]:43946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j22Lw-0007e9-7Y for 39512@debbugs.gnu.org; Wed, 12 Feb 2020 19:27:36 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3144912109D; Thu, 13 Feb 2020 00:27:35 +0000 (UTC) Received: from pdx1-sub0-mail-a74.g.dreamhost.com (100-96-0-6.trex.outbound.svc.cluster.local [100.96.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 8E074121324; Thu, 13 Feb 2020 00:27:34 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a74.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Thu, 13 Feb 2020 00:27:35 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-White-Eyes: 69b6fd7558f7023e_1581553654998_3013590715 X-MC-Loop-Signature: 1581553654998:827259472 X-MC-Ingress-Time: 1581553654998 Received: from pdx1-sub0-mail-a74.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a74.g.dreamhost.com (Postfix) with ESMTP id 495A17F570; Wed, 12 Feb 2020 16:27:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=4O0hKOc/UBHTKdtaYt57gIDiMPc=; b= 1B7bp3E/LNAcHcVAy80VkIk/5UkIafS03yF3Mc8BmpvO7ZXb7slE0p06ViLzFKw3 JykNx9bUaOwCvuxp2jkJnmDgHH3aArhnxIM54WDdsWhC50IJ5af6idPAisJN+1Yl GqpKKtnKmg7h/A0SMaDOtCZh7kP3+g/P1MHWmjdPCXI= Received: from mail.jurta.org (m91-129-105-126.cust.tele2.ee [91.129.105.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a74.g.dreamhost.com (Postfix) with ESMTPSA id A8AEC7F56C; Wed, 12 Feb 2020 16:27:28 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a74 From: Juri Linkov To: Tino Calancha Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <878slc2ax5.fsf@calancha-pc.dy.bbexcite.jp> <87o8u75lfe.fsf@mail.linkov.net> Date: Thu, 13 Feb 2020 00:10:07 +0200 In-Reply-To: <87o8u75lfe.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 10 Feb 2020 02:45:17 +0200") Message-ID: <87o8u39zfs.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrieejgddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuffhomhgrihhnpehgnhhurdhorhhgnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehtihhnohdrtggrlhgrnhgthhgrsehgmhgrihhlrdgtohhm X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: 39512@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> I have some advice in that function that lets me call it with no arguments. > > Maybe a new function could be added as a wrapper around > `(funcall region-extract-function)' and with its argument optional. What do you think about a new function like we added `region-bounds' in https://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00402.html (defun region (&optional arg) "Return the region content as a string. For non-contiguous regions return a list of strings." (funcall region-extract-function arg)) From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 09 07:28:44 2020 Received: (at 39512) by debbugs.gnu.org; 9 Aug 2020 11:28:44 +0000 Received: from localhost ([127.0.0.1]:60126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4jVM-0000wa-CB for submit@debbugs.gnu.org; Sun, 09 Aug 2020 07:28:44 -0400 Received: from quimby.gnus.org ([95.216.78.240]:34848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4jVJ-0000wM-Gq for 39512@debbugs.gnu.org; Sun, 09 Aug 2020 07:28:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bNMpi6a/KEVcMrICIEh+mEDR5ntY9TThtukj7s7jHMs=; b=lHBH86huR+U5/1m9icAcTZMZQT TTC8fklgu/9AI4+3j1pFQ2xVuLZ9s+mfc0GQ/6hsfh4/udf39QjfNOOn0aCiMV2x0+tcUj8OCO9Xv 4n4Yq/YCM+7ycbHxsgqU/0M15zhl4H68d9zG0pO/8bsY8zsl0cclOeRvHaRY9keENZsU=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4jUw-000185-Ho; Sun, 09 Aug 2020 13:28:24 +0200 From: Lars Ingebrigtsen To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> Date: Sun, 09 Aug 2020 13:28:16 +0200 In-Reply-To: <877e0wiosp.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 09 Feb 2020 02:31:50 +0200") Message-ID: <87v9hst5wv.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Juri Linkov writes: >> https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg01125.html >> https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00003.html >> >> Note that in those threads there were plenty of di [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: spacibba@aol.com, Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: >> https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg01125.html >> https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00003.html >> >> Note that in those threads there were plenty of discussions; here I'd >> like to focus just in this proposed command. If needed, I'd recommend >> to open further bugs to discuss about other commands. > > Thanks for creating a new feature request that unlike these discussions > on emacs-devel won't fall into oblivion. This was in February, though, and the patch still hasn't been applied. :-/ I think this addition makes sense... was there any particular reason it's not applied? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 09 19:30:23 2020 Received: (at 39512) by debbugs.gnu.org; 9 Aug 2020 23:30:23 +0000 Received: from localhost ([127.0.0.1]:33693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4ulj-0002Kj-5d for submit@debbugs.gnu.org; Sun, 09 Aug 2020 19:30:23 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:44279) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4ulh-0002K4-5v for 39512@debbugs.gnu.org; Sun, 09 Aug 2020 19:30:21 -0400 X-Originating-IP: 91.129.102.47 Received: from mail.gandi.net (m91-129-102-47.cust.tele2.ee [91.129.102.47]) (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 126C040003; Sun, 9 Aug 2020 23:30:11 +0000 (UTC) From: Juri Linkov To: Lars Ingebrigtsen Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> Date: Mon, 10 Aug 2020 02:23:59 +0300 In-Reply-To: <87v9hst5wv.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 09 Aug 2020 13:28:16 +0200") Message-ID: <87mu33zchk.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39512 Cc: spacibba@aol.com, Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> Thanks for creating a new feature request that unlike these discussions >> on emacs-devel won't fall into oblivion. > > This was in February, though, and the patch still hasn't been applied. :-/ > > I think this addition makes sense... was there any particular reason > it's not applied? I really don't see a need for adding isearch-yank-region. I think that isearch-forward-region proposed by Ergus should be sufficient because typing 'M-s M-.' (bound globally to isearch-forward-region) even when isearch mode is active, will exit Isearch and restart Isearch with the contents of the still active region added to the search string. This will cover all cases requested here with just one new command: (defun isearch-forward-region () "Do incremental search forward for text from the active region. Like ordinary incremental search except that text from the region is added to the search string initially if the region is active." (interactive) (isearch-forward nil 1) (cond ((use-region-p) (when (< (mark) (point)) (exchange-point-and-mark)) (isearch-yank-string (buffer-substring-no-properties (region-beginning) (region-end))) (deactivate-mark)) (t (setq isearch-error "No active region") (isearch-push-state) (isearch-update)))) (define-key search-map "\M-." 'isearch-forward-region) From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 09 21:20:08 2020 Received: (at 39512) by debbugs.gnu.org; 10 Aug 2020 01:20:08 +0000 Received: from localhost ([127.0.0.1]:33752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4wTw-0004rZ-Dp for submit@debbugs.gnu.org; Sun, 09 Aug 2020 21:20:08 -0400 Received: from sonic316-12.consmr.mail.bf2.yahoo.com ([74.6.130.122]:44452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k4wTt-0004qu-HJ for 39512@debbugs.gnu.org; Sun, 09 Aug 2020 21:20:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1597022400; bh=k7AahIZJxreQ9cDNkSvK1m/m7T+QQ/jZQ2A4EkTrUHI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=hssOQAoeut1O6frLru6UexH2Zb1zVW/p9QgOvXjfxcxb4+T2hEuUE6Ko7vHIggkm3Az/1mgcE4Gnpb2B2qMY6TJfduAGpeFDOT6dSCJ194IBlagPhSdYy5hEtdL0Pqjp/g+/T3lMlgaSPHyBYr5akoVZmBR9mK4GnF5WtPl/Oqe1p/C+hPDeA2oeg7rzyvkd6dTKdM9v2H70JmUSmHLycqdAhU+nEwsHOfWs5X6pNgEavTENDQHCz1JdfUb/H2Grozcc+0pzvFtFCi5ta/mxtT6cIPI7267qCzFBiBTkE0k7NhT8we/7lIPepsr2hx/j3Ssb3LRBDRVBUgeKZ3jTEw== X-YMail-OSG: Lubhy7wVM1mQsG3hwIUaPct_SUDdQFlAWaAFB0yKUDJr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ym7rE.3PcDA3 I0x_R.zkohEY9L87OhYmxl9mfz86T6Tc7s.eo_uADK.iek.Cd_YadcC8CYTlhulGZ9ipTTrMAohw gvoQR6l.oQ9kVHTi5LPtGVDFV3Id9dSoBqOE5tc03AM57d4bbXj55SXFcanI5.8qehK_4xaLvvxV 8gLvblMVPGi4BBfdz9U3ktFhICHkNDibRdytrudaFp4XeaKsTdamQ54B7rg9rK3U4orvqzEf2e9P 8LlmukhPiXiJRsKb6F.T4VtI0484rFrY0gI60AqK7Xklu2rZPpPe5TqxBG1ePTxtGyO_7VdX05Vi tLQzBcNxfkNl9vs2OQoB.Y3iZmrfGpnZf23hbJ0hW Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.bf2.yahoo.com with HTTP; Mon, 10 Aug 2020 01:20:00 +0000 Received: by smtp425.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID a7df0314bc331c1dd5cb49bfd66410bb; Mon, 10 Aug 2020 01:19:58 +0000 (UTC) Date: Mon, 10 Aug 2020 03:19:54 +0200 From: Ergus To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Message-ID: <20200810011954.ro4utplq3ohpob2d@Ergus> References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87mu33zchk.fsf@mail.linkov.net> X-Mailer: WebService/1.1.16436 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/11.0.7) Content-Length: 4101 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Mon, Aug 10, 2020 at 02:23:59AM +0300, Juri Linkov wrote: >>> Thanks for creating a new feature request that unlike these discussions >>> on emacs-devel won't fall into oblivion. >> >> This was in February, though, and the patch still hasn't been applied. :-/ >> >> I think this addition makes sense... was there any particular reason >> it's not applied? > >I really don't see a need for adding isearch-yank-region. I think that >isearch-forward-region proposed by Ergus should be sufficient because >typing 'M-s M-.' (bound globally to isearch-forward-region) even when >isearch mode is active, will exit Isearch and restart Isearch with the >contents of the still active region added to the search string. >This will cover all cases requested here with just one new command: > > (defun isearch-forward-region () > "Do incremental search forward for text from the active region. > Like ordinary incremental search except that text from the region > is added to the search string initially if the region is active." > (interactive) > (isearch-forward nil 1) > (cond > ((use-region-p) > (when (< (mark) (point)) > (exchange-point-and-mark)) > (isearch-yank-string > (buffer-substring-no-properties (region-beginning) (region-end))) > (deactivate-mark)) > (t > (setq isearch-error "No active region") > (isearch-push-state) > (isearch-update)))) > > (define-key search-map "\M-." 'isearch-forward-region) Hi Juri: I didn't add this command to vanilla at the end because there were many arguments about the bindings to use. And I consider that without a default binding it is pretty much useless for the general user. Now I am using swiper which has an improved version for thing-at-point (something like `thing-at-point-or-region` called `ivy-thing-at-point`) which actually is much more useful and avoids an extra binding. https://github.com/abo-abo/swiper/blob/c6b60d34ac37bf4d91a25f16d22e528f85e06938/ivy.el#L426 Implementing something like that in vanilla is (in my opinion) the best default behaviors for isearch-forward-symbol-at-point. But I don't want to go in that discussion in the mailing list because it is difficult to get an agreement what touching old commands. But you are free to do it if you want. Something more or less like this should work: (defcustom isearch-thing-at-point-use-region nil "isearch-forward-symbol-at-point use region when active." :type 'boolean) (defun bounds-thing-at-pt-or-region () "Return current 'thing-at-point' or region bounds" (and (not (nth 3 (syntax-ppss))) ;; global skip (cond ((and isearch-thing-at-point-use-region (region-active-p)) (let* ((beg (region-beginning)) (end (region-end)) (eol (save-excursion (goto-char beg) (line-end-position)))) (and (< beg end) ;; no empty region (<= end eol) ;; no multiline region (cons beg end)))) ((find-tag-default-bounds))))) (defun isearch-forward-symbol-at-point (&optional arg) "Do incremental search forward for a symbol found near point. Like ordinary incremental search except that the symbol found at point is added to the search string initially as a regexp surrounded by symbol boundary constructs \\_< and \\_>. See the command `isearch-forward-symbol' for more information. With a prefix argument, search for ARGth symbol forward if ARG is positive, or search for ARGth symbol backward if ARG is negative." (interactive "P") (isearch-forward-symbol nil 1) (let ((bounds (bounds-thing-at-pt-or-region)) (count (and arg (prefix-numeric-value arg)))) (cond (bounds (when (< (car bounds) (point)) (goto-char (car bounds))) (isearch-yank-string (buffer-substring-no-properties (car bounds) (cdr bounds))) (when count (isearch-repeat-forward count))) (t (if isearch-thing-at-point-use-region (setq isearch-error "No symbol at point or active region.") (setq isearch-error "No symbol at point")) (isearch-push-state) (isearch-update))))) Best, Ergus From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 10 13:00:24 2020 Received: (at 39512) by debbugs.gnu.org; 10 Aug 2020 17:00:24 +0000 Received: from localhost ([127.0.0.1]:37402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5B9s-00050V-8x for submit@debbugs.gnu.org; Mon, 10 Aug 2020 13:00:24 -0400 Received: from mail-ej1-f67.google.com ([209.85.218.67]:32972) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5B9q-0004ru-O5 for 39512@debbugs.gnu.org; Mon, 10 Aug 2020 13:00:23 -0400 Received: by mail-ej1-f67.google.com with SMTP id jp10so10149441ejb.0 for <39512@debbugs.gnu.org>; Mon, 10 Aug 2020 10:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=FhesNpJNgT7kHXbpxgtpqE3kRBLh1/UvGi1seJu5Elc=; b=Y9UPihwihWsevIQf1zhOa4WEwjflaLsFKFm7owY4QIMcg9wrnO8g3LMJo2zErm0fU+ nxga8nWhdF6kmnxE/f0oZRouIiIo5SK+1sAJxp2b5uRrexukJfhmhmOX+6IomfmYXGQo aJZcuALOusvGZgCzorn/aosLMtajVUSmac/Sc+9YE1BoSW2m7hTbZ56PtQ7D9HNouGga 55/KUW/jOLDdixWy0JRP3LNEt9ixwzjgnZoLgsiclZkEJ6nQgbkMf9wwGLsZ445cD1vZ JHBT9Na+L5djT1i2Iy0RIaenD6A30PUvXJvn65HO/l2XDtudBTygzJY1diZ22nNvWULM lkkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=FhesNpJNgT7kHXbpxgtpqE3kRBLh1/UvGi1seJu5Elc=; b=OCWj5Iwqfu+08HzHoyl83vgTe375TnX2ZxnO/CcJKQxmspVsK6w3lJg5eXfLLFA0ZP Umn/uku7XjyD/n72HkpaiNkWaQxsS2M1Z+amqGOw7byepOmWUCuCVmGbFG1mKV99nGKl AOXCkWPdIuP2GXoR/GoIBneomGdmLzYR504I7W5eLLmkYmcWRs/92/RI79FhgDaKXPux YhUMdg43C/XviGFBkp26FIGVjt5QPcz2oNvdr9RzjV/RrbtCJXwa8w9vKK6DgzDHtMVf aYQ3x/zPFVn2cnowY6KcakKfmAUzydEefQPi8pX4X/ZeuWOsAAD9BXHJ8082lHt6kar7 sQ/Q== X-Gm-Message-State: AOAM531g72olD4HcAn6OHwtmkzIgssyvvMAQmgcl07au4iH8lunK2wJD ycbgVDgWhZ6O3BE1yfqe3GY= X-Google-Smtp-Source: ABdhPJyvOR3QgWDsJF/v7aKtpPF0lxLeyr0KCZNTtA9AGCQVcUAsDAV7mOtuIzul3BmN79sMWxgD9g== X-Received: by 2002:a17:906:7e57:: with SMTP id z23mr22113303ejr.294.1597078816721; Mon, 10 Aug 2020 10:00:16 -0700 (PDT) Received: from [10.200.4.109] ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id b16sm12642159edy.73.2020.08.10.10.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2020 10:00:15 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Mon, 10 Aug 2020 19:00:10 +0200 (CEST) X-X-Sender: calancha@localhost.example.com To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region In-Reply-To: <87mu33zchk.fsf@mail.linkov.net> Message-ID: References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: spacibba@aol.com, Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Mon, 10 Aug 2020, Juri Linkov wrote: >> I think this addition makes sense... was there any particular reason >> it's not applied? > > I really don't see a need for adding isearch-yank-region. I think that > isearch-forward-region proposed by Ergus should be sufficient because > typing 'M-s M-.' (bound globally to isearch-forward-region) even when > isearch mode is active, will exit Isearch and restart Isearch with the > contents of the still active region added to the search string. > This will cover all cases requested here with just one new command: I am OK with this; it is a good addition. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 10 20:44:17 2020 Received: (at 39512) by debbugs.gnu.org; 11 Aug 2020 00:44:17 +0000 Received: from localhost ([127.0.0.1]:37965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5IOn-0006MK-Bu for submit@debbugs.gnu.org; Mon, 10 Aug 2020 20:44:17 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:50747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5IOl-0006Lu-Kq for 39512@debbugs.gnu.org; Mon, 10 Aug 2020 20:44:16 -0400 X-Originating-IP: 91.129.102.47 Received: from mail.gandi.net (m91-129-102-47.cust.tele2.ee [91.129.102.47]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id C4382C000A; Tue, 11 Aug 2020 00:44:06 +0000 (UTC) From: Juri Linkov To: Ergus Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> Date: Tue, 11 Aug 2020 02:49:44 +0300 In-Reply-To: <20200810011954.ro4utplq3ohpob2d@Ergus> (Ergus's message of "Mon, 10 Aug 2020 03:19:54 +0200") Message-ID: <87v9hqjb27.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Now I am using swiper which has an improved version for thing-at-point > (something like `thing-at-point-or-region` called `ivy-thing-at-point`) > which actually is much more useful and avoids an extra binding. > > https://github.com/abo-abo/swiper/blob/c6b60d34ac37bf4d91a25f16d22e528f85e06938/ivy.el#L426 > > Implementing something like that in vanilla is (in my opinion) the best > default behaviors for isearch-forward-symbol-at-point. But I don't want > to go in that discussion in the mailing list because it is difficult to > get an agreement what touching old commands. But you are free to do it > if you want. Indeed there are two ways to add it: as a new command (that requires a new keybinding) or a new option (disabled by default) for the existing command. Maybe we could enable it by default, but I don't know how it will affect the use cases of users - maybe someone users use isearch to extend the active region to the next matching symbol, and don't want 'M-s .' to yank the region. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 10 21:13:11 2020 Received: (at 39512) by debbugs.gnu.org; 11 Aug 2020 01:13:11 +0000 Received: from localhost ([127.0.0.1]:37989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5Iqk-000732-Ne for submit@debbugs.gnu.org; Mon, 10 Aug 2020 21:13:10 -0400 Received: from sonic314-14.consmr.mail.bf2.yahoo.com ([74.6.132.124]:37588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5Iqh-00072o-PK for 39512@debbugs.gnu.org; Mon, 10 Aug 2020 21:13:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1597108382; bh=mMeMJdLAixnjks8hTgKI1irtmpaPX773MT4AFT+xiZo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=L5fiXNQP1LPFzN79fmWaem3S5X72q0bmAbxu173Gx57nT3SDQSSW5dkr98dTHh2HgnpebjXYBhOFXBUiHQNInStpcZZaZmkGu/44EUEEDqMrfqHqlRXEIUyiyK0XAJ8kM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dyFwxEULJFPuI_ddWeMP4UXfw3rCHGWOX3djCNyYNxqM YamtsFlw5xODeVj95knF1NiE0o9oq.W8HEIhshmAnqFv7mAc5wO2Dalbr8mkBerrnyOI9TjMjnFP N0wwGEamvTa7FXtOaQuuN8Rrf8I2VwiGb0nzC..1YtsmNeFUewPiaRSuWL6XuaYw5qLwxojqI0Gd AY1L3NG3plDsB4kxLVAiBUH5hyXLWh_Zbp50OCpV3rfZRUr6AHR_SS_YDd0hJ..I0R4AIjntghrK ABF4qdxbkf__GZDWg9L9wqatosvg20._.HIwxglCYmyQDOb5f2SFIm2edmjo_b134CQg49k43TcL zT6rfZvUl7bETDep1qMK1xmgolXELQTYpJtenQCxB5kaMOGlB93DJcLvPTCAUSVhyW1DP4AJslBj MjfzL0.vh2yc9gdql.kmE22htx_JiaY1vS9.VQ1Gky2yReiCmz0QprKx1kLsDGiX4XSn4193pnmy nCuudIh2QoJjclADBnFXtiATiIYkHJz._jHDnsoiLykj1PhdnNAj1u05hsmxInNeztcXjmSDKNiJ L9kx81A9ooe6X.HhUMm5sDf0ifC2.2N6skN5XeDNDjBkpTgoborwHSs7POQknpzSsYcZPG659pKs gpQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.bf2.yahoo.com with HTTP; Tue, 11 Aug 2020 01:13:02 +0000 Received: by smtp413.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID fedb89c16096cb84fc8f576e83eb3472; Tue, 11 Aug 2020 01:12:56 +0000 (UTC) Date: Tue, 11 Aug 2020 03:12:46 +0200 From: Ergus To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Message-ID: <20200811011246.bcciofvpzjtuy3jb@Ergus> References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87v9hqjb27.fsf@mail.linkov.net> X-Mailer: WebService/1.1.16455 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/11.0.7) Content-Length: 1706 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, Aug 11, 2020 at 02:49:44AM +0300, Juri Linkov wrote: >> Now I am using swiper which has an improved version for thing-at-point >> (something like `thing-at-point-or-region` called `ivy-thing-at-point`) >> which actually is much more useful and avoids an extra binding. >> >> https://github.com/abo-abo/swiper/blob/c6b60d34ac37bf4d91a25f16d22e528f85e06938/ivy.el#L426 >> >> Implementing something like that in vanilla is (in my opinion) the best >> default behaviors for isearch-forward-symbol-at-point. But I don't want >> to go in that discussion in the mailing list because it is difficult to >> get an agreement what touching old commands. But you are free to do it >> if you want. > >Indeed there are two ways to add it: as a new command (that requires a new >keybinding) or a new option (disabled by default) for the existing command. >Maybe we could enable it by default, but I don't know how it will affect >the use cases of users - maybe someone users use isearch to extend the >active region to the next matching symbol, and don't want 'M-s .' to yank >the region. If the region is active but empty that functionality could make sense (extend to the next thing at point), but when it is not empty I think it doesn't make too much sense in general use... but let's wait for the rest of the opinions. Actually, probably such a function (thing-at-point-or-region) could be added to thing-at-pt to use it in other functionalities too. (like highlight thing at point, idle highlight thing at point or region, kill thing at point or region and so on) It is something I have seen re-implemented in many packages here and there again and again, so probably it is time to provide it in vanilla. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 11 19:19:14 2020 Received: (at 39512) by debbugs.gnu.org; 11 Aug 2020 23:19:14 +0000 Received: from localhost ([127.0.0.1]:41975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5dY2-0002Vt-BB for submit@debbugs.gnu.org; Tue, 11 Aug 2020 19:19:14 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:37219) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5dXz-0002Vd-7X for 39512@debbugs.gnu.org; Tue, 11 Aug 2020 19:19:13 -0400 Received: from mail.gandi.net (m91-129-102-47.cust.tele2.ee [91.129.102.47]) (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 878B124000B; Tue, 11 Aug 2020 23:19:02 +0000 (UTC) From: Juri Linkov To: Ergus Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> <20200811011246.bcciofvpzjtuy3jb@Ergus> Date: Wed, 12 Aug 2020 02:13:11 +0300 In-Reply-To: <20200811011246.bcciofvpzjtuy3jb@Ergus> (Ergus's message of "Tue, 11 Aug 2020 03:12:46 +0200") Message-ID: <87k0y4n5dk.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > If the region is active but empty that functionality could make sense > (extend to the next thing at point), but when it is not empty I think it > doesn't make too much sense in general use... but let's wait for the > rest of the opinions. Good point. ‘C-SPC M-s . C-s C-s ...’ means that the user wants to extend the region to one of the next found symbols. But still there is an unsolved problem: ‘M-s .’ activates the *symbol* search mode, not the default non-symbol search mode. This means that the yanked region will match only symbols, that is useless when the region is longer than one symbol (the symbol search is activated by the call of ‘isearch-forward-symbol’ in ‘isearch-forward-symbol-at-point’). This means there is still a need to add a new command that yanks the region but doesn't activate the symbol search mode. > Actually, probably such a function (thing-at-point-or-region) could be > added to thing-at-pt to use it in other functionalities too. (like > highlight thing at point, idle highlight thing at point or region, kill > thing at point or region and so on) > > It is something I have seen re-implemented in many packages here and > there again and again, so probably it is time to provide it in vanilla. Yes, this could be added to thing-at-pt. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 12 13:41:43 2020 Received: (at 39512) by debbugs.gnu.org; 12 Aug 2020 17:41:43 +0000 Received: from localhost ([127.0.0.1]:45456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5ukw-00067A-Qt for submit@debbugs.gnu.org; Wed, 12 Aug 2020 13:41:43 -0400 Received: from sonic304-9.consmr.mail.bf2.yahoo.com ([74.6.128.32]:45179) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5ukt-00066u-Nq for 39512@debbugs.gnu.org; Wed, 12 Aug 2020 13:41:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1597254094; bh=kRcMpNj7gdbaYMStDwslbD7LgdJG05akaZy6eW6QbfA=; h=Date:From:To:Cc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bbU4P1sLNDTDCs6LIGShCDiSEdzHkQqQUjD1zWU48QQfaFEZb4K9PiUP umr.iaAT_ngLhyQTEfWhck9q0teNP.LEulEo0J._uiQZ1EhiJh8nKLy8D_A5rdV3Jwjh.K4auIB6 vH7h9WnYTYAmzabD.WnQ7KlbMyGyxLo2ieB_4OREkWtud6Ug_vR3aocHeYO.x5l1gjaUnQU9NGJF UaRWQ.ubUYlENAKi3QI7HRoM1j1Mp_shcSjeyHYFXXgwesSfBlQwtJI4KD9bpYgr.i6KlB_sCOnn 0xr0x0xfGeVi8ngDc5qFaN.G3M5NwWbKKp__mZqfvIO4Vi.w0UjwYHXOHJ9uZUeNKKUsC57RzhaR iUzOWmeb_4UqMaYnXqfsle7AsXRVuwbSwElFOyz9CRMcZZHQmxQKDM9eIu9Qmwz_9zPJYcFfEjjq _KKl84ZvJqCBD88Sn46FpzEJUK7ePM6imcy.Larj4WkYsMjd4yK3ZLZw3.roO1PVTZA77dv_6a9u d.bDxABkXNIANu_a_hQr3uCx0RKqBDNHmfaTi2ABBU3SZdK78dw1KRpkLL83m14lKCxMHIrjl..g DIqU9yBdjA1jLgXDypyp6ONmHrRjg.857gvU4RU8Fwiy4Zmfr8Fu6yaT_bbiRs7ZARN0v8TSJNwF .7sDibw2c679_Z0sr3o08_E2yjCjYzMHNfgfzeesbcEZ98P6btAGl8aVWWtnamJwGKmC1mJMYNmf txjb6b3EVIG4NzQ.XGFB6L31FMP.tR21Uj2IUMXQQlNyFWepC2g2lDyzCV4wvvHOq_PAJkShxFWT vTw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Wed, 12 Aug 2020 17:41:34 +0000 Received: by smtp415.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 4581c3727821a420aa6b1e5cda06c06b; Wed, 12 Aug 2020 17:41:29 +0000 (UTC) Date: Wed, 12 Aug 2020 19:41:25 +0200 From: Ergus To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Message-ID: <20200812174125.gicbgyrz7nhsdjsi@Ergus> References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> <20200811011246.bcciofvpzjtuy3jb@Ergus> <87k0y4n5dk.fsf@mail.linkov.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87k0y4n5dk.fsf@mail.linkov.net> X-Mailer: WebService/1.1.16455 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/11.0.7) Content-Length: 2134 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Wed, Aug 12, 2020 at 02:13:11AM +0300, Juri Linkov wrote: >> If the region is active but empty that functionality could make sense >> (extend to the next thing at point), but when it is not empty I think it >> doesn't make too much sense in general use... but let's wait for the >> rest of the opinions. > >Good point. ‘C-SPC M-s . C-s C-s ...’ means that the user wants to >extend the region to one of the next found symbols. > >But still there is an unsolved problem: ‘M-s .’ activates the *symbol* >search mode, not the default non-symbol search mode. This means that >the yanked region will match only symbols, that is useless when the >region is longer than one symbol (the symbol search is activated by >the call of ‘isearch-forward-symbol’ in ‘isearch-forward-symbol-at-point’). > >This means there is still a need to add a new command that yanks the region >but doesn't activate the symbol search mode. > You are right; but... Does it really makes sense to call isearch-forward-symbol when the region is active and not empty if it works in the way we are describing? I mean; we could move the call to isearch-forward-symbol inside the cond and use just isearch-forward or isearch-forward-regexp directly when the bounds are from the active region. Because for isearch-forward-symbol there is already `M-s _` >> Actually, probably such a function (thing-at-point-or-region) could be >> added to thing-at-pt to use it in other functionalities too. (like >> highlight thing at point, idle highlight thing at point or region, kill >> thing at point or region and so on) >> >> It is something I have seen re-implemented in many packages here and >> there again and again, so probably it is time to provide it in vanilla. > >Yes, this could be added to thing-at-pt. If so, maybe it will be needed to return somehow the information about the precedence of the bounds. Anything that can be used in the caller to know if the bounds are from thing-at-pt or region or if they are a symbol, a word or a region. In C we could pass a variable by reference; but in elisp I don't know whats the convectional way. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 12 21:08:35 2020 Received: (at 39512) by debbugs.gnu.org; 13 Aug 2020 01:08:35 +0000 Received: from localhost ([127.0.0.1]:46188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k61jP-000444-Dn for submit@debbugs.gnu.org; Wed, 12 Aug 2020 21:08:35 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:33809) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k61jO-00043X-2K for 39512@debbugs.gnu.org; Wed, 12 Aug 2020 21:08:34 -0400 X-Originating-IP: 91.129.102.47 Received: from mail.gandi.net (m91-129-102-47.cust.tele2.ee [91.129.102.47]) (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id BA544E0002; Thu, 13 Aug 2020 01:08:24 +0000 (UTC) From: Juri Linkov To: Ergus Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> <20200811011246.bcciofvpzjtuy3jb@Ergus> <87k0y4n5dk.fsf@mail.linkov.net> <20200812174125.gicbgyrz7nhsdjsi@Ergus> Date: Thu, 13 Aug 2020 02:44:33 +0300 In-Reply-To: <20200812174125.gicbgyrz7nhsdjsi@Ergus> (Ergus's message of "Wed, 12 Aug 2020 19:41:25 +0200") Message-ID: <87h7t7ieqe.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Does it really makes sense to call isearch-forward-symbol when the > region is active and not empty if it works in the way we are describing? > > I mean; we could move the call to isearch-forward-symbol inside the cond > and use just isearch-forward or isearch-forward-regexp directly when the > bounds are from the active region. The problem is that the name of the command bound to 'M-s .' is isearch-forward-symbol-at-point that implies that it has to call isearch-forward-symbol. So not using symbol search on the active region will make a mess from this command. A cleaner solution would be to add a new non-symbol command with a name like isearch-forward-thing-at-point-or-region bound to 'M-s M-.' and based on thing-at-point-or-region. >>> Actually, probably such a function (thing-at-point-or-region) could be >>> added to thing-at-pt to use it in other functionalities too. (like >>> highlight thing at point, idle highlight thing at point or region, kill >>> thing at point or region and so on) >>> >>> It is something I have seen re-implemented in many packages here and >>> there again and again, so probably it is time to provide it in vanilla. >> >>Yes, this could be added to thing-at-pt. > > If so, maybe it will be needed to return somehow the information about > the precedence of the bounds. Anything that can be used in the caller to > know if the bounds are from thing-at-pt or region or if they are a > symbol, a word or a region. In the previous message you sent a link to `ivy-thing-at-point` that also uses (thing-at-point 'url) and also tries to get a filename at point. Do you think `thing-at-point-or-region` should do the same? From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 12 23:14:37 2020 Received: (at 39512) by debbugs.gnu.org; 13 Aug 2020 03:14:37 +0000 Received: from localhost ([127.0.0.1]:46432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k63hN-0007us-Ce for submit@debbugs.gnu.org; Wed, 12 Aug 2020 23:14:37 -0400 Received: from sonic310-15.consmr.mail.bf2.yahoo.com ([74.6.135.125]:36853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k63hK-0007ub-9E for 39512@debbugs.gnu.org; Wed, 12 Aug 2020 23:14:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1597288468; bh=xqOnpYTt6wFES0+JP2J9kznkydyMP5NvjN8ZjPZjBqk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=C7lMdFBRySUSiNc1LThUC9vxEuur7gz9910bF8aUJ4qCcqxUmQN+Bp7WWett+UfByz2263lga3tP0h/x3myOaP6L//bjRzV4BBonJYnL046Dvuydtek5HSz7Q2eq1SqdZbr2REhBrWbfLVtGKn3kpgT9rVp9/AIB9cMecuHVSIZuaRy3K4PWnNIj6VbrKeVXsJN/CpBMrkobmRzd+lFGeOX8yF2UjTnXjYF+/q/MDljvzUtPDm9dLqtsvM1jEMrO3wlkEiwvUmt/XaKJanb254esjv9nOynJnZcHgnf08dwfCuGyNuZI4C2Fty8Kulv8bOELwFye1vUl8Qe/UmEIWA== X-YMail-OSG: mmr77VsVM1mceh9coy1sZ7AI79l89Hz.QncJ8a4u4mbSOHIuk7XAAG4olS4BFLs 8u4_eZsSEECHj.QisxejRp805ZSf0_GX8cFPP.eho2WR4FgxFwa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6Q7wt.pn2DN.hZAuGy_.JCdyfQ 0BDHdsJbZilLBFj3p_5ICnC2PBeBFttcgvwOUG0k4WwMeYFKkkWbYUgUNxuavPseRACGT3jYMYg5 sdNOZzy5qhEcQaiMk8qiEa71g6HwvClgtgXt8vKUtEVmDZV5FFo3hBbHzCPFebb39PSkN69Ld6NT AC1fxtIOqeFGsz08E9nGO4sLLbd5q4SmSMv80ZMt6NmkwmwfSYoYWeAHkrk9mELWv9bZGicK_cGi Ayl2TL0ydLfV_Ss8GlV1z5gFiNfSaGlhuL9QKyLSAFv0- Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.bf2.yahoo.com with HTTP; Thu, 13 Aug 2020 03:14:28 +0000 Received: by smtp415.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID e27946aff0e2a6a1a57884c2cdb92589; Thu, 13 Aug 2020 03:14:27 +0000 (UTC) Date: Thu, 13 Aug 2020 05:14:20 +0200 From: Ergus To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Message-ID: <20200813031420.7vq5bz7loeqiuntx@Ergus> References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> <20200811011246.bcciofvpzjtuy3jb@Ergus> <87k0y4n5dk.fsf@mail.linkov.net> <20200812174125.gicbgyrz7nhsdjsi@Ergus> <87h7t7ieqe.fsf@mail.linkov.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87h7t7ieqe.fsf@mail.linkov.net> X-Mailer: WebService/1.1.16455 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/11.0.7) Content-Length: 1551 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, Aug 13, 2020 at 02:44:33AM +0300, Juri Linkov wrote: > >The problem is that the name of the command bound to 'M-s .' is >isearch-forward-symbol-at-point that implies that it has to call >isearch-forward-symbol. So not using symbol search on the active region >will make a mess from this command. > >A cleaner solution would be to add a new non-symbol command with a name like >isearch-forward-thing-at-point-or-region bound to 'M-s M-.' and based on >thing-at-point-or-region. > I would prefer using `M-s .` for consistency (even if it requires changing the command name). In swiper it works like that and it is very comfortable and consistent with the "expected" experience; but I understand that someone will complain for sure... (as usual) So without any other alternative, `M-s M-.` will be good enough. In general it would be better (for consistency) if we "reserve" `M-.` "suffixes" for future thing-at-point-or-region commands right? >In the previous message you sent a link to `ivy-thing-at-point` that >also uses (thing-at-point 'url) and also tries to get a filename at point. >Do you think `thing-at-point-or-region` should do the same? With the interactive experience in mind I think this could make sense as it does in `ivy-thing-at-point`. In my opinion from the api point of view, the important modification could be the method to know the "kind the thing" detected after calling the function (region, word, symbol, url) but also a function to get the bounds instead of the text (like bounds-of-thing-at-point-or-region). From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 15 17:02:28 2021 Received: (at 39512) by debbugs.gnu.org; 15 Apr 2021 21:02:28 +0000 Received: from localhost ([127.0.0.1]:39347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lX988-00021b-Dn for submit@debbugs.gnu.org; Thu, 15 Apr 2021 17:02:28 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:43999) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lX986-00021O-5H for 39512@debbugs.gnu.org; Thu, 15 Apr 2021 17:02:28 -0400 X-Originating-IP: 91.129.111.204 Received: from mail.gandi.net (m91-129-111-204.cust.tele2.ee [91.129.111.204]) (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 674C920003; Thu, 15 Apr 2021 21:02:16 +0000 (UTC) From: Juri Linkov To: Ergus Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> <20200811011246.bcciofvpzjtuy3jb@Ergus> <87k0y4n5dk.fsf@mail.linkov.net> <20200812174125.gicbgyrz7nhsdjsi@Ergus> <87h7t7ieqe.fsf@mail.linkov.net> <20200813031420.7vq5bz7loeqiuntx@Ergus> Date: Thu, 15 Apr 2021 23:52:03 +0300 In-Reply-To: <20200813031420.7vq5bz7loeqiuntx@Ergus> (Ergus's message of "Thu, 13 Aug 2020 05:14:20 +0200") Message-ID: <8735vrgx8p.fsf@linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > So without any other alternative, `M-s M-.` will be good enough. In > general it would be better (for consistency) if we "reserve" `M-.` > "suffixes" for future thing-at-point-or-region commands right? > >> In the previous message you sent a link to `ivy-thing-at-point` that >> also uses (thing-at-point 'url) and also tries to get a filename at point. >> Do you think `thing-at-point-or-region` should do the same? > > With the interactive experience in mind I think this could make sense as > it does in `ivy-thing-at-point`. > > In my opinion from the api point of view, the important modification > could be the method to know the "kind the thing" detected after calling > the function (region, word, symbol, url) but also a function to get the > bounds instead of the text (like bounds-of-thing-at-point-or-region). I continued trying to do what you suggested some time ago and immediately stumbled upon a question what "thing" to use by default as an argument of '(thing-at-point thing)'? Trying these priorities: (or (thing-at-point 'region) (thing-at-point 'url) ;; (thing-at-point 'filename) ;; (thing-at-point 'list) (thing-at-point 'symbol)) has several problems: 1. There is no such "thing" as 'region'. Maybe could be added to thingatpt.el? 2. 'url' returns nil when there is no url at point, good. But 'filename' returns non-nil on any string, not only on real filenames. 3. It would be nice to use (thing-at-point 'list) only when point is on the open/close parens. This is how double-clicking by mouse selects the thing at point of mouse click. When clicked on a paren, the whole list is selected by 'mouse-start-end'. 'isearch-forward-thing-at-point' could be the same logic. From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 18 11:34:28 2021 Received: (at 39512) by debbugs.gnu.org; 18 Apr 2021 15:34:28 +0000 Received: from localhost ([127.0.0.1]:47469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lY9RL-0003kg-N1 for submit@debbugs.gnu.org; Sun, 18 Apr 2021 11:34:28 -0400 Received: from sonic305-2.consmr.mail.bf2.yahoo.com ([74.6.133.41]:36096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lY9RK-0003kS-3x for 39512@debbugs.gnu.org; Sun, 18 Apr 2021 11:34:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1618760059; bh=ajQBKGwHebKybVSYgLJWChS6l6rSjC0S74E78PnPAws=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=AfWOZMogkMInnYw0b6M96Lp4WB/1pno17iNIsI30olrOQuY7e9ckDxOs4+DtOYjrZnqLFtRfAeERfFHFguyCN80zS87MdYFcy4otIKWakYPSaglk1LZZMyY6KWyLP0528AEpC/sXq3Wb1ACVPxFoBlNdPZSqxOiRnlOnzJBQRK/FEWOoJH+/PR7QO/Wc+EADtaAp17dl9ToEaP6gzyXaDrBixQaThdaJlXDfmFnprx5Hq6M5yb3iCnbBxxFGsMVqCgeFmSjAGjDacSvLOdAEx+NA4kXpNXgE7ep/gAMZDLbGz3o/sn3ns3PGLdUCvzAQs9/QGacYuA8ThebDkClqRg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1618760059; bh=9Mkwt9K2y4PjWgYamwtlwbWmEjPu6Mud4Lcg7SyGibY=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=dnu5w/sHK+FFNtYxIKWJs0Cyq0IVqHQrQuC+8IcfmgYoB7sdWLT6xDbEnPLb3X9XhKJ+ThAYjQC7pl23JM82VOqFDNihV17Q3Ltxi0gOKtZuUbxRbUgilb2Ytxd7CbtdvrjRfiJhJcKApX7hX6SGHhdlP0OCq5+HK5i4pQa6aD9YfEGHPNRcc1d7uq5cgGZxnv1fuXTRthan6JQkFoaROf7ciyucNSW2BEPRv/pODYPkHgWYnYOqULiDkn54gHDQFDVND/NANK2eXjHigd2jLJcucN+adrhxSWxfsYznXbpNGsggnB5OPjtH70HnPHxws5+qJYnNG8lJs1OJnU4VyQ== X-YMail-OSG: FbAI3FsVM1l4PTfUYOrsgTwLfS3py9KVXum4uiT89m40sKQQjoSP.g315GWb6pG .bMzkYvU_0YmvmyUUaAAIQDuQZpmWwJT.CCi42G.2sZYZAnzNu18QjrdEiKL2Jb679accwTgcKZW 2bHH8FVtzBgdI85Ak3PLvFvqt9uX9TlcIovwH1BsY6qVDWT90u31xzBn9L3YTPfsNxlbueiax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Nul jq_kHswSjWQsAvuYlePbzrXNcDKRF3tQALQKb575Mcu9uo0ni_z3gCFhARwCVBU4DSgXC8X4OPXx zVvVvjWKpWaMKqP22_EavX3pWKYOlaQmZ3NL9JTn07ZrsoYq9Z3YhFFzmQp5qyYWCc0FUvDIpSNq 316BrJOA9LmoIl78FgxgKYeTICjy0ngexq9DQMNpZZhFLC9bmp0HnfY3sZ7WOWTg5nxcgknKX3ju DGAXmTDk1JdqLlcRMnUJJ.5qekRIu0kbdAB.cR0zqZeVNZN11DjucHbhhqKzMZqRyU1GT8X.9pU8 db5nu_LDYiS8kso_eJ0MhXkkpGr8q7yRYZtIDE8JQH2zYai8Eum7WhfWCkmigjidLUDmmimW0aiy e5EcRssfX8jCL0HBr73kQwGjDXyXN0GLYe_xLD0CdVUiA5jWu5qoCK0l0nQdDzTJld4qf7gd1TaX .SeGf.zi8xvuFBsXN_BT5fPrbdqEQ7RebRGqTtcDo X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Sun, 18 Apr 2021 15:34:19 +0000 Received: by kubenode534.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 2eab219d0932526f0ec32f1a2cacaa70; Sun, 18 Apr 2021 15:34:17 +0000 (UTC) Date: Sun, 18 Apr 2021 17:34:00 +0200 From: Ergus To: Juri Linkov Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Message-ID: <20210418153400.vf5bum44i4zw72i7@Ergus> References: <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> <20200811011246.bcciofvpzjtuy3jb@Ergus> <87k0y4n5dk.fsf@mail.linkov.net> <20200812174125.gicbgyrz7nhsdjsi@Ergus> <87h7t7ieqe.fsf@mail.linkov.net> <20200813031420.7vq5bz7loeqiuntx@Ergus> <8735vrgx8p.fsf@linkov.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <8735vrgx8p.fsf@linkov.net> X-Mailer: WebService/1.1.18121 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Apache-HttpAsyncClient/4.1.4 (Java/16) Content-Length: 2906 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, Apr 15, 2021 at 11:52:03PM +0300, Juri Linkov wrote: >> So without any other alternative, `M-s M-.` will be good enough. In >> general it would be better (for consistency) if we "reserve" `M-.` >> "suffixes" for future thing-at-point-or-region commands right? >> >>> In the previous message you sent a link to `ivy-thing-at-point` that >>> also uses (thing-at-point 'url) and also tries to get a filename at point. >>> Do you think `thing-at-point-or-region` should do the same? >> >> With the interactive experience in mind I think this could make sense as >> it does in `ivy-thing-at-point`. >> >> In my opinion from the api point of view, the important modification >> could be the method to know the "kind the thing" detected after calling >> the function (region, word, symbol, url) but also a function to get the >> bounds instead of the text (like bounds-of-thing-at-point-or-region). > >I continued trying to do what you suggested some time ago >and immediately stumbled upon a question what "thing" >to use by default as an argument of '(thing-at-point thing)'? > >Trying these priorities: > >(or (thing-at-point 'region) > (thing-at-point 'url) > ;; (thing-at-point 'filename) > ;; (thing-at-point 'list) > (thing-at-point 'symbol)) > >has several problems: > >1. There is no such "thing" as 'region'. Maybe could be added to thingatpt.el? > This was actually the most important part in the request. Maybe an extra optional parameter like use-region could be added to bounds-of-thing-at-point that uses the active region when region-active-p or use-region-p. As I already mentioned; IMO the idea is to follow the same logic than here: https://github.com/abo-abo/swiper/blob/471d644d6bdd7d5dc6ca4efb405e6a6389dff245/ivy.el#L427 where `(thing-at-point 'region)` is basically the first branch in the cond. >2. 'url' returns nil when there is no url at point, good. But > 'filename' returns non-nil on any string, not only on real filenames. > 'filename' must match a local filename or a path... but it may be costly to check in the filesystem if the match is an existing file... specially when using tramp... so I don't have a solution for this. But the linked code uses some ffap api for that. >3. It would be nice to use (thing-at-point 'list) only when point > is on the open/close parens. This is how double-clicking by mouse > selects the thing at point of mouse click. When clicked on a paren, > the whole list is selected by 'mouse-start-end'. > 'isearch-forward-thing-at-point' could be the same logic. now I use C-M-SPC for this selection and then M-w to copy and C-s C-y. If you add the command, then it will save the M-w and the C-y to copy the region, because region will be already active... But will require the M-s prefix any way... so not 2 but at least 1 bind will be saved. You can consider this option in the future if you want... From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 20 16:39:26 2021 Received: (at 39512) by debbugs.gnu.org; 20 Apr 2021 20:39:26 +0000 Received: from localhost ([127.0.0.1]:56151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYx9Z-0001tw-Pf for submit@debbugs.gnu.org; Tue, 20 Apr 2021 16:39:26 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYx9X-0001ti-MY for 39512@debbugs.gnu.org; Tue, 20 Apr 2021 16:39:24 -0400 X-Originating-IP: 91.129.102.166 Received: from mail.gandi.net (m91-129-102-166.cust.tele2.ee [91.129.102.166]) (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 90F50E0008; Tue, 20 Apr 2021 20:39:14 +0000 (UTC) From: Juri Linkov To: Ergus Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> <20200811011246.bcciofvpzjtuy3jb@Ergus> <87k0y4n5dk.fsf@mail.linkov.net> <20200812174125.gicbgyrz7nhsdjsi@Ergus> <87h7t7ieqe.fsf@mail.linkov.net> <20200813031420.7vq5bz7loeqiuntx@Ergus> <8735vrgx8p.fsf@linkov.net> <20210418153400.vf5bum44i4zw72i7@Ergus> Date: Tue, 20 Apr 2021 23:29:47 +0300 In-Reply-To: <20210418153400.vf5bum44i4zw72i7@Ergus> (Ergus's message of "Sun, 18 Apr 2021 17:34:00 +0200") Message-ID: <87fszkbsxw.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39512 Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen , eliz@gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain >>(or (thing-at-point 'region) >> (thing-at-point 'url) >> ;; (thing-at-point 'filename) >> ;; (thing-at-point 'list) >> (thing-at-point 'symbol)) >> >>has several problems: >> >>1. There is no such "thing" as 'region'. Maybe could be added to thingatpt.el? >> > This was actually the most important part in the request. Maybe an extra > optional parameter like use-region could be added to > bounds-of-thing-at-point that uses the active region when > region-active-p or use-region-p. No need to add new arg, because the existing arg 'THING' can be used to accept another value 'region'. What I meant is just to add to thingatpt.el these 4 lines: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=bounds-of-thing-at-point-region.patch diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index c52fcfcc05..b9f7c116e3 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -604,6 +604,10 @@ thing-at-point-email-regexp (put 'buffer 'end-op (lambda () (goto-char (point-max)))) (put 'buffer 'beginning-op (lambda () (goto-char (point-min)))) +(put 'region 'bounds-of-thing-at-point + (lambda () + (when (use-region-p) + (cons (region-beginning) (region-end))))) ;; UUID --=-=-= Content-Type: text/plain > As I already mentioned; IMO the idea is to follow the same logic than here: > > https://github.com/abo-abo/swiper/blob/471d644d6bdd7d5dc6ca4efb405e6a6389dff245/ivy.el#L427 > > where `(thing-at-point 'region)` is basically the first branch in the > cond. `(thing-at-point 'region)` will work with the patch above. Then we could add a customizable user option to specify in what order the user wants to try things at point, e.g. `(region url file symbol)` >>3. It would be nice to use (thing-at-point 'list) only when point >> is on the open/close parens. This is how double-clicking by mouse >> selects the thing at point of mouse click. When clicked on a paren, >> the whole list is selected by 'mouse-start-end'. >> 'isearch-forward-thing-at-point' could be the same logic. > > now I use C-M-SPC for this selection and then M-w to copy and C-s > C-y. If you add the command, then it will save the M-w and the C-y to > copy the region, because region will be already active... But will > require the M-s prefix any way... so not 2 but at least 1 bind will be > saved. You can consider this option in the future if you want... Yes, this is a nice way to yank the next list to the search with just C-M-SPC M-. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 21 16:42:36 2021 Received: (at 39512) by debbugs.gnu.org; 21 Apr 2021 20:42:36 +0000 Received: from localhost ([127.0.0.1]:59917 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZJgB-0001zF-Rq for submit@debbugs.gnu.org; Wed, 21 Apr 2021 16:42:36 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:33107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZJg9-0001yz-VL; Wed, 21 Apr 2021 16:42:34 -0400 Received: from mail.gandi.net (m91-129-102-166.cust.tele2.ee [91.129.102.166]) (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id DF613200008; Wed, 21 Apr 2021 20:42:24 +0000 (UTC) From: Juri Linkov To: Ergus Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region Organization: LINKOV.NET References: <87v9hst5wv.fsf@gnus.org> <87mu33zchk.fsf@mail.linkov.net> <20200810011954.ro4utplq3ohpob2d@Ergus> <87v9hqjb27.fsf@mail.linkov.net> <20200811011246.bcciofvpzjtuy3jb@Ergus> <87k0y4n5dk.fsf@mail.linkov.net> <20200812174125.gicbgyrz7nhsdjsi@Ergus> <87h7t7ieqe.fsf@mail.linkov.net> <20200813031420.7vq5bz7loeqiuntx@Ergus> <8735vrgx8p.fsf@linkov.net> <20210418153400.vf5bum44i4zw72i7@Ergus> <87fszkbsxw.fsf@mail.linkov.net> Date: Wed, 21 Apr 2021 23:41:05 +0300 In-Reply-To: <87fszkbsxw.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 20 Apr 2021 23:29:47 +0300") Message-ID: <87tunz2wwu.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 39512 Cc: contovob@tcd.ie, Lars Ingebrigtsen , 39512@debbugs.gnu.org, npostavs@gmail.com, Tino Calancha X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) tags 39512 fixed close 39512 28.0.50 quit >>>(or (thing-at-point 'region) >>> (thing-at-point 'url) >>> ;; (thing-at-point 'filename) >>> ;; (thing-at-point 'list) >>> (thing-at-point 'symbol)) >>> > What I meant is just to add to thingatpt.el these 4 lines: > > +(put 'region 'bounds-of-thing-at-point > + (lambda () > + (when (use-region-p) > + (cons (region-beginning) (region-end))))) > >> As I already mentioned; IMO the idea is to follow the same logic than here: >> >> https://github.com/abo-abo/swiper/blob/471d644d6bdd7d5dc6ca4efb405e6a6389dff245/ivy.el#L427 >> >> where `(thing-at-point 'region)` is basically the first branch in the >> cond. > > `(thing-at-point 'region)` will work with the patch above. > Then we could add a customizable user option to specify > in what order the user wants to try things at point, e.g. > > `(region url file symbol)` Now pushed to master and closed. >> now I use C-M-SPC for this selection and then M-w to copy and C-s >> C-y. If you add the command, then it will save the M-w and the C-y to >> copy the region, because region will be already active... But will >> require the M-s prefix any way... so not 2 but at least 1 bind will be >> saved. You can consider this option in the future if you want... > > Yes, this is a nice way to yank the next list to the search with just > C-M-SPC M-s M-. Now works not only with 'C-M-SPC M-s M-.' but also with just 'M-s M-.' due to 'sexp' in the default value. From unknown Thu Sep 11 23:18:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 20 May 2021 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator