From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robert Weiner Newsgroups: gmane.emacs.devel Subject: Re: How to get a fixed search string into the editable area of an isearch. Date: Sat, 4 Jun 2016 18:42:10 -0400 Message-ID: References: <871t4cd58e.fsf@mail.linkov.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c092ea2810b6d05347b8e3c X-Trace: ger.gmane.org 1465094208 2529 80.91.229.3 (5 Jun 2016 02:36:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 5 Jun 2016 02:36:48 +0000 (UTC) Cc: emacs-devel To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 05 04:36:43 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b9Nvd-0003Rl-PN for ged-emacs-devel@m.gmane.org; Sun, 05 Jun 2016 04:36:42 +0200 Original-Received: from localhost ([::1]:35013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9Nvc-0002pB-3m for ged-emacs-devel@m.gmane.org; Sat, 04 Jun 2016 22:36:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9KHH-0004zF-Bw for emacs-devel@gnu.org; Sat, 04 Jun 2016 18:42:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9KHD-0005A2-89 for emacs-devel@gnu.org; Sat, 04 Jun 2016 18:42:46 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:46095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9KHD-000599-4N for emacs-devel@gnu.org; Sat, 04 Jun 2016 18:42:43 -0400 Original-Received: from mail-oi0-f44.google.com ([209.85.218.44]:33406) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b9KHA-0004Wq-OA for emacs-devel@gnu.org; Sat, 04 Jun 2016 18:42:40 -0400 Original-Received: by mail-oi0-f44.google.com with SMTP id k23so177463615oih.0 for ; Sat, 04 Jun 2016 15:42:40 -0700 (PDT) X-Gm-Message-State: ALyK8tJ1Q5yUVaC2jCbm9X+FOoKnIsKZcHNJjp0SL0oRiABYEkQq/GAjQQHq/iVD00ScCEJn3KIuVSO/J4Lpeg== X-Received: by 10.202.239.197 with SMTP id n188mr5324621oih.25.1465080159990; Sat, 04 Jun 2016 15:42:39 -0700 (PDT) Original-Received: by 10.202.205.17 with HTTP; Sat, 4 Jun 2016 15:42:10 -0700 (PDT) In-Reply-To: <871t4cd58e.fsf@mail.linkov.net> X-Gmail-Original-Message-ID: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Mailman-Approved-At: Sat, 04 Jun 2016 22:36:04 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204200 Archived-At: --94eb2c092ea2810b6d05347b8e3c Content-Type: text/plain; charset=UTF-8 On Sat, Jun 4, 2016 at 5:46 PM, Juri Linkov wrote: > > Maybe this is what you need? > > (defun isearch-for-string () > (interactive) > (isearch-forward nil 1) > (isearch-yank-string "test")) > Thank you. That is a nice clean-looking solution. I had tried isearch-yank-string but missed the recursive-minibuffer argument to the isearch-forward, without which it doesn't work at all which led me to think that isearch-yank-string was not the right approach. The only limitation with this solution is that if you start to delete search characters, the entire search string provided to the yank is deleted at once rather than character by character. A pretty minor limitation which is resolved by the first solution, using unread-command-events. Thanks to all, these have been very helpful and definitely should find some place in the isearch documentation. Bob --94eb2c092ea2810b6d05347b8e3c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On S= at, Jun 4, 2016 at 5:46 PM, Juri Linkov <juri@linkov.net> wrot= e:

Maybe this= is what you need?

=C2=A0 (defun isearch-for-string ()
=C2=A0 =C2=A0 (interactive)
=C2=A0 =C2=A0 (isearch-forward nil 1)
=C2=A0 =C2=A0 (isearch-yank-string "test"))
=
Thank you.=C2=A0 That is a nice clean-looking solution.=C2= =A0 I had tried isearch-yank-string but missed the recursive-minibuffer arg= ument to the isearch-forward, without which it doesn't work at all whic= h led me to think that isearch-yank-string was not the right approach.=C2= =A0 The only limitation with this solution is that if you start to delete s= earch characters, the entire search string provided to the yank is deleted = at once rather than character by character.=C2=A0 A pretty minor limitation= which is resolved by the first solution, using unread-command-events.

Thanks to all, these have been very helpful and defini= tely should find some place in the isearch documentation.

Bob


--94eb2c092ea2810b6d05347b8e3c--