all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Yanking in isearch mode
Date: Thu, 03 Jun 2010 02:41:06 -0600	[thread overview]
Message-ID: <hu7pr6$3si$1@dough.gmane.org> (raw)
In-Reply-To: <F54C5EF1918A4458A0B1141184E8ED55@us.oracle.com>

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




  reply	other threads:[~2010-06-03  8:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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='hu7pr6$3si$1@dough.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --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.