From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: isearch-yank-char Date: 30 Apr 2004 13:57:37 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <874qr15m5a.fsf@floss.red-bean.com> References: <874qr7l59b.fsf@mail.jurta.org> <20040426230345.GA8594@fencepost> <877jw2cq4f.fsf@floss.red-bean.com> <87ad0xvo33.fsf@mail.jurta.org> <871xm8wv6j.fsf@mail.jurta.org> <87n04u77z8.fsf@floss.red-bean.com> <87k6zygjff.fsf@mail.jurta.org> <8765bi75vp.fsf@floss.red-bean.com> <87hdv1c1lm.fsf@mail.jurta.org> <87y8od60if.fsf@floss.red-bean.com> <87zn8t6v8z.fsf@mail.jurta.org> <87hdv15q09.fsf@floss.red-bean.com> <87u0z1xasi.fsf@mail.jurta.org> Reply-To: kfogel@red-bean.com NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1083374233 29219 80.91.224.253 (1 May 2004 01:17:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 1 May 2004 01:17:13 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat May 01 03:17:03 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BJj7n-000666-00 for ; Sat, 01 May 2004 03:17:03 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BJj7n-0000Fm-00 for ; Sat, 01 May 2004 03:17:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJj7E-000524-K1 for emacs-devel@quimby.gnus.org; Fri, 30 Apr 2004 21:16:28 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BJj6I-0004sQ-KU for emacs-devel@gnu.org; Fri, 30 Apr 2004 21:15:30 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BJj5l-0004B0-SJ for emacs-devel@gnu.org; Fri, 30 Apr 2004 21:15:29 -0400 Original-Received: from [207.115.63.78] (helo=pimout6-ext.prodigy.net) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJj5l-0004A8-Bw for emacs-devel@gnu.org; Fri, 30 Apr 2004 21:14:57 -0400 Original-Received: from floss.red-bean.com (adsl-66-73-175-183.dsl.chcgil.ameritech.net [66.73.175.183]) by pimout6-ext.prodigy.net (8.12.10/8.12.10) with ESMTP id i411Euc4436672; Fri, 30 Apr 2004 21:14:56 -0400 Original-Received: from kfogel by floss.red-bean.com with local (Exim 3.34 #1 (Debian)) id 1BJdCb-0007Fr-00; Fri, 30 Apr 2004 13:57:37 -0500 Original-To: Juri Linkov X-Windows: even not doing anything would have been better than nothing. In-Reply-To: <87u0z1xasi.fsf@mail.jurta.org> Original-Lines: 152 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22475 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22475 Juri Linkov writes: > Karl Fogel writes: > > Thanks! I'll try it out. > > > > Is this your full patch? If there's more, post it & I'll test with > > that (i.e., including the keybindings and anything else). > > The full patch is below: Interesting! This patch goes further, and changes C-w back to 'isearch-yank-word' (instead of 'isearch-yank-word-or-char'). I'm not sure whether it's good or bad. Just wanted to point out that this patch implements something slightly different from the proposal I made. (Nothing wrong with implementing a different proposal, as long as people know what it is.) Thanks for posting, I'm sure I won't be the only one testing this. -Karl > Index: lisp/isearch.el > =================================================================== > RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v > retrieving revision 1.226 > retrieving revision 1.227 > diff -c -r1.226 -r1.227 > *** lisp/isearch.el 4 Mar 2004 16:54:08 -0000 1.226 > --- lisp/isearch.el 29 Apr 2004 15:28:55 -0000 1.227 > *************** > *** 294,300 **** > (define-key map " " 'isearch-whitespace-chars) > (define-key map [?\S-\ ] 'isearch-whitespace-chars) > > ! (define-key map "\C-w" 'isearch-yank-word-or-char) > (define-key map "\C-y" 'isearch-yank-line) > > ;; Define keys for regexp chars * ? |. > --- 294,302 ---- > (define-key map " " 'isearch-whitespace-chars) > (define-key map [?\S-\ ] 'isearch-whitespace-chars) > > ! (define-key map "\C-b" 'isearch-del-char) > ! (define-key map "\C-f" 'isearch-yank-char) > ! (define-key map "\C-w" 'isearch-yank-word) > (define-key map "\C-y" 'isearch-yank-line) > > ;; Define keys for regexp chars * ? |. > *************** > *** 448,459 **** > As you type characters, they add to the search string and are found. > The following non-printing keys are bound in `isearch-mode-map'. > > ! Type \\[isearch-delete-char] to cancel characters from end of search string. > Type \\[isearch-exit] to exit, leaving point at location found. > Type LFD (C-j) to match end of line. > Type \\[isearch-repeat-forward] to search again forward,\ > \\[isearch-repeat-backward] to search again backward. > ! Type \\[isearch-yank-word-or-char] to yank word from buffer onto end of search\ > string and search for it. > Type \\[isearch-yank-line] to yank rest of line onto end of search string\ > and search for it. > --- 450,464 ---- > As you type characters, they add to the search string and are found. > The following non-printing keys are bound in `isearch-mode-map'. > > ! Type \\[isearch-delete-char] to cancel last input item from end of search string. > ! Type \\[isearch-del-char] to cancel last character from end of search string. > Type \\[isearch-exit] to exit, leaving point at location found. > Type LFD (C-j) to match end of line. > Type \\[isearch-repeat-forward] to search again forward,\ > \\[isearch-repeat-backward] to search again backward. > ! Type \\[isearch-yank-char] to yank character from buffer onto end of search\ > ! string and search for it. > ! Type \\[isearch-yank-word] to yank word from buffer onto end of search\ > string and search for it. > Type \\[isearch-yank-line] to yank rest of line onto end of search string\ > and search for it. > *************** > *** 486,492 **** > you want to use. > > The above keys, bound in `isearch-mode-map', are often controlled by > ! options; do M-x apropos on search-.* to find them. > Other control and meta characters terminate the search > and are then executed normally (depending on `search-exit-option'). > Likewise for function keys and mouse button events. > --- 491,497 ---- > you want to use. > > The above keys, bound in `isearch-mode-map', are often controlled by > ! options; do \\[apropos] on search-.* to find them. > Other control and meta characters terminate the search > and are then executed normally (depending on `search-exit-option'). > Likewise for function keys and mouse button events. > *************** > *** 789,795 **** > \\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring. > \\[isearch-complete-edit] to complete the search string using the search ring. > \\ > ! If first char entered is \\[isearch-yank-word-or-char], then do word search instead." > > ;; This code is very hairy for several reasons, explained in the code. > ;; Mainly, isearch-mode must be terminated while editing and then restarted. > --- 794,800 ---- > \\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring. > \\[isearch-complete-edit] to complete the search string using the search ring. > \\ > ! If first char entered is \\[isearch-yank-word], then do word search instead." > > ;; This code is very hairy for several reasons, explained in the code. > ;; Mainly, isearch-mode must be terminated while editing and then restarted. > *************** > *** 1053,1058 **** > --- 1058,1073 ---- > (isearch-pop-state)) > (isearch-update)) > > + (defun isearch-del-char () > + "Discard last character and move point back. > + If there is no previous character, just beep." > + (interactive) > + (if (equal isearch-string "") > + (ding) > + (setq isearch-string (substring isearch-string 0 -1) > + isearch-message (mapconcat 'isearch-text-char-description > + isearch-string ""))) > + (isearch-search-and-update)) > > (defun isearch-yank-string (string) > "Pull STRING into search string." > *************** > *** 1114,1120 **** > (buffer-substring-no-properties (point) (funcall jumpform))))) > > (defun isearch-yank-char () > ! "Pull next letter from buffer into search string." > (interactive) > (isearch-yank-internal (lambda () (forward-char 1) (point)))) > > --- 1129,1135 ---- > (buffer-substring-no-properties (point) (funcall jumpform))))) > > (defun isearch-yank-char () > ! "Pull next character from buffer into search string." > (interactive) > (isearch-yank-internal (lambda () (forward-char 1) (point)))) > > -- > Juri Linkov > http://www.jurta.org/emacs/