From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: automatic selection during search Date: Tue, 1 Oct 2013 10:56:49 +0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1380599821 16690 80.91.229.3 (1 Oct 2013 03:57:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Oct 2013 03:57:01 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Barry Margolin Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 01 05:57:05 2013 Return-path: Envelope-to: geh-help-gnu-emacs@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 1VQr56-00063v-1O for geh-help-gnu-emacs@m.gmane.org; Tue, 01 Oct 2013 05:57:04 +0200 Original-Received: from localhost ([::1]:52606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQr55-0000tN-DO for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Sep 2013 23:57:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQr4u-0000t6-TV for help-gnu-emacs@gnu.org; Mon, 30 Sep 2013 23:56:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VQr4t-00038A-Pv for help-gnu-emacs@gnu.org; Mon, 30 Sep 2013 23:56:52 -0400 Original-Received: from mail-la0-x233.google.com ([2a00:1450:4010:c03::233]:51970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQr4t-000385-Cw for help-gnu-emacs@gnu.org; Mon, 30 Sep 2013 23:56:51 -0400 Original-Received: by mail-la0-f51.google.com with SMTP id es20so5218155lab.24 for ; Mon, 30 Sep 2013 20:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=k9AJFPD3UX4X8GvDYXzsGTvX1YG7QE8W00iusxK2r2c=; b=eQtP04EeT78Tm9akP8CWd8pv9nYrgvdObB2x3wc/oorQwdjTgDaZbc6AEEm/yURz0W I6tIl3ABPhd5WEAkyCQ0ZYYPk653RRCC60VbrpIUpX0j8t6GSBO5XlU7thXFVJI81iF9 UOgQHigRHxNKj0BxQFCdZRLIkIqFzUUdW0eJr1YoG0hZKi7+dwymWkBfL+NjPgj84hiv MZUiaTYOKQfDKyFJ1qRLmlrVnLsOobos/rfrJYfUNeXE1r8eSX+SUrz4ySHEEA3zOzkx QMZ2zXjkGPbidPB7DaNNlIqf5ZtqJ1V2zKDt6MvhDhmGV7hemzWy2q945nJsk8W7aXSE BKeg== X-Received: by 10.152.87.143 with SMTP id ay15mr23161354lab.2.1380599809324; Mon, 30 Sep 2013 20:56:49 -0700 (PDT) Original-Received: by 10.114.185.101 with HTTP; Mon, 30 Sep 2013 20:56:49 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: vb_lfOiwlR9lpJvOBIp15mkDBTE X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::233 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93766 Archived-At: On Tue, Oct 1, 2013 at 3:05 AM, Barry Margolin wrote: >> C-space, C-s foo RET >> >> Now you have marked the region between where you were and the next "foo"= , so >> you can kill it or copy it. >> >> This is the use case that get supported by C-s not disabling the mark. = Maybe >> you don't need it. > > That's the case he says he "understands". His post is about a different > situation, where he first copies to the clipboard and then starts a new > search. > > But no one else seems to be able to reproduce this behavior. OK, recipes. I start =E2=80=9Cemacs -Q=E2=80=9D. Help | About Emacs =3D> [=E2=80=A6] GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.6.4) of 2013-04-09 on allspice, modified by Debian [=E2=80=A6] C-x k RET =3D> *scratch* buffer is current, with its default text: =3D=3D=3D ;; This buffer is for notes you don't want to save, and for Lisp evaluation= . ;; If you want to create a file, visit that file with C-x C-f, ;; then enter the text in that file's own buffer. =3D=3D=3D M-: cua-mode =3D> nil M-: transient-mark-mode =3D> t M-: shift-select-mode =3D> t ::: Test 1a ::: Using arrows, move the point before =E2=80=9CThis=E2=80=9D. C-SPACE =3D> Mark set Move point with arrows =3D> selection extends (expected, because of explicit request for persistent mark) ::: Test 1b ::: Move the point back before =E2=80=9CThis=E2=80=9D. C-SPACE C-s for =3D> ;; [This buffer is for] notes you=E2=80=A6 (expected, because of explicit request for persistent mark) Move point with arrows =3D> selection shrinks and extends (expected) C-SPACE C-SPACE =3D> Mark set =3D> Mark deactivated ::: Test 2a ::: Move point back before =E2=80=9CThis=E2=80=9D. S- =3D> ;; [T]his buffer=E2=80=A6 Move point with arrows =3D> selection deactivates (expected, because the mark is transient) ::: Test 2b ::: Move point back before =E2=80=9CThis=E2=80=9D. Shift+Right arrow =3D> ;; [T]his buffer=E2=80=A6 C-s for =3D> ;; [This buffer is for] notes you=E2=80=A6 (unexpected, because the mark is transient and should be deactivated by the cursor movement) ::: Test 3a ::: Move point back before =E2=80=9CThis=E2=80=9D. C-S- =3D> ;; [This] buffer=E2=80=A6 C- =3D> ;; This| buffer=E2=80=A6 (ok, maybe it=E2=80=99s customary in non-cua land) C-s for =3D> ;; This buffer is for| notes you=E2=80=A6 ::: Test 3b ::: M-x cua-mode =3D> Cua mode enabled Move point back before =E2=80=9CThis=E2=80=9D. C-S- =3D> ;; [This] buffer=E2=80=A6 C-c =3D> ;; This| buffer=E2=80=A6 (unexpected, and not what I experience in my usual configuration. Turns out I have (setq cua-keep-region-after-copy t) in my .emacs.d/init.el) C-s for =3D> ;; This buffer is for| notes you=E2=80=A6 ::: Test 3c ::: (still in cua-mode) M-x set-variable cua-keep-region-after-copy t Move point back before =E2=80=9CThis=E2=80=9D. C-S- =3D> ;; [This] buffer=E2=80=A6 C-c =3D> ;; [This] buffer=E2=80=A6 (now things are the way I am used to) C-s for =3D> ;; [This buffer is for] notes you=E2=80=A6 (unexpected, because the mark is transient and C-s is a cursor movement com= mand) ::: Test 3d ::: (still in cua-mode, with cua-keep-region-after-copy set to t) Move point back before =E2=80=9CThis=E2=80=9D. C-S- =3D> ;; [This] buffer=E2=80=A6 C-c =3D> ;; [This] buffer=E2=80=A6 Move point with arrow keys =3D> selection is cleared ----- OK, so cua-mode is not the reason. Neither is copying (aside from the fact that it clears selection by default). My current understanding is that C-s never clears selection, even in transient-mark-mode (and I consider this a bug). So, when I copy something, it remains selected (because of cua-keep-region-after-copy), and then C-s extends selection. The crude workaround that I am able to come up with, without having to read and understand all of isearch, is the following advice: =3D=3D=3D (defadvice isearch-search-string (after yk-isearch-transient (string bound noerror) activate) (when (and ad-return-value ;; isearch found something transient-mark-mode ;; and we are in transient-mark-mode (not cua--explicit-region-start)) ;; and don=E2=80=99t have an explicit persistent mark (cua--deactivate))) =3D=3D=3D The question remains why Peter Dyballa mentioned C-INSERT as one of the keys not to press before C-s.