From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: 23.0.60; isearch for M-: incorrect in Info Date: Sun, 20 Apr 2008 01:48:55 +0300 Organization: JURTA Message-ID: <87fxth7f34.fsf@jurta.org> References: <000801c89dc4$bf3a9ee0$0200a8c0@us.oracle.com> <874pa2278i.fsf@jurta.org> <003301c89f50$35b7d7e0$0200a8c0@us.oracle.com> <87wsmwkrr9.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1208646914 14253 80.91.229.12 (19 Apr 2008 23:15:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Apr 2008 23:15:14 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, Drew Adams To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 20 01:15:48 2008 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JnMHc-0003Vz-3O for ged-emacs-devel@m.gmane.org; Sun, 20 Apr 2008 01:15:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JnMGw-0005IF-R8 for ged-emacs-devel@m.gmane.org; Sat, 19 Apr 2008 19:15:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JnMEm-0003R7-ME for emacs-devel@gnu.org; Sat, 19 Apr 2008 19:12:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JnMEl-0003Po-Bh for emacs-devel@gnu.org; Sat, 19 Apr 2008 19:12:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JnMEk-0003Pd-Ih for emacs-devel@gnu.org; Sat, 19 Apr 2008 19:12:50 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JnMEk-0003sC-0c for emacs-devel@gnu.org; Sat, 19 Apr 2008 19:12:50 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1JnMEj-0002D6-Mc for emacs-pretest-bug@gnu.org; Sat, 19 Apr 2008 19:12:49 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1JnMEe-0003nx-FF for emacs-pretest-bug@gnu.org; Sat, 19 Apr 2008 19:12:48 -0400 Original-Received: from relay01.kiev.sovam.com ([62.64.120.200]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JnMEd-0003mG-Lx for emacs-pretest-bug@gnu.org; Sat, 19 Apr 2008 19:12:44 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay01.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1JnMEa-000Fw5-JG; Sun, 20 Apr 2008 02:12:41 +0300 In-Reply-To: (Stefan Monnier's message of "Fri, 18 Apr 2008 16:21:28 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: ed1777dc0bbd987b6aca854638b1de8c X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2676 [Apr 18 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Info: {TO: local part of email appears in body} X-SpamTest-Method: none X-SpamTest-Rate: 15 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.8-5.1 (or MacOS X 10.2-10.3) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:95492 gmane.emacs.pretest.bugs:22072 Archived-At: >> This bug can be fixed with a simple patch that was postponed to install >> after the 22.1 release. It seems now is the right time to install it: > >> http://thread.gmane.org/gmane.emacs.devel/34884/focus=41845 > > Could you show us the patch? The patch is below. It adds a new predicate variable `isearch-success-function' with the default behavior of using `isearch-range-invisible' if it is nil. info.el overrides it to let isearch skip invisible text, node header line and Tag Table node. It can't reuse `isearch-range-invisible' because `isearch-range-invisible' doesn't skip the string if at least one its character is visible. But in Info the reverse is necessary (according to Drew's bug report): skip the string when at least one its character is invisible. Index: lisp/isearch.el =================================================================== RCS file: /sources/emacs/emacs/lisp/isearch.el,v retrieving revision 1.316 diff -c -r1.316 isearch.el *** lisp/isearch.el 18 Apr 2008 10:29:23 -0000 1.316 --- lisp/isearch.el 19 Apr 2008 22:45:01 -0000 *************** *** 178,183 **** --- 178,188 ---- "Function to save a function restoring the mode-specific isearch state to the search status stack.") + (defvar isearch-success-function nil + "Function to report whether the new search match is considered successful. + The function has two arguments: the positions of start and end of text + matched by search.") + ;; Search ring. (defvar search-ring nil *************** *** 2104,2110 **** (setq isearch-case-fold-search (isearch-no-upper-case-p isearch-string isearch-regexp))) (condition-case lossage ! (let ((inhibit-point-motion-hooks search-invisible) (inhibit-quit nil) (case-fold-search isearch-case-fold-search) (search-spaces-regexp search-whitespace-regexp) --- 2176,2183 ---- (setq isearch-case-fold-search (isearch-no-upper-case-p isearch-string isearch-regexp))) (condition-case lossage ! (let ((inhibit-point-motion-hooks ! (and (not isearch-success-function) search-invisible)) (inhibit-quit nil) (case-fold-search isearch-case-fold-search) (search-spaces-regexp search-whitespace-regexp) *************** *** 2115,2126 **** (isearch-search-string isearch-string nil t)) ;; Clear RETRY unless we matched some invisible text ;; and we aren't supposed to do that. ! (if (or (eq search-invisible t) ! (not isearch-success) (bobp) (eobp) (= (match-beginning 0) (match-end 0)) ! (not (isearch-range-invisible ! (match-beginning 0) (match-end 0)))) (setq retry nil))) (setq isearch-just-started nil) (if isearch-success --- 2188,2202 ---- (isearch-search-string isearch-string nil t)) ;; Clear RETRY unless we matched some invisible text ;; and we aren't supposed to do that. ! (if (or (not isearch-success) (bobp) (eobp) (= (match-beginning 0) (match-end 0)) ! (if isearch-success-function ! (funcall isearch-success-function ! (match-beginning 0) (match-end 0)) ! (or (eq search-invisible t) ! (not (isearch-range-invisible ! (match-beginning 0) (match-end 0)))))) (setq retry nil))) (setq isearch-just-started nil) (if isearch-success Index: lisp/info.el =================================================================== RCS file: /sources/emacs/emacs/lisp/info.el,v retrieving revision 1.527 diff -c -r1.527 info.el *** lisp/info.el 19 Apr 2008 03:33:13 -0000 1.527 --- lisp/info.el 19 Apr 2008 22:45:02 -0000 *************** *** 1625,1644 **** (1- (point))) (point-max))) (while (and (not give-up) ! (save-match-data ! (or (null found) ! (if backward ! (isearch-range-invisible found beg-found) ! (isearch-range-invisible beg-found found)) ! ;; Skip node header line ! (and (save-excursion (forward-line -1) ! (looking-at "\^_")) ! (forward-line (if backward -1 1))) ! ;; Skip Tag Table node ! (save-excursion ! (and (search-backward "\^_" nil t) ! (looking-at ! "\^_\n\\(Tag Table\\|Local Variables\\)")))))) (let ((search-spaces-regexp (if (or (not isearch-mode) isearch-regexp) Info-search-whitespace-regexp))) --- 1628,1635 ---- (1- (point))) (point-max))) (while (and (not give-up) ! (or (null found) ! (not (funcall isearch-success-function beg-found found)))) (let ((search-spaces-regexp (if (or (not isearch-mode) isearch-regexp) Info-search-whitespace-regexp))) *************** *** 1717,1736 **** (setq list (cdr list)) (setq give-up nil found nil) (while (and (not give-up) ! (save-match-data ! (or (null found) ! (if backward ! (isearch-range-invisible found beg-found) ! (isearch-range-invisible beg-found found)) ! ;; Skip node header line ! (and (save-excursion (forward-line -1) ! (looking-at "\^_")) ! (forward-line (if backward -1 1))) ! ;; Skip Tag Table node ! (save-excursion ! (and (search-backward "\^_" nil t) ! (looking-at ! "\^_\n\\(Tag Table\\|Local Variables\\)")))))) (let ((search-spaces-regexp (if (or (not isearch-mode) isearch-regexp) Info-search-whitespace-regexp))) --- 1708,1715 ---- (setq list (cdr list)) (setq give-up nil found nil) (while (and (not give-up) ! (or (null found) ! (not (funcall isearch-success-function beg-found found)))) (let ((search-spaces-regexp (if (or (not isearch-mode) isearch-regexp) Info-search-whitespace-regexp))) *************** *** 1836,1841 **** --- 1815,1842 ---- (defun Info-isearch-start () (setq Info-isearch-initial-node nil)) + + (defun Info-search-success-function (beg-found found) + "Skip invisible text, node header line and Tag Table node." + (save-match-data + (let ((backward (< found beg-found))) + (not + (or + (if backward + (or (text-property-not-all found beg-found 'invisible nil) + (text-property-not-all found beg-found 'display nil)) + (or (text-property-not-all beg-found found 'invisible nil) + (text-property-not-all beg-found found 'display nil))) + ;; Skip node header line + (and (save-excursion (forward-line -1) + (looking-at "\^_")) + (forward-line (if backward -1 1))) + ;; Skip Tag Table node + (save-excursion + (and (search-backward "\^_" nil t) + (looking-at + "\^_\n\\(Tag Table\\|Local Variables\\)")))))))) + (defun Info-extract-pointer (name &optional errorname) "Extract the value of the node-pointer named NAME. *************** *** 3457,3462 **** --- 3458,3465 ---- 'Info-isearch-wrap) (set (make-local-variable 'isearch-push-state-function) 'Info-isearch-push-state) + (set (make-local-variable 'isearch-success-function) + 'Info-search-success-function) (set (make-local-variable 'search-whitespace-regexp) Info-search-whitespace-regexp) (set (make-local-variable 'revert-buffer-function) -- Juri Linkov http://www.jurta.org/emacs/