From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#11381: 23.3; isearch-search-and-update issue? Date: Sun, 27 May 2012 12:35:20 +0300 Organization: JURTA Message-ID: <878vge3ri7.fsf@mail.jurta.org> References: <4F9DC154.2000605@groveronline.com> <87ipgggtmw.fsf@mail.jurta.org> <878vhcc4nl.fsf@mail.jurta.org> <87vcjxdt5p.fsf@mail.jurta.org> <87vcjvwtxa.fsf@mail.jurta.org> <87r4ufhfmi.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1338112559 15516 80.91.229.3 (27 May 2012 09:55:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 May 2012 09:55:59 +0000 (UTC) Cc: 11381@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 27 11:55:58 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SYaCb-0001Ge-RB for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 May 2012 11:55:57 +0200 Original-Received: from localhost ([::1]:50641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYaCb-0007jn-K4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 May 2012 05:55:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYaCY-0007jf-7G for bug-gnu-emacs@gnu.org; Sun, 27 May 2012 05:55:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYaCV-0007h9-OX for bug-gnu-emacs@gnu.org; Sun, 27 May 2012 05:55:53 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYaCV-0007h3-IM for bug-gnu-emacs@gnu.org; Sun, 27 May 2012 05:55:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SYaDe-0007nV-0C for bug-gnu-emacs@gnu.org; Sun, 27 May 2012 05:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 May 2012 09:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11381 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11381-submit@debbugs.gnu.org id=B11381.133811261729951 (code B ref 11381); Sun, 27 May 2012 09:57:01 +0000 Original-Received: (at 11381) by debbugs.gnu.org; 27 May 2012 09:56:57 +0000 Original-Received: from localhost ([127.0.0.1]:45255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYaDY-0007n1-Nm for submit@debbugs.gnu.org; Sun, 27 May 2012 05:56:57 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:45701 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYaDD-0007mO-C4 for 11381@debbugs.gnu.org; Sun, 27 May 2012 05:56:54 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id F20EA451CA5B; Sun, 27 May 2012 02:55:20 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 20 May 2012 21:36:11 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60388 Archived-At: >> + (if (eq isearch-word 'symbol-search-regexp) >> + "symbol " > > Comparing two functions for equality is a bad idea. Comparing two functions can be avoided by using properties on function symbols like in the patch below. The same solution of using symbol properties could be used also for isearch filters to replace (and (eq isearch-filter-predicate 'isearch-filter-visible) search-invisible)) with (and (symbolp isearch-filter-predicate) (get isearch-filter-predicate 'visible) search-invisible)) and (put 'isearch-filter-visible 'visible t) === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-05-17 00:03:49 +0000 +++ lisp/isearch.el 2012-05-27 09:34:07 +0000 @@ -1468,6 +1500,20 @@ (defun word-search-forward-lax (string & (interactive "sWord search: ") (re-search-forward (word-search-regexp string t) bound noerror count)) +;; Symbol search + +(defun symbol-search-regexp (string &optional lax) + "Return a regexp which matches STRING as a symbol. +Creates a regexp where STRING is surrounded by symbol delimiters \\_< and \\_>. +If LAX is non-nil, the end of the string need not match a symbol +boundary unless it ends in whitespace." + (concat + "\\_<" + (regexp-quote string) + (if (or (not lax) (string-match-p "\\W$" string)) "\\_>"))) + +(put 'symbol-search-regexp 'isearch-message-prefix "symbol ") + (defun isearch-query-replace (&optional delimited regexp-flag) "Start `query-replace' with string to replace from last search string. @@ -2329,7 +2428,11 @@ (defun isearch-message-prefix (&optional (< (point) isearch-opoint))) "over") (if isearch-wrapped "wrapped ") - (if isearch-word "word " "") + (if isearch-word + (or (and (symbolp isearch-word) + (get isearch-word 'isearch-message-prefix)) + "word ") + "") (if isearch-regexp "regexp " "") (if multi-isearch-next-buffer-current-function "multi " "") (or isearch-message-prefix-add "")