From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: isearch-yank-char Date: 30 Apr 2004 19:12:26 +0900 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87ad0tojud.fsf@tc-1-100.kawasaki.gol.ne.jp> References: <87n04u77z8.fsf@floss.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 1083340216 30085 80.91.224.253 (30 Apr 2004 15:50:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 30 Apr 2004 15:50:16 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Apr 30 17:50:08 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 1BJaHA-0006qP-00 for ; Fri, 30 Apr 2004 17:50:08 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BJaH9-0006ZN-00 for ; Fri, 30 Apr 2004 17:50:08 +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 1BJaG9-0008DD-9C for emacs-devel@quimby.gnus.org; Fri, 30 Apr 2004 11:49:05 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BJaFN-0008C7-LB for emacs-devel@gnu.org; Fri, 30 Apr 2004 11:48:17 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BJZvJ-0003xW-Is for emacs-devel@gnu.org; Fri, 30 Apr 2004 11:28:04 -0400 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJUrQ-0007q3-Tk for emacs-devel@gnu.org; Fri, 30 Apr 2004 06:03:13 -0400 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BJUrN-0008Hj-00 for ; Fri, 30 Apr 2004 12:03:09 +0200 Original-Received: from yokohama2-61-203-152-226.ap.0038.net ([61.203.152.226]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 Apr 2004 12:03:09 +0200 Original-Received: from miles by yokohama2-61-203-152-226.ap.0038.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 Apr 2004 12:03:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 48 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: yokohama2-61-203-152-226.ap.0038.net System-Type: i686-pc-linux-gnu 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:22447 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22447 Alan Mackenzie writes: > > 2. Bind C-b in isearch-mode to a function (name TBD) that loses > > one char from the search string. > > NOT SO FAST! Tell me, where does point get left after a C-b? Normally, > one character backwards. No problem. But.... > > Where does point get left in a regexp-search after C-b? An obvious implementation might be: Act exactly like `M-e DEL RET'. However that's no good because M-e _always_ moves forward, even if the search string got shorter, and I think that would surprise many people -- who will expect C-b to act sort of like DEL but without removing large chunks like those added by C-w. Another idea might be: (1) Save the current search-string ORIG-SEARCH-STRING, with length LEN. (2) Backtrack like DEL until the length of the search-string is <= LEN - 1 (if you had done a C-w, then that's probably right before you did it). (3) Now start searching forward (or backward, if C-r) again from the point you backed up to, for the first LEN - 1 characters of ORIG-SEARCH-STRING. This makes the assumption that you're probably typing C-b because the current search string is too long and doesn't match what you want, and thus any search history that includes it should be removed. It reflects what many people probably already do manually when C-w adds slightly too much text: they hit DEL until the text added by C-w is gone, and then retype all but the unwanted text character by character. Even when you don't use C-w, the above behavior is a convenient way to skip back to the last point where you actually added search text, without having to hit DEL a bunch of times to backtrack first (I want to do this quite often). -Miles -- We are all lying in the gutter, but some of us are looking at the stars. -Oscar Wilde