From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: isearch.el patch for `M-e' to put point at mismatch position Date: Sat, 10 Sep 2011 09:13:18 -0700 Message-ID: References: <79A3EFE6965F48DC99409B8AC2363D2A@us.oracle.com> <87vct1zh4q.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1315671216 16043 80.91.229.12 (10 Sep 2011 16:13:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Sep 2011 16:13:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'Juri Linkov'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 10 18:13:32 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R2QBQ-0004TX-1J for ged-emacs-devel@m.gmane.org; Sat, 10 Sep 2011 18:13:32 +0200 Original-Received: from localhost ([::1]:48311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2QBP-0000yM-FB for ged-emacs-devel@m.gmane.org; Sat, 10 Sep 2011 12:13:31 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2QBM-0000y4-VE for emacs-devel@gnu.org; Sat, 10 Sep 2011 12:13:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2QBL-00086i-QR for emacs-devel@gnu.org; Sat, 10 Sep 2011 12:13:28 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:51373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2QBL-00086L-Il for emacs-devel@gnu.org; Sat, 10 Sep 2011 12:13:27 -0400 Original-Received: from rtcsinet22.oracle.com (rtcsinet22.oracle.com [66.248.204.30]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8AGDOE6002633 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 10 Sep 2011 16:13:26 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by rtcsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8AGDMjK003964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Sep 2011 16:13:23 GMT Original-Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8AGDHhN014488; Sat, 10 Sep 2011 11:13:17 -0500 Original-Received: from dradamslap1 (/10.159.63.205) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 10 Sep 2011 09:13:17 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87vct1zh4q.fsf@mail.jurta.org> Thread-Index: AcxvsJh6ynJJR6ytRSG5AzA/+9NauQAIqguA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-Source-IP: rtcsinet22.oracle.com [66.248.204.30] X-CT-RefId: str=0001.0A090209.4E6B8CA6.0073,ss=1,re=0.000,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 141.146.126.227 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:143848 Archived-At: > > When you hit `M-e' you are ready to edit at the mismatch > > position. This makes it easy to change or insert a char > > or two to make the string match. (`C-g', on > > the other hand just removes all of the mismatch.) > > I discovered now that you can't mix `isearch-message' and > `isearch-string'. > Test case to reproduce the bug: > 1. emacs -Q > 2. insert a few TABs with e.g. `C-q TAB C-q TAB C-q TAB' > 3. `M-<' (`beginning-of-buffer') > 4. `C-s C-q TAB M-e' > fails with the error message "End of buffer". Good catch. > The reason is that `isearch-message' is longer than `isearch-string', > because `isearch-text-char-description' replaces a single TAB > with two characters "^I" in `isearch-message'. > > `isearch-fail-pos' calculates the position based on > `isearch-message', but uses it for `isearch-string' in > `(cons isearch-string (1+ (isearch-fail-pos)))' in > `isearch-edit-string'. > > Replacing `isearch-message' with `isearch-string' in > `isearch-fail-pos' will fix this bug. Sounds good. Please go for it. > BTW, there is exactly the same algorithm used in two functions > `isearch-fail-pos' and `isearch-message'. Well, not exactly, but close. > Currently both functions use the same variable `isearch-message', > but after this fix the same algorithm > will use different variables `isearch-message' and `isearch-string'. > So sharing code between them will be more difficult. There's no real need to share code between them. > Maybe it would be better to add a new argument to `isearch-fail-pos' > that will define whether it should return the failed position in > `isearch-message' or `isearch-string'? That might be OK too, but I'd suggest just making your suggested change above: replace `isearch-message' with `isearch-string' in `isearch-fail-pos'.