all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Yanking in isearch mode
@ 2010-06-01  6:44 Gary .
  2010-06-01  7:11 ` Bastian Beischer
  2010-06-01 10:58 ` Bernardo
  0 siblings, 2 replies; 17+ messages in thread
From: Gary . @ 2010-06-01  6:44 UTC (permalink / raw
  To: emacs list

What *should* C-y do if one is at the I-Search prompt, please? At the
moment it seems to yank the "word" under the cursor. Has this
behaviour changed recently, maybe from 23.1 to 23.2?



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-01  6:44 Yanking in isearch mode Gary .
@ 2010-06-01  7:11 ` Bastian Beischer
  2010-06-01  8:34   ` Gary .
  2010-06-01  9:47   ` Stefan Kangas
  2010-06-01 10:58 ` Bernardo
  1 sibling, 2 replies; 17+ messages in thread
From: Bastian Beischer @ 2010-06-01  7:11 UTC (permalink / raw
  To: Gary .; +Cc: emacs list

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

I don't know, but I personally dislike that keybinding because I often have
terms I'd like to search for in the kill-ring and cannot yank them.

On Tue, Jun 1, 2010 at 8:44 AM, Gary . <help-gnu-emacs@garydjones.name>wrote:

> What *should* C-y do if one is at the I-Search prompt, please? At the
> moment it seems to yank the "word" under the cursor. Has this
> behaviour changed recently, maybe from 23.1 to 23.2?
>
>


-- 
Bastian Beischer

I. Physikalisches Institut B (RWTH Aachen)
Sommerfeldstr. 14
52074 Aachen
GERMANY

Office: 28-C-203
Phone: +49 241 - 8027205

[-- Attachment #2: Type: text/html, Size: 917 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-01  7:11 ` Bastian Beischer
@ 2010-06-01  8:34   ` Gary .
  2010-06-01  9:47   ` Stefan Kangas
  1 sibling, 0 replies; 17+ messages in thread
From: Gary . @ 2010-06-01  8:34 UTC (permalink / raw
  To: emacs list

On Tue, Jun 1, 2010 at 9:11 AM, Bastian Beischer wrote:
> I don't know, but I personally dislike that keybinding because I often have
> terms I'd like to search for in the kill-ring and cannot yank them.

Egg zackerly.

I often have something in one buffer I want to search for in another,
so I try to yank it and... *arg*



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-01  7:11 ` Bastian Beischer
  2010-06-01  8:34   ` Gary .
@ 2010-06-01  9:47   ` Stefan Kangas
  2010-06-02 19:30     ` Gary
  1 sibling, 1 reply; 17+ messages in thread
From: Stefan Kangas @ 2010-06-01  9:47 UTC (permalink / raw
  To: Bastian Beischer; +Cc: emacs list

Bastian Beischer <bastian.beischer@rwth-aachen.de> writes:

> I don't know, but I personally dislike that keybinding because I often have
> terms I'd like to search for in the kill-ring and cannot yank them.

Try isearch-yank-kill, bound to M-y by default.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-01  6:44 Yanking in isearch mode Gary .
  2010-06-01  7:11 ` Bastian Beischer
@ 2010-06-01 10:58 ` Bernardo
  2010-06-01 14:38   ` Suvayu Ali
       [not found]   ` <mailman.4.1275403112.9367.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 17+ messages in thread
From: Bernardo @ 2010-06-01 10:58 UTC (permalink / raw
  To: emacs list

Gary . said the following on 06/01/10 16:44:
> What *should* C-y do if one is at the I-Search prompt, please? 
while at it, hit C-h k  and then C-y and you'll find out


> At the moment it seems to yank the "word" under the cursor. Has this
> behaviour changed recently, maybe from 23.1 to 23.2?

btw M-y may do what you want while in isearch

see manual for more details
M-: (info "(Emacs)Incremental search")



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-01 10:58 ` Bernardo
@ 2010-06-01 14:38   ` Suvayu Ali
  2010-06-01 14:59     ` Drew Adams
       [not found]   ` <mailman.4.1275403112.9367.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 17+ messages in thread
From: Suvayu Ali @ 2010-06-01 14:38 UTC (permalink / raw
  To: help-gnu-emacs

On Tuesday 01 June 2010 03:58 AM, Bernardo wrote:
> Gary . said the following on 06/01/10 16:44:
>> At the moment it seems to yank the "word" under the cursor. Has this
>> behaviour changed recently, maybe from 23.1 to 23.2?
>
> btw M-y may do what you want while in isearch
>
> see manual for more details
> M-: (info "(Emacs)Incremental search")
>

The yank with M-y is all lower case and then the i-search becomes case 
insensitive. Is their any way it can preserve the case?

-- 
Suvayu

Open source is the future. It sets us free.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: Yanking in isearch mode
  2010-06-01 14:38   ` Suvayu Ali
@ 2010-06-01 14:59     ` Drew Adams
  2010-06-03  8:41       ` Kevin Rodgers
  0 siblings, 1 reply; 17+ messages in thread
From: Drew Adams @ 2010-06-01 14:59 UTC (permalink / raw
  To: 'Suvayu Ali', help-gnu-emacs

> The yank with M-y is all lower case and then the i-search 
> becomes case insensitive. Is their any way it can preserve the case?

Sounds like a bug. But see below.

What should happen is that search always respects `case-fold-search'.
And that include `M-y' yanking.

Suppose you copy some text "ABC" to the kill ring.  If `case-fold-search' is
non-nil when you use `M-y' then it yanks "abc" and search is case-insensitive.
But if `case-fold-search' is nil when you use `M-y' then it yanks "ABC" and
search is case-sensitive.

You can toggle case-sensitivity during isearch with `M-c'. However, that doesn't
change the search string.  So if search is case-insensitive and the search
string is "abc" then it stays "abc" after `M-c' and it searches for only
lower-case "abc".

You can always use `M-e' to edit the search string - e.g. `M-u' to make words
there uppercase.




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
       [not found]   ` <mailman.4.1275403112.9367.help-gnu-emacs@gnu.org>
@ 2010-06-01 15:41     ` Andreas Politz
  0 siblings, 0 replies; 17+ messages in thread
From: Andreas Politz @ 2010-06-01 15:41 UTC (permalink / raw
  To: help-gnu-emacs

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> On Tuesday 01 June 2010 03:58 AM, Bernardo wrote:
>> Gary . said the following on 06/01/10 16:44:
>>> At the moment it seems to yank the "word" under the cursor. Has this
>>> behaviour changed recently, maybe from 23.1 to 23.2?
>>
>> btw M-y may do what you want while in isearch
>>
>> see manual for more details
>> M-: (info "(Emacs)Incremental search")
>>
>
> The yank with M-y is all lower case and then the i-search becomes case
> insensitive. Is their any way it can preserve the case?

(setq search-upper-case t)

Read the whole story at the help page of that variable.

-ap


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-01  9:47   ` Stefan Kangas
@ 2010-06-02 19:30     ` Gary
  2010-06-03  5:29       ` Ken Hori
       [not found]       ` <mailman.2.1275542972.10094.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 17+ messages in thread
From: Gary @ 2010-06-02 19:30 UTC (permalink / raw
  To: Help-gnu-emacs

Stefan Kangas wrote:

> Bastian Beischer writes:
>
>> I don't know, but I personally dislike that keybinding because I often have
>> terms I'd like to search for in the kill-ring and cannot yank them.
>
> Try isearch-yank-kill, bound to M-y by default.

Doesn't anyone else thing it's strange to change the keybinding (C-y /
M-y) for something so basic and frequently used?

-- 
Gary



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-02 19:30     ` Gary
@ 2010-06-03  5:29       ` Ken Hori
       [not found]       ` <mailman.2.1275542972.10094.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 17+ messages in thread
From: Ken Hori @ 2010-06-03  5:29 UTC (permalink / raw
  To: Help-gnu-emacs

> Doesn't anyone else thing it's strange to change the keybinding (C-y /
> M-y) for something so basic and frequently used?

Yes, very strange indeed. I asked my colleagues around today, and
guess what: No one found the default behavior of \C-y (yank-line)
in isearch useful. It is counter-intuitive, inconsistent with the
global keymap, and confusing to the beginners. I happen to share
the same opinion and find it unworthy to steal \C-y for something
most, if not all, find needless.  I am all for opting it out of
isearch or doing the C-y <-> M-y switch.

Until it's done, you can override it with:

(define-key isearch-mode-map "\C-y" 'isearch-yank-kill)
;; If you like more:
;(define-key isearch-mode-map "\C-p" 'isearch-repeat-backward)
;(define-key isearch-mode-map "\C-n" 'isearch-repeat-forward)
;(define-key isearch-mode-map "\C-h" 'isearch-del-char)


On Wed, Jun 2, 2010 at 12:30 PM, Gary <help-gnu-emacs@garydjones.name> wrote:
> Stefan Kangas wrote:
>
>> Bastian Beischer writes:
>>
>>> I don't know, but I personally dislike that keybinding because I often have
>>> terms I'd like to search for in the kill-ring and cannot yank them.
>>
>> Try isearch-yank-kill, bound to M-y by default.
>
> Doesn't anyone else thing it's strange to change the keybinding (C-y /
> M-y) for something so basic and frequently used?
>
> --
> Gary
>
>



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-01 14:59     ` Drew Adams
@ 2010-06-03  8:41       ` Kevin Rodgers
  2010-06-03 10:09         ` Suvayu Ali
  2010-06-04 18:51         ` Johan Bockgård
  0 siblings, 2 replies; 17+ messages in thread
From: Kevin Rodgers @ 2010-06-03  8:41 UTC (permalink / raw
  To: help-gnu-emacs

Drew Adams wrote:
 >> The yank with M-y is all lower case and then the i-search
 >> becomes case insensitive. Is their any way it can preserve the case?
 >
 > Sounds like a bug. But see below.
 >
 > What should happen is that search always respects `case-fold-search'.
 > And that include `M-y' yanking.
 >
 > Suppose you copy some text "ABC" to the kill ring.  If `case-fold-search' is
 > non-nil when you use `M-y' then it yanks "abc" and search is case-insensitive.
 > But if `case-fold-search' is nil when you use `M-y' then it yanks "ABC" and
 > search is case-sensitive.
 >
 > You can toggle case-sensitivity during isearch with `M-c'. However, that doesn't
 > change the search string.  So if search is case-insensitive and the search
 > string is "abc" then it stays "abc" after `M-c' and it searches for only
 > lower-case "abc".

M-c is bound to isearch-toggle-case-fold, which does:

   (setq isearch-case-fold-search
	(if isearch-case-fold-search nil 'yes))

And isearch-case-fold-search has this comment:

; case-fold-search while searching.
;   either nil, t, or 'yes.  'yes means the same as t except that mixed
;   case in the search string is ignored.
(defvar isearch-case-fold-search nil)

But `yes' is not treated specially in isearch.el -- so what is that all
about?

Also, M-y is bound to isearch-yank-kill, which calls
isearch-yank-string, which does:

   ;; Downcase the string if not supposed to case-fold yanked strings.
   (if (and isearch-case-fold-search
	   (eq 'not-yanks search-upper-case))
       (setq string (downcase string)))

But search-upper-case defaults to `not-yanks', and it is not modified
in isearch.el:

(defcustom search-upper-case 'not-yanks
   "*If non-nil, upper case chars disable case fold searching.
That is, upper and lower case chars must match exactly.
This applies no matter where the chars come from, but does not
apply to chars in regexps that are prefixed with `\\'.
If this value is `not-yanks', yanked text is always downcased."
   :type '(choice (const :tag "off" nil)
		 (const not-yanks)
		 (other :tag "on" t))
   :group 'isearch)

So it seems that the statement "If this value is `not-yanks', yanked
text is always downcased" is not true, since isearch-yank-string also
depends on isearch-case-fold-search.

Are the `yes' and `not-yanks' values of isearch-case-fold-search and
`search-upper-case' respectively really needed, or are they cruft?

 > You can always use `M-e' to edit the search string - e.g. `M-u' to make words
 > there uppercase.

-- 
Kevin Rodgers
Denver, Colorado, USA




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-03  8:41       ` Kevin Rodgers
@ 2010-06-03 10:09         ` Suvayu Ali
  2010-06-03 15:40           ` Drew Adams
  2010-06-04 18:51         ` Johan Bockgård
  1 sibling, 1 reply; 17+ messages in thread
From: Suvayu Ali @ 2010-06-03 10:09 UTC (permalink / raw
  To: help-gnu-emacs

On Thursday 03 June 2010 01:41 AM, Kevin Rodgers wrote:
> Drew Adams wrote:
>  >> The yank with M-y is all lower case and then the i-search
>  >> becomes case insensitive. Is their any way it can preserve the case?
>  >
>  > Sounds like a bug. But see below.
>  >
>  > What should happen is that search always respects `case-fold-search'.
>  > And that include `M-y' yanking.
>  >
>  > Suppose you copy some text "ABC" to the kill ring. If
> `case-fold-search' is
>  > non-nil when you use `M-y' then it yanks "abc" and search is
> case-insensitive.
>  > But if `case-fold-search' is nil when you use `M-y' then it yanks
> "ABC" and
>  > search is case-sensitive.
>  >
>  > You can toggle case-sensitivity during isearch with `M-c'. However,
> that doesn't
>  > change the search string. So if search is case-insensitive and the
> search
>  > string is "abc" then it stays "abc" after `M-c' and it searches for only
>  > lower-case "abc".

Hi Drew,

For some reason I didn't receive your response. Kevin's response clued 
me in that you had replied and finally read your post in the archives.

I haven't changed this variable but I checked, by default it is set to 
true. I went ahead and changed it to nil and now my isearches are case 
insensitive.

It seems to me having nil as the default would make more sense. e.g.

Lets say we have some text `Variable', on copying it to the kill ring 
and doing `C-s M-y' will yank a lower cased `variable' and does a case 
insensitive search. To go back to case sensitive, as per your 
suggestion, we can use `M-c' but the text is already down-cased! So then 
we have to edit the text again.

Whereas with nil as the default, doing `C-s M-y' will preserve case of 
the yanked string. Now we can switch between case sensitive/insensitive 
with a simple `M-c'. Much more sane, Don't you agree?


>
> And isearch-case-fold-search has this comment:
>
> ; case-fold-search while searching.
> ; either nil, t, or 'yes. 'yes means the same as t except that mixed
> ; case in the search string is ignored.
> (defvar isearch-case-fold-search nil)
>

Kevin:

This one shows up as this in my Emacs install.

> isearch-case-fold-search is a variable defined in `isearch.el'.
> Its value is nil
>
> Documentation:
> Not documented as a variable.


Thank you both for the responses. :)

-- 
Suvayu

Open source is the future. It sets us free.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: Yanking in isearch mode
  2010-06-03 10:09         ` Suvayu Ali
@ 2010-06-03 15:40           ` Drew Adams
  0 siblings, 0 replies; 17+ messages in thread
From: Drew Adams @ 2010-06-03 15:40 UTC (permalink / raw
  To: 'Suvayu Ali', help-gnu-emacs

> Hi Drew,
> 
> For some reason I didn't receive your response. Kevin's 
> response clued me in that you had replied and finally read
> your post in the archives.

I used Reply All, but I believe the mail to you bounced for some reason.

> I haven't changed this variable but I checked, by default it 
> is set to true. I went ahead and changed it to nil and now my
> isearches are case insensitive.
> 
> It seems to me having nil as the default would make more sense. e.g.
> 
> Lets say we have some text `Variable', on copying it to the kill
> ring and doing `C-s M-y' will yank a lower cased `variable' and 
> does a case insensitive search. To go back to case sensitive, as
> per your suggestion, we can use `M-c' but the text is already 
> down-cased! So then we have to edit the text again.
> 
> Whereas with nil as the default, doing `C-s M-y' will 
> preserve case of the yanked string. Now we can switch between
> case sensitive/insensitive with a simple `M-c'. Much more sane,
> Don't you agree?

I don't have much of an opinion about this, and my opinion does not count for
much on such things.  It is easy for a user to customize the default value.

FWIW, my personal default setting is nil (case-sensitive).  Case-sensitivity
makes sense for most of the buffers I use.  And in contexts where
case-insensitivity makes sense as the default (e.g Info), most of the time the
major mode sets the default that way (locally).

I do make use of the case-sensitivity toggle in Isearch.  And I have a similar
toggle (`C-A' aka `C-S-a') for completion (in Icicles), which I also use fairly
often.

Using such a toggle is simple.  So is customizing the default value.




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-03  8:41       ` Kevin Rodgers
  2010-06-03 10:09         ` Suvayu Ali
@ 2010-06-04 18:51         ` Johan Bockgård
  1 sibling, 0 replies; 17+ messages in thread
From: Johan Bockgård @ 2010-06-04 18:51 UTC (permalink / raw
  To: help-gnu-emacs

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> And isearch-case-fold-search has this comment:
>
> ; case-fold-search while searching.
> ;   either nil, t, or 'yes.  'yes means the same as t except that mixed
> ;   case in the search string is ignored.
> (defvar isearch-case-fold-search nil)
>
> But `yes' is not treated specially in isearch.el

But `t' is.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
       [not found]       ` <mailman.2.1275542972.10094.help-gnu-emacs@gnu.org>
@ 2010-06-04 22:21         ` Joseph Brenner
  2010-06-05  2:14           ` Evans Winner
  2010-06-05 14:04           ` Stefan Monnier
  0 siblings, 2 replies; 17+ messages in thread
From: Joseph Brenner @ 2010-06-04 22:21 UTC (permalink / raw
  To: help-gnu-emacs


Ken Hori <fplemma@gmail.com> writes:

>> Doesn't anyone else thing it's strange to change the keybinding (C-y /
>> M-y) for something so basic and frequently used?
>
> Yes, very strange indeed.

True.  It brings to mind the days when doing a Backspace invoked "help".

> I asked my colleagues around today, and guess what: No one found the
> default behavior of \C-y (yank-line) in isearch useful. It is
> counter-intuitive, inconsistent with the global keymap, and confusing
> to the beginners. I happen to share the same opinion and find it
> unworthy to steal \C-y for something most, if not all, find needless.
> I am all for opting it out of isearch or doing the C-y <-> M-y switch.

> Until it's done, you can override it with:
>
> (define-key isearch-mode-map "\C-y" 'isearch-yank-kill)

Thanks.  I've been using emacs for decades and that (obviously sensible)
customization had never occured to me.

I've been using "M-x search-forward" or "M-x re-search-forward" when
I felt the need to yank into a search.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-04 22:21         ` Joseph Brenner
@ 2010-06-05  2:14           ` Evans Winner
  2010-06-05 14:04           ` Stefan Monnier
  1 sibling, 0 replies; 17+ messages in thread
From: Evans Winner @ 2010-06-05  2:14 UTC (permalink / raw
  To: help-gnu-emacs

    Ken Hori <fplemma@gmail.com> writes:

    (define-key isearch-mode-map "\C-y" 'isearch-yank-kill)
 
Thank you!  The weird behavior of C-y in isearch just about
gave me a coronary today, as it happens.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Yanking in isearch mode
  2010-06-04 22:21         ` Joseph Brenner
  2010-06-05  2:14           ` Evans Winner
@ 2010-06-05 14:04           ` Stefan Monnier
  1 sibling, 0 replies; 17+ messages in thread
From: Stefan Monnier @ 2010-06-05 14:04 UTC (permalink / raw
  To: help-gnu-emacs

> I've been using "M-x search-forward" or "M-x re-search-forward" when
> I felt the need to yank into a search.

BTW, M-e while in isearch puts you in a minibuffer where you can edit
your search string in the usual way (you can exit this minibuffer simply
by hitting C-s).


        Stefan


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-06-05 14:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-01  6:44 Yanking in isearch mode Gary .
2010-06-01  7:11 ` Bastian Beischer
2010-06-01  8:34   ` Gary .
2010-06-01  9:47   ` Stefan Kangas
2010-06-02 19:30     ` Gary
2010-06-03  5:29       ` Ken Hori
     [not found]       ` <mailman.2.1275542972.10094.help-gnu-emacs@gnu.org>
2010-06-04 22:21         ` Joseph Brenner
2010-06-05  2:14           ` Evans Winner
2010-06-05 14:04           ` Stefan Monnier
2010-06-01 10:58 ` Bernardo
2010-06-01 14:38   ` Suvayu Ali
2010-06-01 14:59     ` Drew Adams
2010-06-03  8:41       ` Kevin Rodgers
2010-06-03 10:09         ` Suvayu Ali
2010-06-03 15:40           ` Drew Adams
2010-06-04 18:51         ` Johan Bockgård
     [not found]   ` <mailman.4.1275403112.9367.help-gnu-emacs@gnu.org>
2010-06-01 15:41     ` Andreas Politz

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.