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: isearch.el patch for `M-e' to put point at mismatch position Date: Mon, 16 May 2011 14:36:39 -0700 Message-ID: <79A3EFE6965F48DC99409B8AC2363D2A@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0051_01CC13D6.AB001460" X-Trace: dough.gmane.org 1305581818 26357 80.91.229.12 (16 May 2011 21:36:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 16 May 2011 21:36:58 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 16 23:36:54 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 1QM5T7-0001hO-HK for ged-emacs-devel@m.gmane.org; Mon, 16 May 2011 23:36:49 +0200 Original-Received: from localhost ([::1]:49529 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM5T7-00046E-1e for ged-emacs-devel@m.gmane.org; Mon, 16 May 2011 17:36:49 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:41420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM5T4-00045E-4f for emacs-devel@gnu.org; Mon, 16 May 2011 17:36:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QM5T2-0004Y9-MZ for emacs-devel@gnu.org; Mon, 16 May 2011 17:36:46 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:47603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM5T2-0004Xe-Hc for emacs-devel@gnu.org; Mon, 16 May 2011 17:36:44 -0400 Original-Received: from rtcsinet21.oracle.com (rtcsinet21.oracle.com [66.248.204.29]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p4GLafSh023379 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 16 May 2011 21:36:43 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by rtcsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p4GLadm0003695 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 16 May 2011 21:36:40 GMT Original-Received: from abhmt008.oracle.com (abhmt008.oracle.com [141.146.116.17]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p4GLaYcX017158 for ; Mon, 16 May 2011 16:36:34 -0500 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 May 2011 14:36:34 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcwUEVaumIZMCnyASc2hpJtFWFPkGQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 X-Source-IP: rtcsinet21.oracle.com [66.248.204.29] X-CT-RefId: str=0001.0A090202.4DD198EB.002C:SCFSTAT5015188,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 148.87.113.121 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:139448 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_0051_01CC13D6.AB001460 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit The attached patch makes `M-e' (`isearch-edit-string') put point at the first mismatch position (or the search-string end if no mismatch). 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.) (This feature complements the use of highlighting to show users where the mismatch starts.) ------=_NextPart_000_0051_01CC13D6.AB001460 Content-Type: application/octet-stream; name="isearch-2011-05-16.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="isearch-2011-05-16.patch" diff -cw isearch.el isearch-patched-2011-05-16.el=0A= *** isearch.el Mon May 16 11:38:22 2011=0A= --- isearch-patched-2011-05-16.el Mon May 16 14:21:04 2011=0A= ***************=0A= *** 1060,1065 ****=0A= --- 1060,1080 ----=0A= =0A= (defvar minibuffer-history-symbol) ;; from external package gmhist.el=0A= =0A= + (defun isearch-fail-pos ()=0A= + "Position of first mismatch in search string, or its length if none."=0A= + (let ((cmds isearch-cmds)=0A= + succ-msg)=0A= + (if (and isearch-success (not isearch-error))=0A= + (length isearch-message)=0A= + (while (or (not (isearch-success-state (car cmds)))=0A= + (isearch-error-state (car cmds)))=0A= + (pop cmds))=0A= + (setq succ-msg (and cmds (isearch-message-state (car cmds))))=0A= + (if (and (stringp succ-msg) (< (length succ-msg) (length = isearch-message))=0A= + (equal succ-msg (substring isearch-message 0 (length = succ-msg))))=0A= + (length succ-msg)=0A= + 0))))=0A= + =0A= (defun isearch-edit-string ()=0A= "Edit the search string in the minibuffer.=0A= The following additional command keys are active while editing.=0A= ***************=0A= *** 1139,1145 ****=0A= (setq isearch-new-string=0A= (read-from-minibuffer=0A= (isearch-message-prefix nil nil = isearch-nonincremental)=0A= ! isearch-string=0A= minibuffer-local-isearch-map nil=0A= (if isearch-regexp=0A= (cons 'regexp-search-ring=0A= --- 1154,1160 ----=0A= (setq isearch-new-string=0A= (read-from-minibuffer=0A= (isearch-message-prefix nil nil = isearch-nonincremental)=0A= ! (cons isearch-string (1+ (isearch-fail-pos)))=0A= minibuffer-local-isearch-map nil=0A= (if isearch-regexp=0A= (cons 'regexp-search-ring=0A= =0A= Diff finished. Mon May 16 14:23:06 2011=0A= ------=_NextPart_000_0051_01CC13D6.AB001460--