From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#39512: 28.0.50; Add command isearch-yank-region Date: Sun, 09 Feb 2020 12:21:10 +0100 Message-ID: <87blq82ehl.fsf@calancha-pc.dy.bbexcite.jp> References: <87eev52bw6.fsf@calancha-pc.dy.bbexcite.jp> <877e0wiosp.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="125034"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: spacibba@aol.com, npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 09 12:22:12 2020 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 1j0kfD-000WRN-W3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Feb 2020 12:22:12 +0100 Original-Received: from localhost ([::1]:49556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0kfD-0006Cu-1q for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Feb 2020 06:22:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40170) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0kf5-0006Co-CW for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2020 06:22:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j0kf4-0006oA-94 for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2020 06:22:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46178) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j0kf4-0006nu-5x for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2020 06:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j0kf4-00063J-2F for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2020 06:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Feb 2020 11:22:02 +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.158124728623222 (code B ref 39512); Sun, 09 Feb 2020 11:22:02 +0000 Original-Received: (at 39512) by debbugs.gnu.org; 9 Feb 2020 11:21:26 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <877e0wiosp.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 09 Feb 2020 02:31:50 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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:175820 Archived-At: 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.