From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Yanking in isearch mode Date: Thu, 03 Jun 2010 02:41:06 -0600 Message-ID: References: <4C04E7EF.70109@pobox.com> <4C051B5E.6070902@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1275554578 4366 80.91.229.12 (3 Jun 2010 08:42:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Jun 2010 08:42:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 03 10:42:57 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OK60s-0004bB-Ej for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Jun 2010 10:42:54 +0200 Original-Received: from localhost ([127.0.0.1]:33638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OK60r-00046l-PO for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Jun 2010 04:42:53 -0400 Original-Received: from [140.186.70.92] (port=39558 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OK5zO-0003kZ-2j for help-gnu-emacs@gnu.org; Thu, 03 Jun 2010 04:41:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OK5zM-0007hC-QK for help-gnu-emacs@gnu.org; Thu, 03 Jun 2010 04:41:21 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:40517) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OK5zM-0007gt-GM for help-gnu-emacs@gnu.org; Thu, 03 Jun 2010 04:41:20 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OK5zK-0003oI-FJ for help-gnu-emacs@gnu.org; Thu, 03 Jun 2010 10:41:18 +0200 Original-Received: from c-71-237-24-138.hsd1.co.comcast.net ([71.237.24.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Jun 2010 10:41:18 +0200 Original-Received: from kevin.d.rodgers by c-71-237-24-138.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Jun 2010 10:41:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 69 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-71-237-24-138.hsd1.co.comcast.net User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73814 Archived-At: 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