From: Yuri Khan <yuri.v.khan@gmail.com>
To: Barry Margolin <barmar@alum.mit.edu>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: automatic selection during search
Date: Tue, 1 Oct 2013 10:56:49 +0700 [thread overview]
Message-ID: <CAP_d_8UNV9R7f-kZchuDs3qOeoP=+sTXbU2wi3omKkMLHbeL6A@mail.gmail.com> (raw)
In-Reply-To: <barmar-2770F9.16054730092013@news.eternal-september.org>
On Tue, Oct 1, 2013 at 3:05 AM, Barry Margolin <barmar@alum.mit.edu> 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 “emacs -Q”.
Help | About Emacs
=> […] GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.6.4)
of 2013-04-09 on allspice, modified by Debian […]
C-x k RET
=> *scratch* buffer is current, with its default text:
===
;; 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.
===
M-: cua-mode
=> nil
M-: transient-mark-mode
=> t
M-: shift-select-mode
=> t
::: Test 1a :::
Using arrows, move the point before “This”.
C-SPACE
=> Mark set
Move point with arrows
=> selection extends
(expected, because of explicit request for persistent mark)
::: Test 1b :::
Move the point back before “This”.
C-SPACE C-s for
=> ;; [This buffer is for] notes you…
(expected, because of explicit request for persistent mark)
Move point with arrows
=> selection shrinks and extends
(expected)
C-SPACE C-SPACE
=> Mark set
=> Mark deactivated
::: Test 2a :::
Move point back before “This”.
S-<right>
=> ;; [T]his buffer…
Move point with arrows
=> selection deactivates
(expected, because the mark is transient)
::: Test 2b :::
Move point back before “This”.
Shift+Right arrow
=> ;; [T]his buffer…
C-s for
=> ;; [This buffer is for] notes you…
(unexpected, because the mark is transient and should be deactivated
by the cursor movement)
::: Test 3a :::
Move point back before “This”.
C-S-<right>
=> ;; [This] buffer…
C-<insert>
=> ;; This| buffer…
(ok, maybe it’s customary in non-cua land)
C-s for
=> ;; This buffer is for| notes you…
::: Test 3b :::
M-x cua-mode
=> Cua mode enabled
Move point back before “This”.
C-S-<right>
=> ;; [This] buffer…
C-c
=> ;; This| buffer…
(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
=> ;; This buffer is for| notes you…
::: Test 3c :::
(still in cua-mode)
M-x set-variable cua-keep-region-after-copy t
Move point back before “This”.
C-S-<right>
=> ;; [This] buffer…
C-c
=> ;; [This] buffer…
(now things are the way I am used to)
C-s for
=> ;; [This buffer is for] notes you…
(unexpected, because the mark is transient and C-s is a cursor movement command)
::: Test 3d :::
(still in cua-mode, with cua-keep-region-after-copy set to t)
Move point back before “This”.
C-S-<right>
=> ;; [This] buffer…
C-c
=> ;; [This] buffer…
Move point with arrow keys
=> 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:
===
(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’t have an
explicit persistent mark
(cua--deactivate)))
===
The question remains why Peter Dyballa mentioned C-INSERT as one of
the keys not to press before C-s.
next prev parent reply other threads:[~2013-10-01 3:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 6:38 automatic selection during search Bostjan Vilfan
2013-09-25 14:52 ` Peter Dyballa
2013-09-25 15:22 ` Drew Adams
2013-09-26 3:51 ` Yuri Khan
2013-09-26 8:38 ` Peter Dyballa
2013-09-26 9:08 ` Tassilo Horn
[not found] ` <mailman.2906.1380186548.10748.help-gnu-emacs@gnu.org>
2013-09-26 14:46 ` Barry Margolin
[not found] ` <mailman.2924.1380210221.10748.help-gnu-emacs@gnu.org>
2013-09-26 17:17 ` Barry Margolin
[not found] ` <mailman.2941.1380216751.10748.help-gnu-emacs@gnu.org>
2013-09-26 18:53 ` Barry Margolin
[not found] ` <<barmar-B00378.13172226092013@news.eternal-september.org>
2013-09-26 17:32 ` Drew Adams
2013-09-26 18:44 ` Peter Dyballa
[not found] ` <<barmar-A2B1E2.10465526092013@news.eternal-september.org>
2013-09-26 15:43 ` Drew Adams
2013-09-26 16:01 ` Yuri Khan
2013-09-26 17:27 ` Stefan Monnier
[not found] ` <mailman.2894.1380167482.10748.help-gnu-emacs@gnu.org>
2013-09-30 19:59 ` Kai Grossjohann
2013-09-30 20:05 ` Barry Margolin
2013-10-01 3:56 ` Yuri Khan [this message]
2013-10-01 12:47 ` Stefan Monnier
2013-09-25 15:40 ` Eli Zaretskii
[not found] ` <mailman.2858.1380123666.10748.help-gnu-emacs@gnu.org>
2013-09-25 15:51 ` Barry Margolin
[not found] <<CAAm34zryY6rrua7nQGHXAgHvofjTkOob9Eet9t9LcJ=Xw2bZ5A@mail.gmail.com>
[not found] ` <<83a9j0hptk.fsf@gnu.org>
2013-09-25 16:25 ` Drew Adams
[not found] <mailman.2845.1380113901.10748.help-gnu-emacs@gnu.org>
2013-09-27 6:26 ` bjvilfan
2013-09-27 15:20 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAP_d_8UNV9R7f-kZchuDs3qOeoP=+sTXbU2wi3omKkMLHbeL6A@mail.gmail.com' \
--to=yuri.v.khan@gmail.com \
--cc=barmar@alum.mit.edu \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.