* automatic selection during search
@ 2013-09-25 6:38 Bostjan Vilfan
2013-09-25 14:52 ` Peter Dyballa
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Bostjan Vilfan @ 2013-09-25 6:38 UTC (permalink / raw)
To: Emacs Help
Hello,
In using emacs I'm encountering a problem that I find quite irritating:
(very) frequently when *I start a search with Ctrl-s*, the region from the
current position of the cursor to the location of searched for item gets
selected (colored). Does anyone know how to avoid this unwanted selection?
emacs version:24.3.1 running on Windows 7
Regards,
bostjan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
2013-09-25 6:38 Bostjan Vilfan
@ 2013-09-25 14:52 ` Peter Dyballa
2013-09-25 15:22 ` Drew Adams
` (2 more replies)
2013-09-25 15:40 ` Eli Zaretskii
[not found] ` <mailman.2858.1380123666.10748.help-gnu-emacs@gnu.org>
2 siblings, 3 replies; 23+ messages in thread
From: Peter Dyballa @ 2013-09-25 14:52 UTC (permalink / raw)
To: Bostjan Vilfan; +Cc: Emacs Help
Am 25.09.2013 um 08:38 schrieb Bostjan Vilfan:
> Does anyone know how to avoid this unwanted selection?
Don't press C-SPACE or C-@ or C-INSERT before pressing C-s!
--
Greetings
Pete
"My goal is to be a meteorologist. But since I have no training in meteorology, I suppose I should try stock brokerage."
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: automatic selection during search
2013-09-25 14:52 ` Peter Dyballa
@ 2013-09-25 15:22 ` Drew Adams
2013-09-26 3:51 ` Yuri Khan
[not found] ` <mailman.2894.1380167482.10748.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 23+ messages in thread
From: Drew Adams @ 2013-09-25 15:22 UTC (permalink / raw)
To: Peter Dyballa, Bostjan Vilfan; +Cc: Emacs Help
> > Does anyone know how to avoid this unwanted selection?
>
> Don't press C-SPACE or C-@ or C-INSERT before pressing C-s!
And if you are not hitting such a key before using `C-s', then it's
likely that something in your init file (~/.emacs) is causing this.
It should not happen if you start Emacs without your init file:
`emacs -Q'.
If there is no such problem with `emacs -Q' then bisect your init file
recursively until you locate the culprit code: comment out half of it,
then 1/4, then 1/8,... until you narrow it down. You can use command
`comment-region' to comment and uncomment (with `C-u') the region.
(I bind it to `C-;'.)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
2013-09-25 6:38 Bostjan Vilfan
2013-09-25 14:52 ` Peter Dyballa
@ 2013-09-25 15:40 ` Eli Zaretskii
[not found] ` <mailman.2858.1380123666.10748.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 23+ messages in thread
From: Eli Zaretskii @ 2013-09-25 15:40 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Wed, 25 Sep 2013 08:38:30 +0200
> From: Bostjan Vilfan <bjvilfan@gmail.com>
>
> In using emacs I'm encountering a problem that I find quite irritating:
> (very) frequently when *I start a search with Ctrl-s*, the region from the
> current position of the cursor to the location of searched for item gets
> selected (colored). Does anyone know how to avoid this unwanted selection?
Turn off transient-mark-mode. In your ~/.emacs:
(setq-default transient-mark-mode nil)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
[not found] ` <mailman.2858.1380123666.10748.help-gnu-emacs@gnu.org>
@ 2013-09-25 15:51 ` Barry Margolin
0 siblings, 0 replies; 23+ messages in thread
From: Barry Margolin @ 2013-09-25 15:51 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.2858.1380123666.10748.help-gnu-emacs@gnu.org>,
Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Wed, 25 Sep 2013 08:38:30 +0200
> > From: Bostjan Vilfan <bjvilfan@gmail.com>
> >
> > In using emacs I'm encountering a problem that I find quite irritating:
> > (very) frequently when *I start a search with Ctrl-s*, the region from the
> > current position of the cursor to the location of searched for item gets
> > selected (colored). Does anyone know how to avoid this unwanted selection?
>
> Turn off transient-mark-mode. In your ~/.emacs:
>
> (setq-default transient-mark-mode nil)
That seems like overkill.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: automatic selection during search
[not found] ` <<83a9j0hptk.fsf@gnu.org>
@ 2013-09-25 16:25 ` Drew Adams
0 siblings, 0 replies; 23+ messages in thread
From: Drew Adams @ 2013-09-25 16:25 UTC (permalink / raw)
To: Eli Zaretskii, help-gnu-emacs
> > In using emacs I'm encountering a problem that I find quite irritating:
> > (very) frequently when *I start a search with Ctrl-s*, the region from the
> > current position of the cursor to the location of searched for item gets
> > selected (colored). Does anyone know how to avoid this unwanted selection?
>
> Turn off transient-mark-mode. In your ~/.emacs:
> (setq-default transient-mark-mode nil)
Hm. Sorry, I disagree. That is, you should not need to do that.
Again, please try from `emacs -Q'. I'm betting you will not see the problem
in that case. My crystal ball tells me that something in other code you are
loading is responsible for this.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
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
[not found] ` <mailman.2894.1380167482.10748.help-gnu-emacs@gnu.org>
2 siblings, 1 reply; 23+ messages in thread
From: Yuri Khan @ 2013-09-26 3:51 UTC (permalink / raw)
To: Peter Dyballa; +Cc: Bostjan Vilfan, Emacs Help
On Wed, Sep 25, 2013 at 9:52 PM, Peter Dyballa <Peter_Dyballa@web.de> wrote:
> Don't press C-SPACE or C-@ or C-INSERT before pressing C-s!
I understand the reason C-SPACE and C-@ cause that, but copying to
clipboard? Why?
My use case is: I copy something to clipboard and want to teleport to
a different place and paste it there. When I use usual cursor movement
keys (arrows, PgUp/Dn) the selection is deactivated so I expect C-s to
behave similarly.
Is there a customizable option to make C-s not extend selection after copy?
(Yes, I use cua-mode and transient-mark-mode and CUA terminology and
arrow keys for navigation.)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
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>
0 siblings, 2 replies; 23+ messages in thread
From: Peter Dyballa @ 2013-09-26 8:38 UTC (permalink / raw)
To: Yuri Khan; +Cc: Bostjan Vilfan, Emacs Help
Am 26.09.2013 um 05:51 schrieb Yuri Khan:
> Is there a customizable option to make C-s not extend selection after copy?
>
> (Yes, I use cua-mode and transient-mark-mode and CUA terminology and
> arrow keys for navigation.)
Me, I don't know one. I used cua-mode for a short period and then I decided: NEVER AGAIN! It showed (possibly) side-effects I could not understand, and neither accept.
But, the same behaviour is also shown in emacs -Q: When something is selected and the point is inside this selection and you start isearch, then the selection is automatically extended. I could imagine that an isearch hook could help which first switches off the selection…
--
Greetings
Pete (:
_ / __ - -
_/ \__/_/ - -
(´`) (´`) - -
`´ `´
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
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>
1 sibling, 0 replies; 23+ messages in thread
From: Tassilo Horn @ 2013-09-26 9:08 UTC (permalink / raw)
To: Peter Dyballa; +Cc: Bostjan Vilfan, Emacs Help, Yuri Khan
Peter Dyballa <Peter_Dyballa@web.de> writes:
> But, the same behaviour is also shown in emacs -Q: When something is
> selected and the point is inside this selection and you start isearch,
> then the selection is automatically extended. I could imagine that an
> isearch hook could help which first switches off the selection…
Yes,
(add-hook 'isearch-mode-hook 'deactivate-mark)
seems to do the trick.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
[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 18:44 ` Peter Dyballa
[not found] ` <<barmar-A2B1E2.10465526092013@news.eternal-september.org>
1 sibling, 2 replies; 23+ messages in thread
From: Barry Margolin @ 2013-09-26 14:46 UTC (permalink / raw)
To: help-gnu-emacs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]
In article <mailman.2906.1380186548.10748.help-gnu-emacs@gnu.org>,
Tassilo Horn <tsdh@gnu.org> wrote:
> Peter Dyballa <Peter_Dyballa@web.de> writes:
>
> > But, the same behaviour is also shown in emacs -Q: When something is
> > selected and the point is inside this selection and you start isearch,
> > then the selection is automatically extended. I could imagine that an
> > isearch hook could help which first switches off the selection…
>
> Yes,
>
> (add-hook 'isearch-mode-hook 'deactivate-mark)
>
> seems to do the trick.
That will break the common sequence C-@ C-s which *should* mark the
region from where you started to where the search completes.
The OP wants to deactivate the region if he searches after copying to
the clipboard, not every time he does a search.
If this happens automatically when using cursor movement commands, it
seems like a bug if it doesn't also happen when doing a search.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: automatic selection during search
[not found] ` <<barmar-A2B1E2.10465526092013@news.eternal-september.org>
@ 2013-09-26 15:43 ` Drew Adams
2013-09-26 16:01 ` Yuri Khan
0 siblings, 1 reply; 23+ messages in thread
From: Drew Adams @ 2013-09-26 15:43 UTC (permalink / raw)
To: Barry Margolin, help-gnu-emacs
> > > But, the same behaviour is also shown in emacs -Q: When something is
> > > selected and the point is inside this selection and you start isearch,
> > > then the selection is automatically extended. I could imagine that an
> > > isearch hook could help which first switches off the selection…
> >
> > Yes, (add-hook 'isearch-mode-hook 'deactivate-mark) seems to do the trick.
>
> That will break the common sequence C-@ C-s which *should* mark the
> region from where you started to where the search completes.
Yes.
It's fine for a given user to add such behavior via a hook, if s?he wants.
But the behavior of extending the active region during Isearch should not be
considered a bug. A priori, Isearch should make no decisions about changing
the region activation. Leave it up to the user.
FWIW, Isearch+ gives you choices in behavior wrt the active region, decided by
options `isearchp-deactivate-region-flag' and `isearchp-restrict-to-region-flag'.
* Non-nil `isearchp-deactivate-region-flag' means deactivate the region before
searching, so you can better see the text etc. If nil, you get the ordinary
Isearch behavior: no deactivation.
* Non-nil `isearchp-restrict-to-region-flag' limits searching to the active
region. If nil, you get the ordinary Isearch behavior: no restriction of
searching to the region.
Isearch+ is here (and on MELPA):
Code: http://www.emacswiki.org/emacs-en/download/isearch%2b.el
Description: http://www.emacswiki.org/IsearchPlus
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
2013-09-26 15:43 ` Drew Adams
@ 2013-09-26 16:01 ` Yuri Khan
2013-09-26 17:27 ` Stefan Monnier
0 siblings, 1 reply; 23+ messages in thread
From: Yuri Khan @ 2013-09-26 16:01 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs@gnu.org, Barry Margolin
On Thu, Sep 26, 2013 at 10:43 PM, Drew Adams <drew.adams@oracle.com> wrote:
> It's fine for a given user to add such behavior via a hook, if s?he wants.
>
> But the behavior of extending the active region during Isearch should not be
> considered a bug. A priori, Isearch should make no decisions about changing
> the region activation. Leave it up to the user.
Extending after set-mark or cua-set-mark is understandable and intuitive.
Extending after kill-ring-save, copy-region-as-kill or cua-copy-region
is not. Before this thread showed up, I wasn’t even able to connect
the region extending with the act of copying. All I knew was that
isearch *sometimes* unpredictably causes the region to extend when I
expect it to deactivate.
> FWIW, Isearch+ gives you choices in behavior wrt the active region, decided by
> options `isearchp-deactivate-region-flag' and `isearchp-restrict-to-region-flag'.
>
> * Non-nil `isearchp-deactivate-region-flag' means deactivate the region before
> searching, so you can better see the text etc. If nil, you get the ordinary
> Isearch behavior: no deactivation.
>
> * Non-nil `isearchp-restrict-to-region-flag' limits searching to the active
> region. If nil, you get the ordinary Isearch behavior: no restriction of
> searching to the region.
Both options are only useful for persistent region. For us CUA types,
isearch should deactivate the region the same as every other point
movement command, *except* if the current region has explicitly been
made persistent by the user invoking set-mark.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
[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>
[not found] ` <<barmar-B00378.13172226092013@news.eternal-september.org>
1 sibling, 1 reply; 23+ messages in thread
From: Barry Margolin @ 2013-09-26 17:17 UTC (permalink / raw)
To: help-gnu-emacs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]
In article <mailman.2924.1380210221.10748.help-gnu-emacs@gnu.org>,
Drew Adams <drew.adams@oracle.com> wrote:
> > > > But, the same behaviour is also shown in emacs -Q: When something is
> > > > selected and the point is inside this selection and you start isearch,
> > > > then the selection is automatically extended. I could imagine that an
> > > > isearch hook could help which first switches off the selectionâέ¦
> > >
> > > Yes, (add-hook 'isearch-mode-hook 'deactivate-mark) seems to do the
> > > trick.
> >
> > That will break the common sequence C-@ C-s which *should* mark the
> > region from where you started to where the search completes.
>
> Yes.
>
> It's fine for a given user to add such behavior via a hook, if s?he wants.
>
> But the behavior of extending the active region during Isearch should not be
> considered a bug. A priori, Isearch should make no decisions about changing
> the region activation. Leave it up to the user.
But shouldn't the default behavior be consistent with cursor motion
commands? Either they all should extend the region or none should.
I'm not able to reproduce the OP's claim that cursor motion deactivates
the region after saving to the clipboard, but that may be because I
don't use CUA-mode. I just use normal region commands, and copy-region
(M-w) deactivates the region itself.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
2013-09-26 16:01 ` Yuri Khan
@ 2013-09-26 17:27 ` Stefan Monnier
0 siblings, 0 replies; 23+ messages in thread
From: Stefan Monnier @ 2013-09-26 17:27 UTC (permalink / raw)
To: help-gnu-emacs
> Extending after kill-ring-save, copy-region-as-kill or cua-copy-region
> is not.
Indeed, and AFAICT Emacs does not extend the region when you C-s search
after one of the above.
Stefan
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: automatic selection during search
[not found] ` <<barmar-B00378.13172226092013@news.eternal-september.org>
@ 2013-09-26 17:32 ` Drew Adams
0 siblings, 0 replies; 23+ messages in thread
From: Drew Adams @ 2013-09-26 17:32 UTC (permalink / raw)
To: Barry Margolin, help-gnu-emacs
> > > the common sequence C-@ C-s ... *should* mark the
> > > region from where you started to where the search completes.
> >
> > Yes.
> >
> > It's fine for a given user to add such behavior via a hook, if s?he wants.
> >
> > But the behavior of extending the active region during Isearch should not
> > be considered a bug. A priori, Isearch should make no decisions about
> > changing the region activation. Leave it up to the user.
>
> But shouldn't the default behavior be consistent with cursor motion
> commands? Either they all should extend the region or none should.
Sorry, I don't quite understand what you are saying. Is it not the case that
Isearch is consistent with cursor motion commands? To me, it seems to be.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
2013-09-26 14:46 ` Barry Margolin
[not found] ` <mailman.2924.1380210221.10748.help-gnu-emacs@gnu.org>
@ 2013-09-26 18:44 ` Peter Dyballa
1 sibling, 0 replies; 23+ messages in thread
From: Peter Dyballa @ 2013-09-26 18:44 UTC (permalink / raw)
To: Barry Margolin; +Cc: help-gnu-emacs
Am 26.09.2013 um 16:46 schrieb Barry Margolin:
> That will break the common sequence C-@ C-s which *should* mark the
> region from where you started to where the search completes.
This is indeed useful! It's helpful to remove some rubbish from my shell buffer by setting the mark at the prompt and then isearching backward to where the rubbish started, then deleting the region.
--
Greetings
Pete
If builders built buildings the way programmers write programs, then the first woodpecker that came along would destroy civilization.
– Weinberg's Second Law
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
[not found] ` <mailman.2941.1380216751.10748.help-gnu-emacs@gnu.org>
@ 2013-09-26 18:53 ` Barry Margolin
0 siblings, 0 replies; 23+ messages in thread
From: Barry Margolin @ 2013-09-26 18:53 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.2941.1380216751.10748.help-gnu-emacs@gnu.org>,
Drew Adams <drew.adams@oracle.com> wrote:
> > > > the common sequence C-@ C-s ... *should* mark the
> > > > region from where you started to where the search completes.
> > >
> > > Yes.
> > >
> > > It's fine for a given user to add such behavior via a hook, if s?he wants.
> > >
> > > But the behavior of extending the active region during Isearch should not
> > > be considered a bug. A priori, Isearch should make no decisions about
> > > changing the region activation. Leave it up to the user.
> >
> > But shouldn't the default behavior be consistent with cursor motion
> > commands? Either they all should extend the region or none should.
>
> Sorry, I don't quite understand what you are saying. Is it not the case that
> Isearch is consistent with cursor motion commands? To me, it seems to be.
Me, too. I thought the OP said it wasn't for him, but it was actually
someone else responding. He wrote:
> My use case is: I copy something to clipboard and want to teleport to
> a different place and paste it there. When I use usual cursor movement
> keys (arrows, PgUp/Dn) the selection is deactivated so I expect C-s to
> behave similarly.
> (Yes, I use cua-mode and transient-mark-mode and CUA terminology and
> arrow keys for navigation.)
So I'm guessing cua-mode changes the behavior of the cursor movement
commands, but not C-s.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
[not found] <mailman.2845.1380113901.10748.help-gnu-emacs@gnu.org>
@ 2013-09-27 6:26 ` bjvilfan
2013-09-27 15:20 ` Drew Adams
0 siblings, 1 reply; 23+ messages in thread
From: bjvilfan @ 2013-09-27 6:26 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, September 25, 2013 8:38:30 AM UTC+2, Bostjan Vilfan wrote:
> Hello,
>
> In using emacs I'm encountering a problem that I find quite irritating:
>
> (very) frequently when *I start a search with Ctrl-s*, the region from the
>
> current position of the cursor to the location of searched for item gets
>
> selected (colored). Does anyone know how to avoid this unwanted selection?
>
>
>
> emacs version:24.3.1 running on Windows 7
>
>
>
> Regards,
>
> bostjan
Hello,
Thanks for all the replies. I think I'll start with the suggestion to start with emacs -Q and gradually enlarge my init file. I'll report on the result
Regards,
bostjanv
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: automatic selection during search
2013-09-27 6:26 ` bjvilfan
@ 2013-09-27 15:20 ` Drew Adams
0 siblings, 0 replies; 23+ messages in thread
From: Drew Adams @ 2013-09-27 15:20 UTC (permalink / raw)
To: bjvilfan, help-gnu-emacs
> I think I'll start with the suggestion to start
> with emacs -Q and gradually enlarge my init file.
Don't do it gradually. Do it by bisecting recursively, i.e.,
In chunks that get increasingly smaller (exponentially).
This is very quick. Again, `comment-region' is your friend.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
[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
0 siblings, 1 reply; 23+ messages in thread
From: Kai Grossjohann @ 2013-09-30 19:59 UTC (permalink / raw)
To: help-gnu-emacs
On Thursday, September 26, 2013 5:51:17 AM UTC+2, Yuri Khan wrote:
>
> I understand the reason C-SPACE and C-@ cause that, but copying to
> clipboard? Why?
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.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
2013-09-30 19:59 ` Kai Grossjohann
@ 2013-09-30 20:05 ` Barry Margolin
2013-10-01 3:56 ` Yuri Khan
0 siblings, 1 reply; 23+ messages in thread
From: Barry Margolin @ 2013-09-30 20:05 UTC (permalink / raw)
To: help-gnu-emacs
In article <b18e9595-68d7-4737-9b5a-3b95ae710865@googlegroups.com>,
Kai Grossjohann <kai.grossjohann@gmail.com> wrote:
> On Thursday, September 26, 2013 5:51:17 AM UTC+2, Yuri Khan wrote:
> >
> > I understand the reason C-SPACE and C-@ cause that, but copying to
> > clipboard? Why?
>
> 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.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
2013-09-30 20:05 ` Barry Margolin
@ 2013-10-01 3:56 ` Yuri Khan
2013-10-01 12:47 ` Stefan Monnier
0 siblings, 1 reply; 23+ messages in thread
From: Yuri Khan @ 2013-10-01 3:56 UTC (permalink / raw)
To: Barry Margolin; +Cc: help-gnu-emacs@gnu.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.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: automatic selection during search
2013-10-01 3:56 ` Yuri Khan
@ 2013-10-01 12:47 ` Stefan Monnier
0 siblings, 0 replies; 23+ messages in thread
From: Stefan Monnier @ 2013-10-01 12:47 UTC (permalink / raw)
To: help-gnu-emacs
> ::: 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)
Please send those unexpected behaviors to M-x report-emacs-bug.
Stefan
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2013-10-01 12:47 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <<CAAm34zryY6rrua7nQGHXAgHvofjTkOob9Eet9t9LcJ=Xw2bZ5A@mail.gmail.com>
[not found] ` <<83a9j0hptk.fsf@gnu.org>
2013-09-25 16:25 ` automatic selection during search 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
2013-09-25 6:38 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
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
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.