From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#39512: 28.0.50; Add command isearch-yank-region Date: Tue, 20 Apr 2021 23:29:47 +0300 Organization: LINKOV.NET Message-ID: <87fszkbsxw.fsf@mail.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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27988"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Tino Calancha , npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie, Lars Ingebrigtsen To: Ergus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 20 22:40:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYxAJ-00078Z-Qx for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Apr 2021 22:40:11 +0200 Original-Received: from localhost ([::1]:54910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYxAI-00055J-Us for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Apr 2021 16:40:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYxAA-00055A-C3 for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2021 16:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYxAA-0007SY-3j for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2021 16:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYxA9-0001um-VR for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2021 16:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Apr 2021 20:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39512 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 39512-submit@debbugs.gnu.org id=B39512.16189511667316 (code B ref 39512); Tue, 20 Apr 2021 20:40:01 +0000 Original-Received: (at 39512) by debbugs.gnu.org; 20 Apr 2021 20:39:26 +0000 Original-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 Original-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 Original-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) In-Reply-To: <20210418153400.vf5bum44i4zw72i7@Ergus> (Ergus's message of "Sun, 18 Apr 2021 17:34:00 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:204551 Archived-At: --=-=-= 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-. --=-=-=--