From unknown Wed Jun 18 23:11:18 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#11381 <11381@debbugs.gnu.org> To: bug#11381 <11381@debbugs.gnu.org> Subject: Status: 23.3; isearch-search-and-update issue? Reply-To: bug#11381 <11381@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:11:18 +0000 retitle 11381 23.3; isearch-search-and-update issue? reassign 11381 emacs submitter 11381 Andy Grover severity 11381 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 29 18:59:46 2012 Received: (at submit) by debbugs.gnu.org; 29 Apr 2012 22:59:46 +0000 Received: from localhost ([127.0.0.1]:58194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SOd5V-0003D3-WE for submit@debbugs.gnu.org; Sun, 29 Apr 2012 18:59:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38411) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SOcgG-0002bA-3X for submit@debbugs.gnu.org; Sun, 29 Apr 2012 18:33:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SOces-0001lJ-Q8 for submit@debbugs.gnu.org; Sun, 29 Apr 2012 18:32:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,FROM_12LTRDOM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:59841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOces-0001lE-NF for submit@debbugs.gnu.org; Sun, 29 Apr 2012 18:31:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOceq-0000QQ-FU for bug-gnu-emacs@gnu.org; Sun, 29 Apr 2012 18:31:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SOcen-0001kz-UK for bug-gnu-emacs@gnu.org; Sun, 29 Apr 2012 18:31:55 -0400 Received: from pigeon.buunabet.com ([198.145.19.6]:33931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOcen-0001ks-L2 for bug-gnu-emacs@gnu.org; Sun, 29 Apr 2012 18:31:53 -0400 Received: by pigeon.buunabet.com (Postfix, from userid 501) id 30E7B5FECF; Sun, 29 Apr 2012 15:31:50 -0700 (PDT) Received: from [192.168.1.112] (c-76-115-41-54.hsd1.or.comcast.net [76.115.41.54]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by pigeon.buunabet.com (Postfix) with ESMTPSA id 086E65FD42 for ; Sun, 29 Apr 2012 15:31:48 -0700 (PDT) Message-ID: <4F9DC154.2000605@groveronline.com> Date: Sun, 29 Apr 2012 15:31:48 -0700 From: Andy Grover User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: 23.3; isearch-search-and-update issue? X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 29 Apr 2012 18:59:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Hi I'm trying to use the following macro as defined on the emacs wiki: http://emacswiki.org/emacs/SearchAtPoint#toc10 (defun my-isearch-word-at-point () (interactive) (call-interactively 'isearch-forward-regexp)) (defun my-isearch-yank-word-hook () (when (equal this-command 'my-isearch-word-at-point) (let ((string (concat "\\_<" (buffer-substring-no-properties (progn (skip-syntax-backward "w_") (point)) (progn (skip-syntax-forward "w_") (point))) "\\_>"))) (if (and isearch-case-fold-search (eq 'not-yanks search-upper-case)) (setq string (downcase string))) (setq isearch-string string isearch-message (concat isearch-message (mapconcat 'isearch-text-char-description string "")) isearch-yank-flag t) (isearch-search-and-update)))) (add-hook 'isearch-mode-hook 'my-isearch-yank-word-hook) (global-set-key "\M-8" 'my-isearch-word-at-point) However, it's saying "wrong type argument: arrayp nil" sometimes. Am I doing something wrong or is this a bug? Thanks -- Andy In GNU Emacs 23.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.8) of 2012-01-13 on x86-04.phx2.fedoraproject.org Windowing system distributor `Fedora Project', version 11.0.11104000 configured using `configure '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro '' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.utf8 value of $XMODIFIERS: @im=none locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: which-function-mode: t show-paren-mode: t desktop-save-mode: t cua-mode: t tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-encryption-mode: t auto-compression-mode: t size-indication-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-e M-e M-q M-e M-e ; ; C-x C-s M-e M-e M-e C-s i s e a r c h - y a n k - f l a g C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s M-x f i l l c C-h C-h C-h C-g C-g C-h v f i l l c o l C-x 1 M-e M-e M-e M-e M-q C-x C-e M-8 M-8 M-8 M-8 M-8 Recent messages: Saving file /home/agrover/git/conffiles/.emacs.d/init.el... Wrote /home/agrover/git/conffiles/.emacs.d/init.el Mark saved where search started [2 times] Making completion list... Quit Type C-x 1 to delete the help window. my-isearch-yank-word-hook isearch-search-and-update: Wrong type argument: arrayp, nil Mark saved where search started isearch-search-and-update: Wrong type argument: arrayp, nil [3 times] isearch-search-and-update: Wrong type argument: arrayp, nil Load-path shadows: None found. Features: (shadow sort mail-extr message ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash mail-utils emacsbug pp jka-compr find-func help-mode view help-fns newcomment multi-isearch hideshow which-func imenu cc-mode cc-fonts easymenu cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt hi-lock vc-git midnight swbuff ido saveplace paren desktop cua-base cus-start cus-load tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 29 20:36:05 2012 Received: (at 11381) by debbugs.gnu.org; 30 Apr 2012 00:36:05 +0000 Received: from localhost ([127.0.0.1]:58269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SOeay-0005La-E0 for submit@debbugs.gnu.org; Sun, 29 Apr 2012 20:36:05 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:57597 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SOeae-0005Ks-6Y for 11381@debbugs.gnu.org; Sun, 29 Apr 2012 20:36:03 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id A089E451C193; Sun, 29 Apr 2012 17:34:23 -0700 (PDT) From: Juri Linkov To: Andy Grover Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA References: <4F9DC154.2000605@groveronline.com> Date: Mon, 30 Apr 2012 03:27:01 +0300 In-Reply-To: <4F9DC154.2000605@groveronline.com> (Andy Grover's message of "Sun, 29 Apr 2012 15:31:48 -0700") Message-ID: <87vcki6p9a.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > However, it's saying "wrong type argument: arrayp nil" sometimes. > > Am I doing something wrong or is this a bug? Well, I recommend you to call `my-isearch-yank-word-hook' from `my-isearch-word-at-point' (after `isearch-forward-regexp') instead of adding it to the hook `isearch-mode-hook'. From debbugs-submit-bounces@debbugs.gnu.org Tue May 01 05:24:00 2012 Received: (at 11381) by debbugs.gnu.org; 1 May 2012 09:24:00 +0000 Received: from localhost ([127.0.0.1]:60401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SP9JP-0005tu-QW for submit@debbugs.gnu.org; Tue, 01 May 2012 05:24:00 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:54360 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SP9JM-0005te-EG for 11381@debbugs.gnu.org; Tue, 01 May 2012 05:23:57 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id A1A95451C9C8; Tue, 1 May 2012 02:22:27 -0700 (PDT) From: Juri Linkov To: Andy Grover Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA References: <4F9DC154.2000605@groveronline.com> Date: Tue, 01 May 2012 12:03:41 +0300 In-Reply-To: <4F9DC154.2000605@groveronline.com> (Andy Grover's message of "Sun, 29 Apr 2012 15:31:48 -0700") Message-ID: <87ipgggtmw.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Hi I'm trying to use the following macro as defined on the emacs wiki: > > http://emacswiki.org/emacs/SearchAtPoint#toc10 Looking at how this page presents 12 ways to invent the wheel, the question arises: why not help people with some basic functionality in isearch.el that could be used to build commands that will work reliably and without such problems as reported by this bug report. ISTM, what people are trying to achieve can be divided into the three wishes: 1. Start Isearch with an initial search string, such as the word/symbol at point. One way would be to add a new argument to all commands that start Isearch. But the drawback is that there are too many such commands (isearch-forward, isearch-backward, isearch-forward-regexp etc.) A better method is to add a global variable e.g. `isearch-string-initial' that will allow the user to define the initial search string. 2. Yank a thing at point to the search string (mostly a symbol/identifier). This means adding more yanking commands to accompany the existing `isearch-yank-word', `isearch-yank-word-or-char', etc. 3. Add a new search type for symbol/identifier, similar to word search. First we could try to reuse the existing `isearch-word'. Currently `word-search-regexp' converts the search string to a regular expression with \b at word boundaries. For a symbol/identifier it could add \_< and \_> at symbol boundaries. From debbugs-submit-bounces@debbugs.gnu.org Tue May 01 09:09:56 2012 Received: (at 11381) by debbugs.gnu.org; 1 May 2012 13:09:56 +0000 Received: from localhost ([127.0.0.1]:60510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SPCq3-0004Ii-WD for submit@debbugs.gnu.org; Tue, 01 May 2012 09:09:56 -0400 Received: from ironport-out.teksavvy.com ([206.248.143.162]:44654) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SPCq1-0004IW-OF for 11381@debbugs.gnu.org; Tue, 01 May 2012 09:09:54 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApYIACxOgk9soX5J/2dsb2JhbABDuCMDgQyBCIIJAQEEAVYjBQsLNBIUGA0kiBwFtjKLYYR5BKRFgV2DA4E4Fw X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="177955709" Received: from 108-161-126-73.dsl.teksavvy.com (HELO pastel.home) ([108.161.126.73]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 01 May 2012 09:08:21 -0400 Received: by pastel.home (Postfix, from userid 20848) id 02B11590E8; Tue, 1 May 2012 09:08:20 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: References: <4F9DC154.2000605@groveronline.com> <87ipgggtmw.fsf@mail.jurta.org> Date: Tue, 01 May 2012 09:08:20 -0400 In-Reply-To: <87ipgggtmw.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 01 May 2012 12:03:41 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org, Andy Grover X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Looking at how this page presents 12 ways to invent the wheel, > the question arises: why not help people with some basic functionality > in isearch.el that could be used to build commands that will > work reliably and without such problems as reported by this bug report. Sounds like a good idea. To solve nb 3 (i.e. searching for a symbol), all that's needed is to set isearch-search-fun-function, so the mechanism is there. The problem is that it's clunky to use because you can't just let-bind that variable around the call to isearch-forward. So one thing we (c|sh)ould provide is a general way to "run isearch with the following vars temporarily bound to these values". Maybe simply a new function that runs isearch in a recursive-edit would be all that's needed (so you can let-bind the vars around the call to that function). Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue May 01 11:23:28 2012 Received: (at 11381) by debbugs.gnu.org; 1 May 2012 15:23:29 +0000 Received: from localhost ([127.0.0.1]:60930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SPEvH-0000Zq-Rn for submit@debbugs.gnu.org; Tue, 01 May 2012 11:23:28 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:46233 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SPEvE-0000Zb-4I for 11381@debbugs.gnu.org; Tue, 01 May 2012 11:23:26 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 5DA3A451C99F; Tue, 1 May 2012 08:21:55 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA References: <4F9DC154.2000605@groveronline.com> <87ipgggtmw.fsf@mail.jurta.org> Date: Tue, 01 May 2012 18:17:02 +0300 In-Reply-To: (Stefan Monnier's message of "Tue, 01 May 2012 09:08:20 -0400") Message-ID: <878vhcc4nl.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org, Andy Grover X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Sounds like a good idea. To solve nb 3 (i.e. searching for a symbol), > all that's needed is to set isearch-search-fun-function, so the > mechanism is there. `isearch-word' binds the search function to `word-search-forward' and `word-search-backward', so perhaps new functions `symbol-search-forward' and `symbol-search-backward' will be necessary too. > The problem is that it's clunky to use because you can't just let-bind > that variable around the call to isearch-forward. So one thing we > (c|sh)ould provide is a general way to "run isearch with the following > vars temporarily bound to these values". > Maybe simply a new function that runs isearch in a recursive-edit would > be all that's needed (so you can let-bind the vars around the call to > that function). Another variant to try is to set these variables in a function added to `isearch-mode-hook'. From debbugs-submit-bounces@debbugs.gnu.org Tue May 15 17:39:40 2012 Received: (at 11381) by debbugs.gnu.org; 15 May 2012 21:39:40 +0000 Received: from localhost ([127.0.0.1]:56734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUPT1-0007JA-IP for submit@debbugs.gnu.org; Tue, 15 May 2012 17:39:40 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:58285 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUPSx-0007Iz-Rm for 11381@debbugs.gnu.org; Tue, 15 May 2012 17:39:37 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id AB6F4451C9FB for <11381@debbugs.gnu.org>; Tue, 15 May 2012 14:39:27 -0700 (PDT) From: Juri Linkov To: 11381@debbugs.gnu.org Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA References: <4F9DC154.2000605@groveronline.com> <87ipgggtmw.fsf@mail.jurta.org> <878vhcc4nl.fsf@mail.jurta.org> Date: Wed, 16 May 2012 00:35:30 +0300 In-Reply-To: <878vhcc4nl.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 01 May 2012 18:17:02 +0300") Message-ID: <87vcjxdt5p.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > `isearch-word' binds the search function to `word-search-forward' > and `word-search-backward', so perhaps new functions > `symbol-search-forward' and `symbol-search-backward' > will be necessary too. Before trying to implement `symbol-search-forward', word-search-{for,back}ward{-lax,} need to be moved to Elisp as Stefan asked to do for 24.2 in bug#10145. Below is a complete patch that moves them to Elisp: === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-02-23 00:36:49 +0000 +++ lisp/isearch.el 2012-05-15 21:27:45 +0000 @@ -1381,6 +1393,94 @@ (defun isearch-toggle-case-fold () (sit-for 1) (isearch-update)) + +;; Word search + +(defun word-search-regexp (string &optional lax) + "Return a regexp which matches words, ignoring punctuation. +Given STRING, a string of words separated by word delimiters, +compute a regexp that matches those exact words separated by +arbitrary punctuation. If LAX is non-nil, the end of the string +need not match a word boundary unless it ends in whitespace. + +Used in `word-search-forward', `word-search-backward', +`word-search-forward-lax', `word-search-backward-lax'." + (if (string-match-p "^\\W*$" string) + "" + (concat + "\\b" + (mapconcat 'identity (split-string string "\\W+" t) "\\W+") + (if (or (not lax) (string-match-p "\\W$" string)) "\\b")))) + +(defun word-search-backward (string &optional bound noerror count) + "Search backward from point for STRING, ignoring differences in punctuation. +Set point to the beginning of the occurrence found, and return point. +An optional second argument bounds the search; it is a buffer position. +The match found must not extend before that position. +Optional third argument, if t, means if fail just return nil (no error). + If not nil and not t, move to limit of search and return nil. +Optional fourth argument is repeat count--search for successive occurrences. + +Relies on the function `word-search-regexp' to convert a sequence +of words in STRING to a regexp used to search words without regard +to punctuation." + (interactive "sWord search backward: ") + (re-search-backward (word-search-regexp string nil) bound noerror count)) + +(defun word-search-forward (string &optional bound noerror count) + "Search forward from point for STRING, ignoring differences in punctuation. +Set point to the end of the occurrence found, and return point. +An optional second argument bounds the search; it is a buffer position. +The match found must not extend after that position. +Optional third argument, if t, means if fail just return nil (no error). + If not nil and not t, move to limit of search and return nil. +Optional fourth argument is repeat count--search for successive occurrences. + +Relies on the function `word-search-regexp' to convert a sequence +of words in STRING to a regexp used to search words without regard +to punctuation." + (interactive "sWord search: ") + (re-search-forward (word-search-regexp string nil) bound noerror count)) + +(defun word-search-backward-lax (string &optional bound noerror count) + "Search backward from point for STRING, ignoring differences in punctuation. +Set point to the beginning of the occurrence found, and return point. + +Unlike `word-search-backward', the end of STRING need not match a word +boundary, unless STRING ends in whitespace. + +An optional second argument bounds the search; it is a buffer position. +The match found must not extend before that position. +Optional third argument, if t, means if fail just return nil (no error). + If not nil and not t, move to limit of search and return nil. +Optional fourth argument is repeat count--search for successive occurrences. + +Relies on the function `word-search-regexp' to convert a sequence +of words in STRING to a regexp used to search words without regard +to punctuation." + (interactive "sWord search backward: ") + (re-search-backward (word-search-regexp string t) bound noerror count)) + +(defun word-search-forward-lax (string &optional bound noerror count) + "Search forward from point for STRING, ignoring differences in punctuation. +Set point to the end of the occurrence found, and return point. + +Unlike `word-search-forward', the end of STRING need not match a word +boundary, unless STRING ends in whitespace. + +An optional second argument bounds the search; it is a buffer position. +The match found must not extend after that position. +Optional third argument, if t, means if fail just return nil (no error). + If not nil and not t, move to limit of search and return nil. +Optional fourth argument is repeat count--search for successive occurrences. + +Relies on the function `word-search-regexp' to convert a sequence +of words in STRING to a regexp used to search words without regard +to punctuation." + (interactive "sWord search: ") + (re-search-forward (word-search-regexp string t) bound noerror count)) + + (defun isearch-query-replace (&optional delimited regexp-flag) "Start `query-replace' with string to replace from last search string. The arg DELIMITED (prefix arg if interactive), if non-nil, means replace === modified file 'src/search.c' --- src/search.c 2012-03-27 06:46:42 +0000 +++ src/search.c 2012-05-15 21:27:00 +0000 @@ -2078,102 +2078,6 @@ (at your option) any later version. XSETBUFFER (last_thing_searched, current_buffer); } -DEFUN ("word-search-regexp", Fword_search_regexp, Sword_search_regexp, 1, 2, 0, - doc: /* Return a regexp which matches words, ignoring punctuation. -Given STRING, a string of words separated by word delimiters, -compute a regexp that matches those exact words separated by -arbitrary punctuation. If LAX is non-nil, the end of the string -need not match a word boundary unless it ends in whitespace. - -Used in `word-search-forward', `word-search-backward', -`word-search-forward-lax', `word-search-backward-lax'. */) - (Lisp_Object string, Lisp_Object lax) -{ - register unsigned char *o; - register EMACS_INT i, i_byte, len, punct_count = 0, word_count = 0; - Lisp_Object val; - int prev_c = 0; - EMACS_INT adjust; - int whitespace_at_end; - - CHECK_STRING (string); - len = SCHARS (string); - - for (i = 0, i_byte = 0; i < len; ) - { - int c; - - FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, i, i_byte); - - if (SYNTAX (c) != Sword) - { - punct_count++; - if (SYNTAX (prev_c) == Sword) - word_count++; - } - - prev_c = c; - } - - if (SYNTAX (prev_c) == Sword) - { - word_count++; - whitespace_at_end = 0; - } - else - { - whitespace_at_end = 1; - if (!word_count) - return empty_unibyte_string; - } - - adjust = - punct_count + 5 * (word_count - 1) - + ((!NILP (lax) && !whitespace_at_end) ? 2 : 4); - if (STRING_MULTIBYTE (string)) - val = make_uninit_multibyte_string (len + adjust, - SBYTES (string) - + adjust); - else - val = make_uninit_string (len + adjust); - - o = SDATA (val); - *o++ = '\\'; - *o++ = 'b'; - prev_c = 0; - - for (i = 0, i_byte = 0; i < len; ) - { - int c; - EMACS_INT i_byte_orig = i_byte; - - FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, i, i_byte); - - if (SYNTAX (c) == Sword) - { - memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig); - o += i_byte - i_byte_orig; - } - else if (SYNTAX (prev_c) == Sword && --word_count) - { - *o++ = '\\'; - *o++ = 'W'; - *o++ = '\\'; - *o++ = 'W'; - *o++ = '*'; - } - - prev_c = c; - } - - if (NILP (lax) || whitespace_at_end) - { - *o++ = '\\'; - *o++ = 'b'; - } - - return val; -} - DEFUN ("search-backward", Fsearch_backward, Ssearch_backward, 1, 4, "MSearch backward: ", doc: /* Search backward from point for STRING. @@ -2216,86 +2120,6 @@ (at your option) any later version. return search_command (string, bound, noerror, count, 1, 0, 0); } -DEFUN ("word-search-backward", Fword_search_backward, Sword_search_backward, 1, 4, - "sWord search backward: ", - doc: /* Search backward from point for STRING, ignoring differences in punctuation. -Set point to the beginning of the occurrence found, and return point. -An optional second argument bounds the search; it is a buffer position. -The match found must not extend before that position. -Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. - -Relies on the function `word-search-regexp' to convert a sequence -of words in STRING to a regexp used to search words without regard -to punctuation. */) - (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) -{ - return search_command (Fword_search_regexp (string, Qnil), bound, noerror, count, -1, 1, 0); -} - -DEFUN ("word-search-forward", Fword_search_forward, Sword_search_forward, 1, 4, - "sWord search: ", - doc: /* Search forward from point for STRING, ignoring differences in punctuation. -Set point to the end of the occurrence found, and return point. -An optional second argument bounds the search; it is a buffer position. -The match found must not extend after that position. -Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. - -Relies on the function `word-search-regexp' to convert a sequence -of words in STRING to a regexp used to search words without regard -to punctuation. */) - (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) -{ - return search_command (Fword_search_regexp (string, Qnil), bound, noerror, count, 1, 1, 0); -} - -DEFUN ("word-search-backward-lax", Fword_search_backward_lax, Sword_search_backward_lax, 1, 4, - "sWord search backward: ", - doc: /* Search backward from point for STRING, ignoring differences in punctuation. -Set point to the beginning of the occurrence found, and return point. - -Unlike `word-search-backward', the end of STRING need not match a word -boundary, unless STRING ends in whitespace. - -An optional second argument bounds the search; it is a buffer position. -The match found must not extend before that position. -Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. - -Relies on the function `word-search-regexp' to convert a sequence -of words in STRING to a regexp used to search words without regard -to punctuation. */) - (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) -{ - return search_command (Fword_search_regexp (string, Qt), bound, noerror, count, -1, 1, 0); -} - -DEFUN ("word-search-forward-lax", Fword_search_forward_lax, Sword_search_forward_lax, 1, 4, - "sWord search: ", - doc: /* Search forward from point for STRING, ignoring differences in punctuation. -Set point to the end of the occurrence found, and return point. - -Unlike `word-search-forward', the end of STRING need not match a word -boundary, unless STRING ends in whitespace. - -An optional second argument bounds the search; it is a buffer position. -The match found must not extend after that position. -Optional third argument, if t, means if fail just return nil (no error). - If not nil and not t, move to limit of search and return nil. -Optional fourth argument is repeat count--search for successive occurrences. - -Relies on the function `word-search-regexp' to convert a sequence -of words in STRING to a regexp used to search words without regard -to punctuation. */) - (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count) -{ - return search_command (Fword_search_regexp (string, Qt), bound, noerror, count, 1, 1, 0); -} - DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4, "sRE search backward: ", doc: /* Search backward from point for match for regular expression REGEXP. @@ -3252,11 +3076,6 @@ (at your option) any later version. defsubr (&Sposix_string_match); defsubr (&Ssearch_forward); defsubr (&Ssearch_backward); - defsubr (&Sword_search_regexp); - defsubr (&Sword_search_forward); - defsubr (&Sword_search_backward); - defsubr (&Sword_search_forward_lax); - defsubr (&Sword_search_backward_lax); defsubr (&Sre_search_forward); defsubr (&Sre_search_backward); defsubr (&Sposix_search_forward); From debbugs-submit-bounces@debbugs.gnu.org Tue May 15 22:36:05 2012 Received: (at 11381) by debbugs.gnu.org; 16 May 2012 02:36:05 +0000 Received: from localhost ([127.0.0.1]:56851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUU5t-0006et-95 for submit@debbugs.gnu.org; Tue, 15 May 2012 22:36:05 -0400 Received: from ironport-out.teksavvy.com ([206.248.143.162]:32827) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUU5s-0006eG-1c for 11381@debbugs.gnu.org; Tue, 15 May 2012 22:36:04 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApYIACxOgk9FpZcD/2dsb2JhbABDuCMDgQyBCIIJAQEEAVYjBQsLNBIUGA0kiBwFtjKLYYR5BKRFgV2DAw X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="180454994" Received: from 69-165-151-3.dsl.teksavvy.com (HELO ceviche.home) ([69.165.151.3]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 15 May 2012 22:35:50 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 4E83A660E0; Tue, 15 May 2012 22:35:48 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: References: <4F9DC154.2000605@groveronline.com> <87ipgggtmw.fsf@mail.jurta.org> <878vhcc4nl.fsf@mail.jurta.org> <87vcjxdt5p.fsf@mail.jurta.org> Date: Tue, 15 May 2012 22:35:48 -0400 In-Reply-To: <87vcjxdt5p.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 16 May 2012 00:35:30 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Before trying to implement `symbol-search-forward', > word-search-{for,back}ward{-lax,} need to be moved to Elisp as > Stefan asked to do for 24.2 in bug#10145. > Below is a complete patch that moves them to Elisp: Feel free to install it on the trunk, thanks, Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed May 16 20:11:06 2012 Received: (at 11381) by debbugs.gnu.org; 17 May 2012 00:11:06 +0000 Received: from localhost ([127.0.0.1]:58281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUoJ2-0001Xp-Ri for submit@debbugs.gnu.org; Wed, 16 May 2012 20:11:02 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:58487 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SUoIi-0001XF-Qt for 11381@debbugs.gnu.org; Wed, 16 May 2012 20:11:00 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 9AC3A451C8E3; Wed, 16 May 2012 17:10:26 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA References: <4F9DC154.2000605@groveronline.com> <87ipgggtmw.fsf@mail.jurta.org> <878vhcc4nl.fsf@mail.jurta.org> <87vcjxdt5p.fsf@mail.jurta.org> Date: Thu, 17 May 2012 03:08:33 +0300 In-Reply-To: (Stefan Monnier's message of "Tue, 15 May 2012 22:35:48 -0400") Message-ID: <87vcjvwtxa.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> Below is a complete patch that moves them to Elisp: > > Feel free to install it on the trunk, thanks, Installed. Regarding the addition of symbol search functions, I hesitate to define 7 more functions for every search type. If now add symbol-search-forward, symbol-search-backward, symbol-search-forward-lax, symbol-search-backward-lax, and two functions to activate the symbol search isearch-forward-symbol, isearch-backward-symbol, then later someone might ask to add a subword search type with subword-search-forward, subword-search-backward, subword-search-forward-lax, subword-search-backward-lax, isearch-forward-subword, isearch-backward-subword, and so on. This will grow isearch.el unnecessarily. When trying to achieve simplicity, all what is needed to define for every regexp-based search type is just: 1. Define a string-to-regexp conversion function (like `word-search-regexp'). 2. Define a key sequence to activate this search type. This is a minimal set of requirements to define a new regexp-based search type. I believe a set of search filters for bug#11378 could be defined in the same simple way: 1. Define a filter predicate function (like `isearch-filter-visible'). 2. Define a key sequence to activate this search filter. From debbugs-submit-bounces@debbugs.gnu.org Sat May 19 20:32:37 2012 Received: (at 11381) by debbugs.gnu.org; 20 May 2012 00:32:37 +0000 Received: from localhost ([127.0.0.1]:34849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SVu4b-0001SK-8Z for submit@debbugs.gnu.org; Sat, 19 May 2012 20:32:37 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:48587 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SVu4E-0001Rg-3y for 11381@debbugs.gnu.org; Sat, 19 May 2012 20:32:33 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 53F38451CA30; Sat, 19 May 2012 17:31:42 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA 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> Date: Sun, 20 May 2012 03:15:33 +0300 In-Reply-To: <87vcjvwtxa.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 17 May 2012 03:08:33 +0300") Message-ID: <87r4ufhfmi.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Regarding the addition of symbol search functions, I hesitate to > define 7 more functions for every search type. If now add > symbol-search-forward, symbol-search-backward, > symbol-search-forward-lax, symbol-search-backward-lax, > and two functions to activate the symbol search > isearch-forward-symbol, isearch-backward-symbol, > then later someone might ask to add a subword search type > with subword-search-forward, subword-search-backward, > subword-search-forward-lax, subword-search-backward-lax, > isearch-forward-subword, isearch-backward-subword, > and so on. This will grow isearch.el unnecessarily. > > When trying to achieve simplicity, all what is needed to define > for every regexp-based search type is just: > > 1. Define a string-to-regexp conversion function > (like `word-search-regexp'). > > 2. Define a key sequence to activate this search type. > > This is a minimal set of requirements to define a new regexp-based > search type. There are more limitations that affect the design of this feature: it would be desirable to reuse the existing search type variable `isearch-word' because it's used in too many places like: recording the search status in the `isearch-cmds' stack, lazy-highlighting, external custom search functions. And also the aim is to to reuse 4 existing functions word-search-{for,back}ward{-lax,} because they are used in `isearch-search-fun' and some other packages that override the default search function. So the minimal set of changes would be like in the following patch. It also allows adding more regexp-based search types with less changes due to `funcall'. === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-05-15 21:30:58 +0000 +++ lisp/isearch.el 2012-05-20 00:14:00 +0000 @@ -512,6 +512,7 @@ (defvar isearch-mode-map (define-key map "\M-sr" 'isearch-toggle-regexp) (define-key map "\M-sw" 'isearch-toggle-word) + (define-key map "\M-s_" 'isearch-toggle-symbol) (define-key map [?\M-%] 'isearch-query-replace) (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) @@ -626,6 +627,7 @@ (define-key esc-map "\C-s" 'isearch-forw (define-key global-map "\C-r" 'isearch-backward) (define-key esc-map "\C-r" 'isearch-backward-regexp) (define-key search-map "w" 'isearch-forward-word) +(define-key search-map "_" 'isearch-forward-symbol) ;; Entry points to isearch-mode. @@ -732,6 +735,16 @@ (defun isearch-forward-word (&optional n (interactive "P\np") (isearch-mode t nil nil (not no-recursive-edit) (null not-word))) +(defun isearch-forward-symbol (&optional not-symbol no-recursive-edit) + "\ +Do incremental search forward for a symbol. +The prefix argument is currently unused. +Like ordinary incremental search except that your input is treated +as a symbol surrounded by symbol boundary constructs \\_< and \\_>. +See the command `isearch-forward' for more information." + (interactive "P\np") + (isearch-mode t nil nil (not no-recursive-edit) 'symbol-search-regexp)) + (defun isearch-backward (&optional regexp-p no-recursive-edit) "\ Do incremental search backward. @@ -1379,6 +1392,13 @@ (defun isearch-toggle-word () (setq isearch-success t isearch-adjusted t) (isearch-update)) +(defun isearch-toggle-symbol () + "Toggle symbol searching on or off." + (interactive) + (setq isearch-word (unless (eq isearch-word 'symbol-search-regexp) 'symbol-search-regexp)) + (setq isearch-success t isearch-adjusted t) + (isearch-update)) + (defun isearch-toggle-case-fold () "Toggle case folding in searching on or off." (interactive) @@ -1425,7 +1445,11 @@ (defun word-search-backward (string &opt of words in STRING to a regexp used to search words without regard to punctuation." (interactive "sWord search backward: ") - (re-search-backward (word-search-regexp string nil) bound noerror count)) + (re-search-backward + (if (functionp isearch-word) + (funcall isearch-word string nil) + (word-search-regexp string nil)) + bound noerror count)) (defun word-search-forward (string &optional bound noerror count) "Search forward from point for STRING, ignoring differences in punctuation. @@ -1440,7 +1464,11 @@ (defun word-search-forward (string &opti of words in STRING to a regexp used to search words without regard to punctuation." (interactive "sWord search: ") - (re-search-forward (word-search-regexp string nil) bound noerror count)) + (re-search-forward + (if (functionp isearch-word) + (funcall isearch-word string nil) + (word-search-regexp string nil)) + bound noerror count)) (defun word-search-backward-lax (string &optional bound noerror count) "Search backward from point for STRING, ignoring differences in punctuation. @@ -1459,7 +1487,11 @@ (defun word-search-backward-lax (string of words in STRING to a regexp used to search words without regard to punctuation." (interactive "sWord search backward: ") - (re-search-backward (word-search-regexp string t) bound noerror count)) + (re-search-backward + (if (functionp isearch-word) + (funcall isearch-word string t) + (word-search-regexp string t)) + bound noerror count)) (defun word-search-forward-lax (string &optional bound noerror count) "Search forward from point for STRING, ignoring differences in punctuation. @@ -1478,7 +1510,23 @@ (defun word-search-forward-lax (string & of words in STRING to a regexp used to search words without regard to punctuation." (interactive "sWord search: ") - (re-search-forward (word-search-regexp string t) bound noerror count)) + (re-search-forward + (if (functionp isearch-word) + (funcall isearch-word string t) + (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)) "\\_>"))) (defun isearch-query-replace (&optional delimited regexp-flag) @@ -1546,6 +1594,8 @@ (defun isearch-occur (regexp &optional n (interactive (let* ((perform-collect (consp current-prefix-arg)) (regexp (cond + ((functionp isearch-word) + (funcall isearch-word isearch-string)) (isearch-word (word-search-regexp isearch-string)) (isearch-regexp isearch-string) (t (regexp-quote isearch-string))))) @@ -1763,6 +1813,8 @@ (defun isearch-search-and-update () (setq case-fold-search (isearch-no-upper-case-p isearch-string isearch-regexp))) (looking-at (cond + ((functionp isearch-word) + (funcall isearch-word isearch-string t)) (isearch-word (word-search-regexp isearch-string t)) (isearch-regexp isearch-string) (t (regexp-quote isearch-string))))) @@ -2348,7 +2400,9 @@ (defun isearch-message-prefix (&optional (< (point) isearch-opoint))) "over") (if isearch-wrapped "wrapped ") - (if isearch-word "word " "") + (if (eq isearch-word 'symbol-search-regexp) + "symbol " + (if isearch-word "word " "")) (if isearch-regexp "regexp " "") (if multi-isearch-next-buffer-current-function "multi " "") (or isearch-message-prefix-add "") From debbugs-submit-bounces@debbugs.gnu.org Sun May 20 21:36:57 2012 Received: (at 11381) by debbugs.gnu.org; 21 May 2012 01:36:57 +0000 Received: from localhost ([127.0.0.1]:35938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SWHYO-0005LF-OM for submit@debbugs.gnu.org; Sun, 20 May 2012 21:36:56 -0400 Received: from ironport-out.teksavvy.com ([206.248.143.162]:31599) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SWHYM-0005L3-La for 11381@debbugs.gnu.org; Sun, 20 May 2012 21:36:56 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmgFAOMAh0/O+K+j/2dsb2JhbAA3oRSCLoEIgXYBBVYjEAs0EhQYDSSqJIxkCQMBAoM+A4NwBKNjhFg X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="181526687" Received: from 206-248-175-163.dsl.teksavvy.com (HELO ceviche.home) ([206.248.175.163]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 20 May 2012 21:36:13 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 11B3D660E0; Sun, 20 May 2012 21:36:11 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: 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> Date: Sun, 20 May 2012 21:36:11 -0400 In-Reply-To: <87r4ufhfmi.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 20 May 2012 03:15:33 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > @@ -1425,7 +1445,11 @@ (defun word-search-backward (string &opt > of words in STRING to a regexp used to search words without regard > to punctuation." > (interactive "sWord search backward: ") > - (re-search-backward (word-search-regexp string nil) bound noerror count)) > + (re-search-backward > + (if (functionp isearch-word) > + (funcall isearch-word string nil) > + (word-search-regexp string nil)) > + bound noerror count)) This doesn't sound right. > + (if (eq isearch-word 'symbol-search-regexp) > + "symbol " Comparing two functions for equality is a bad idea. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun May 20 22:24:14 2012 Received: (at 11381) by debbugs.gnu.org; 21 May 2012 02:24:14 +0000 Received: from localhost ([127.0.0.1]:35960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SWIIA-0006PE-5p for submit@debbugs.gnu.org; Sun, 20 May 2012 22:24:14 -0400 Received: from ironport-out.teksavvy.com ([206.248.143.162]:52387) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SWII8-0006Oy-Eg for 11381@debbugs.gnu.org; Sun, 20 May 2012 22:24:12 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmgFAOMAh0/O+K+j/2dsb2JhbAA3oRSCLoEIgXYBBVYjEAs0EhQYDSSqJIxkCQMBAoM+A4NwBKNjhFg X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="181531062" Received: from 206-248-175-163.dsl.teksavvy.com (HELO ceviche.home) ([206.248.175.163]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 20 May 2012 22:23:31 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 29759660EE; Sun, 20 May 2012 22:23:31 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: 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> Date: Sun, 20 May 2012 22:23:31 -0400 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 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> @@ -1425,7 +1445,11 @@ (defun word-search-backward (string &opt >> of words in STRING to a regexp used to search words without regard >> to punctuation." >> (interactive "sWord search backward: ") >> - (re-search-backward (word-search-regexp string nil) bound noerror count)) >> + (re-search-backward >> + (if (functionp isearch-word) >> + (funcall isearch-word string nil) >> + (word-search-regexp string nil)) >> + bound noerror count)) > This doesn't sound right. I guess I was a bit terse here: what I meant is that changing the behavior depending on isearch-* variables is OK for a function named isearch-foo but not word-search-*ward. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun May 27 05:56:57 2012 Received: (at 11381) by debbugs.gnu.org; 27 May 2012 09:56:57 +0000 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 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 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) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA 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> Date: Sun, 27 May 2012 12:35:20 +0300 In-Reply-To: (Stefan Monnier's message of "Sun, 20 May 2012 21:36:11 -0400") Message-ID: <878vge3ri7.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> + (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 "") From debbugs-submit-bounces@debbugs.gnu.org Sun May 27 05:56:58 2012 Received: (at 11381) by debbugs.gnu.org; 27 May 2012 09:56:58 +0000 Received: from localhost ([127.0.0.1]:45259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYaDZ-0007n9-ID for submit@debbugs.gnu.org; Sun, 27 May 2012 05:56:58 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:45712 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYaDD-0007mR-RB for 11381@debbugs.gnu.org; Sun, 27 May 2012 05:56:55 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 3DBAE451CA52; Sun, 27 May 2012 02:55:23 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA 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> Date: Sun, 27 May 2012 12:43:37 +0300 In-Reply-To: (Stefan Monnier's message of "Sun, 20 May 2012 22:23:31 -0400") Message-ID: <87mx4u0xiu.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>> @@ -1425,7 +1445,11 @@ (defun word-search-backward (string &opt >>> of words in STRING to a regexp used to search words without regard >>> to punctuation." >>> (interactive "sWord search backward: ") >>> - (re-search-backward (word-search-regexp string nil) bound noerror count)) >>> + (re-search-backward >>> + (if (functionp isearch-word) >>> + (funcall isearch-word string nil) >>> + (word-search-regexp string nil)) >>> + bound noerror count)) >> This doesn't sound right. > > I guess I was a bit terse here: what I meant is that changing the > behavior depending on isearch-* variables is OK for a function named > isearch-foo but not word-search-*ward. Agreed. This patch adds 4 new functions `isearch-word-search-*'. Also it splits the standard default part of `isearch-search-fun' into a separate function `isearch-search-fun-default' that can be used to obtain the default search function in any special search function that overrides `isearch-search-fun' like is is demonstrated in the second patch for `minibuffer-history-isearch-search' below. Additionally it enables the word search in the minibuffer with no effort (the key clash with `M-s w' in the minibuffer is another issue). I'll also go through other search functions and enable word/symbol search in them as well. === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-05-17 00:03:49 +0000 +++ lisp/isearch.el 2012-05-27 09:43:07 +0000 @@ -1468,6 +1500,62 @@ (defun word-search-forward-lax (string & (interactive "sWord search: ") (re-search-forward (word-search-regexp string t) bound noerror count)) +;; General word-like regexp-based search. + +(defun isearch-word-search-backward (string &optional bound noerror count) + "Search backward from point for STRING, converted to regexp. +Like `word-search-backward', but uses a function from the variable +`isearch-word' to convert STRING to the regexp." + (re-search-backward + (if (functionp isearch-word) + (funcall isearch-word string nil) + (word-search-regexp string nil)) + bound noerror count)) + +(defun isearch-word-search-forward (string &optional bound noerror count) + "Search forward from point for STRING, converted to regexp. +Like `word-search-forward', but uses a function from the variable +`isearch-word' to convert STRING to the regexp." + (re-search-forward + (if (functionp isearch-word) + (funcall isearch-word string nil) + (word-search-regexp string nil)) + bound noerror count)) + +(defun isearch-word-search-backward-lax (string &optional bound noerror count) + "Search backward from point for STRING, converted to regexp. +Like `word-search-backward-lax', but uses a function from the variable +`isearch-word' to convert STRING to the regexp." + (re-search-backward + (if (functionp isearch-word) + (funcall isearch-word string t) + (word-search-regexp string t)) + bound noerror count)) + +(defun isearch-word-search-forward-lax (string &optional bound noerror count) + "Search forward from point for STRING, converted to regexp. +Like `word-search-forward-lax', but uses a function from the variable +`isearch-word' to convert STRING to the regexp." + (re-search-forward + (if (functionp isearch-word) + (funcall isearch-word string t) + (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. @@ -2370,20 +2473,23 @@ (defun isearch-search-fun () Can be changed via `isearch-search-fun-function' for special needs." (if isearch-search-fun-function (funcall isearch-search-fun-function) - (cond - (isearch-word - ;; Use lax versions to not fail at the end of the word while - ;; the user adds and removes characters in the search string - ;; (or when using nonincremental word isearch) - (if (or isearch-nonincremental - (eq (length isearch-string) - (length (isearch-string-state (car isearch-cmds))))) - (if isearch-forward 'word-search-forward 'word-search-backward) - (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax))) - (isearch-regexp - (if isearch-forward 're-search-forward 're-search-backward)) - (t - (if isearch-forward 'search-forward 'search-backward))))) + (isearch-search-fun-default))) + +(defun isearch-search-fun-default () + (cond + (isearch-word + ;; Use lax versions to not fail at the end of the word while + ;; the user adds and removes characters in the search string + ;; (or when using nonincremental word isearch) + (if (or isearch-nonincremental + (eq (length isearch-string) + (length (isearch-string-state (car isearch-cmds))))) + (if isearch-forward 'isearch-word-search-forward 'isearch-word-search-backward) + (if isearch-forward 'isearch-word-search-forward-lax 'isearch-word-search-backward-lax))) + (isearch-regexp + (if isearch-forward 're-search-forward 're-search-backward)) + (t + (if isearch-forward 'search-forward 'search-backward)))) (defun isearch-search-string (string bound noerror) "Search for the first occurrence of STRING or its translation. === modified file 'lisp/simple.el' --- lisp/simple.el 2012-05-12 21:11:21 +0000 +++ lisp/simple.el 2012-05-27 09:43:19 +0000 @@ -1771,18 +1771,10 @@ (defun minibuffer-history-isearch-end () (defun minibuffer-history-isearch-search () "Return the proper search function, for isearch in minibuffer history." - (cond - (isearch-word - (if isearch-forward 'word-search-forward 'word-search-backward)) - (t (lambda (string bound noerror) (let ((search-fun ;; Use standard functions to search within minibuffer text - (cond - (isearch-regexp - (if isearch-forward 're-search-forward 're-search-backward)) - (t - (if isearch-forward 'search-forward 'search-backward)))) + (isearch-search-fun-default)) found) ;; Avoid lazy-highlighting matches in the minibuffer prompt when ;; searching forward. Lazy-highlight calls this lambda with the @@ -1822,7 +1814,7 @@ (defun minibuffer-history-isearch-search ;; Return point of the new search result (point)) ;; Return nil when next(prev)-history-element fails - (error nil))))))))) + (error nil))))))) (defun minibuffer-history-isearch-message (&optional c-q-hack ellipsis) "Display the minibuffer history search prompt. From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 00:24:34 2012 Received: (at 11381) by debbugs.gnu.org; 28 May 2012 04:24:34 +0000 Received: from localhost ([127.0.0.1]:46003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYrVS-0000Ll-7x for submit@debbugs.gnu.org; Mon, 28 May 2012 00:24:34 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:29594) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYrVQ-0000La-Ew for 11381@debbugs.gnu.org; Mon, 28 May 2012 00:24:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCpYd/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kLoduBboJkEQDozOBWIMF X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="183056294" Received: from 76-10-150-29.dsl.teksavvy.com (HELO ceviche.home) ([76.10.150.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 May 2012 00:23:10 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 85FAF660E0; Mon, 28 May 2012 00:23:10 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: 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> <878vge3ri7.fsf@mail.jurta.org> Date: Mon, 28 May 2012 00:23:10 -0400 In-Reply-To: <878vge3ri7.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 27 May 2012 12:35:20 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Comparing two functions can be avoided by using properties > on function symbols like in the patch below. It's not perfect, but yes, it's much better. > 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)) Yes, that might also help allowing isearch-filter-predicate to take a list of functions. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 00:49:44 2012 Received: (at 11381) by debbugs.gnu.org; 28 May 2012 04:49:45 +0000 Received: from localhost ([127.0.0.1]:46032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYrto-00018g-6y for submit@debbugs.gnu.org; Mon, 28 May 2012 00:49:44 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:36625) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYrtl-00018U-OH for 11381@debbugs.gnu.org; Mon, 28 May 2012 00:49:42 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCpYd/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kE4gJBboJkEQDozOBWIMF X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="183056971" Received: from 76-10-150-29.dsl.teksavvy.com (HELO ceviche.home) ([76.10.150.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 May 2012 00:48:20 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 1A0C4660E0; Mon, 28 May 2012 00:48:19 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: 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> <87mx4u0xiu.fsf@mail.jurta.org> Date: Mon, 28 May 2012 00:48:19 -0400 In-Reply-To: <87mx4u0xiu.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 27 May 2012 12:43:37 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >>>>> "Juri" == Juri Linkov writes: >>>> @@ -1425,7 +1445,11 @@ (defun word-search-backward (string &opt >>>> of words in STRING to a regexp used to search words without regard >>>> to punctuation." >>>> (interactive "sWord search backward: ") >>>> - (re-search-backward (word-search-regexp string nil) bound noerror count)) >>>> + (re-search-backward >>>> + (if (functionp isearch-word) >>>> + (funcall isearch-word string nil) >>>> + (word-search-regexp string nil)) >>>> + bound noerror count)) >>> This doesn't sound right. >> >> I guess I was a bit terse here: what I meant is that changing the >> behavior depending on isearch-* variables is OK for a function named >> isearch-foo but not word-search-*ward. > Agreed. This patch adds 4 new functions `isearch-word-search-*'. Do we really need those 4? I think we can just get away with symbol-search-regexp (whose name also needs to start with "isearch-"). > Also it splits the standard default part of `isearch-search-fun' You could actually set isearch-search-fun-function's default to isearch-search-fun-default so we can just unconditionally call isearch-search-fun-function's. > into a separate function `isearch-search-fun-default' that can be > used to obtain the default search function in any special search > function that overrides `isearch-search-fun' like is is demonstrated > in the second patch for `minibuffer-history-isearch-search' below. > Additionally it enables the word search in the minibuffer with no effort > (the key clash with `M-s w' in the minibuffer is another issue). > I'll also go through other search functions and enable word/symbol search > in them as well. > === modified file 'lisp/isearch.el' > --- lisp/isearch.el 2012-05-17 00:03:49 +0000 > +++ lisp/isearch.el 2012-05-27 09:43:07 +0000 > @@ -1468,6 +1500,62 @@ (defun word-search-forward-lax (string & > (interactive "sWord search: ") > (re-search-forward (word-search-regexp string t) bound noerror count)) > +;; General word-like regexp-based search. > + > +(defun isearch-word-search-backward (string &optional bound noerror count) > + "Search backward from point for STRING, converted to regexp. > +Like `word-search-backward', but uses a function from the variable > +`isearch-word' to convert STRING to the regexp." > + (re-search-backward > + (if (functionp isearch-word) > + (funcall isearch-word string nil) > + (word-search-regexp string nil)) > + bound noerror count)) > + > +(defun isearch-word-search-forward (string &optional bound noerror count) > + "Search forward from point for STRING, converted to regexp. > +Like `word-search-forward', but uses a function from the variable > +`isearch-word' to convert STRING to the regexp." > + (re-search-forward > + (if (functionp isearch-word) > + (funcall isearch-word string nil) > + (word-search-regexp string nil)) > + bound noerror count)) > + > +(defun isearch-word-search-backward-lax (string &optional bound noerror count) > + "Search backward from point for STRING, converted to regexp. > +Like `word-search-backward-lax', but uses a function from the variable > +`isearch-word' to convert STRING to the regexp." > + (re-search-backward > + (if (functionp isearch-word) > + (funcall isearch-word string t) > + (word-search-regexp string t)) > + bound noerror count)) > + > +(defun isearch-word-search-forward-lax (string &optional bound noerror count) > + "Search forward from point for STRING, converted to regexp. > +Like `word-search-forward-lax', but uses a function from the variable > +`isearch-word' to convert STRING to the regexp." > + (re-search-forward > + (if (functionp isearch-word) > + (funcall isearch-word string t) > + (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. > @@ -2370,20 +2473,23 @@ (defun isearch-search-fun () > Can be changed via `isearch-search-fun-function' for special needs." > (if isearch-search-fun-function > (funcall isearch-search-fun-function) > - (cond > - (isearch-word > - ;; Use lax versions to not fail at the end of the word while > - ;; the user adds and removes characters in the search string > - ;; (or when using nonincremental word isearch) > - (if (or isearch-nonincremental > - (eq (length isearch-string) > - (length (isearch-string-state (car isearch-cmds))))) > - (if isearch-forward 'word-search-forward 'word-search-backward) > - (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax))) > - (isearch-regexp > - (if isearch-forward 're-search-forward 're-search-backward)) > - (t > - (if isearch-forward 'search-forward 'search-backward))))) > + (isearch-search-fun-default))) > + > +(defun isearch-search-fun-default () > + (cond > + (isearch-word > + ;; Use lax versions to not fail at the end of the word while > + ;; the user adds and removes characters in the search string > + ;; (or when using nonincremental word isearch) > + (if (or isearch-nonincremental > + (eq (length isearch-string) > + (length (isearch-string-state (car isearch-cmds))))) > + (if isearch-forward 'isearch-word-search-forward 'isearch-word-search-backward) If we inline your defs, this turns into: (if isearch-forward (lambda (string &optional bound noerror count) (re-search-forward (if (functionp isearch-word) (funcall isearch-word string nil) (word-search-regexp string nil)) bound noerror count)) (lambda (string &optional bound noerror count) (re-search-backward (if (functionp isearch-word) (funcall isearch-word string nil) (word-search-regexp string nil)) bound noerror count))) which can be simplified to (lambda (string &optional bound noerror count) (if isearch-forward (re-search-forward (if (functionp isearch-word) (funcall isearch-word string nil) (word-search-regexp string nil)) bound noerror count)) (re-search-backward (if (functionp isearch-word) (funcall isearch-word string nil) (word-search-regexp string nil)) bound noerror count))) and then (lambda (string &optional bound noerror count) (funcall (if isearch-forward #'re-search-forward #'re-search-backward) (if (functionp isearch-word) (funcall isearch-word string nil) (word-search-regexp string nil)) bound noerror count)) -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 05:10:35 2012 Received: (at 11381) by debbugs.gnu.org; 28 May 2012 09:10:35 +0000 Received: from localhost ([127.0.0.1]:46175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYvyE-00076m-6o for submit@debbugs.gnu.org; Mon, 28 May 2012 05:10:35 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:57033 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SYvyA-00076c-Ap for 11381@debbugs.gnu.org; Mon, 28 May 2012 05:10:32 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id AB7EB451C88F; Mon, 28 May 2012 02:09:10 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA 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> <87mx4u0xiu.fsf@mail.jurta.org> Date: Mon, 28 May 2012 11:55:20 +0300 In-Reply-To: (Stefan Monnier's message of "Mon, 28 May 2012 00:48:19 -0400") Message-ID: <87y5oc3cab.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Do we really need those 4? I think we can just get away with > symbol-search-regexp (whose name also needs to start with "isearch-"). In the next patch these functions are removed and symbol-search-regexp is renamed to isearch-symbol-regexp. >> Also it splits the standard default part of `isearch-search-fun' > > You could actually set isearch-search-fun-function's default to > isearch-search-fun-default so we can just unconditionally call > isearch-search-fun-function's. It still needs protection against such cases as currently existing in several places in internal and probably also in external packages: (let ((isearch-search-fun-function nil)) (isearch-search-fun)) So it requires a call like: (funcall (or isearch-search-fun-function 'isearch-search-fun-default)) > and then > > (lambda (string &optional bound noerror count) > (funcall > (if isearch-forward #'re-search-forward #'re-search-backward) > (if (functionp isearch-word) > (funcall isearch-word string nil) > (word-search-regexp string nil)) > bound noerror count)) This is used in a complete patch that implements the symbol search and fixes the word search (everything is in one patch below but it will be installed in separate commits): === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-05-17 00:03:49 +0000 +++ lisp/isearch.el 2012-05-28 08:38:31 +0000 @@ -503,6 +512,7 @@ (defvar isearch-mode-map (define-key map "\M-sr" 'isearch-toggle-regexp) (define-key map "\M-sw" 'isearch-toggle-word) + (define-key map "\M-s_" 'isearch-toggle-symbol) (define-key map [?\M-%] 'isearch-query-replace) (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) @@ -614,6 +627,7 @@ (define-key esc-map "\C-s" 'isearch-forw (define-key global-map "\C-r" 'isearch-backward) (define-key esc-map "\C-r" 'isearch-backward-regexp) (define-key search-map "w" 'isearch-forward-word) +(define-key search-map "_" 'isearch-forward-symbol) ;; Entry points to isearch-mode. @@ -653,6 +667,7 @@ (defun isearch-forward (&optional regexp Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. Type \\[isearch-toggle-regexp] to toggle regular-expression mode. Type \\[isearch-toggle-word] to toggle word mode. +Type \\[isearch-toggle-symbol] to toggle symbol mode. Type \\[isearch-edit-string] to edit the search string in the minibuffer. Also supported is a search ring of the previous 16 search strings. @@ -720,6 +735,16 @@ (defun isearch-forward-word (&optional n (interactive "P\np") (isearch-mode t nil nil (not no-recursive-edit) (null not-word))) +(defun isearch-forward-symbol (&optional not-symbol no-recursive-edit) + "\ +Do incremental search forward for a symbol. +The prefix argument is currently unused. +Like ordinary incremental search except that your input is treated +as a symbol surrounded by symbol boundary constructs \\_< and \\_>. +See the command `isearch-forward' for more information." + (interactive "P\np") + (isearch-mode t nil nil (not no-recursive-edit) 'isearch-symbol-regexp)) + (defun isearch-backward (&optional regexp-p no-recursive-edit) "\ Do incremental search backward. @@ -747,14 +772,14 @@ (defun isearch-backward-regexp (&optiona ;; "List of commands for which isearch-mode does not recursive-edit.") -(defun isearch-mode (forward &optional regexp op-fun recursive-edit word-p) +(defun isearch-mode (forward &optional regexp op-fun recursive-edit word) "Start Isearch minor mode. It is called by the function `isearch-forward' and other related functions." ;; Initialize global vars. (setq isearch-forward forward isearch-regexp regexp - isearch-word word-p + isearch-word word isearch-op-fun op-fun isearch-last-case-fold-search isearch-case-fold-search isearch-case-fold-search case-fold-search @@ -1367,6 +1392,14 @@ (defun isearch-toggle-word () (setq isearch-success t isearch-adjusted t) (isearch-update)) +(defun isearch-toggle-symbol () + "Toggle symbol searching on or off." + (interactive) + (setq isearch-word (unless (eq isearch-word 'isearch-symbol-regexp) + 'isearch-symbol-regexp)) + (setq isearch-success t isearch-adjusted t) + (isearch-update)) + (defun isearch-toggle-case-fold () "Toggle case folding in searching on or off." (interactive) @@ -1468,6 +1501,20 @@ (defun word-search-forward-lax (string & (interactive "sWord search: ") (re-search-forward (word-search-regexp string t) bound noerror count)) +;; Symbol search + +(defun isearch-symbol-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." + (concat "\\_<" (regexp-quote string) (unless lax "\\_>"))) + +(put 'isearch-symbol-regexp 'isearch-message-prefix "symbol ") + (defun isearch-query-replace (&optional delimited regexp-flag) "Start `query-replace' with string to replace from last search string. @@ -1534,6 +1581,8 @@ (defun isearch-occur (regexp &optional n (interactive (let* ((perform-collect (consp current-prefix-arg)) (regexp (cond + ((functionp isearch-word) + (funcall isearch-word isearch-string)) (isearch-word (word-search-regexp isearch-string)) (isearch-regexp isearch-string) (t (regexp-quote isearch-string))))) @@ -1749,6 +1800,8 @@ (defun isearch-search-and-update () (setq case-fold-search (isearch-no-upper-case-p isearch-string isearch-regexp))) (looking-at (cond + ((functionp isearch-word) + (funcall isearch-word isearch-string t)) (isearch-word (word-search-regexp isearch-string t)) (isearch-regexp isearch-string) (t (regexp-quote isearch-string))))) @@ -2329,7 +2387,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 "") @@ -2356,8 +2418,8 @@ (defun isearch-message-suffix (&optional ;; Searching -(defvar isearch-search-fun-function nil - "Overrides the default `isearch-search-fun' behavior. +(defvar isearch-search-fun-function 'isearch-search-fun-default + "Non-default value overrides the behavior of `isearch-search-fun-default'. This variable's value should be a function, which will be called with no arguments, and should return a function that takes three arguments: STRING, BOUND, and NOERROR. @@ -2368,22 +2430,29 @@ (defvar isearch-search-fun-function nil (defun isearch-search-fun () "Return the function to use for the search. Can be changed via `isearch-search-fun-function' for special needs." - (if isearch-search-fun-function - (funcall isearch-search-fun-function) + (funcall (or isearch-search-fun-function 'isearch-search-fun-default))) + +(defun isearch-search-fun-default () + "Return default functions to use for the search." (cond (isearch-word + (lambda (string &optional bound noerror count) ;; Use lax versions to not fail at the end of the word while ;; the user adds and removes characters in the search string ;; (or when using nonincremental word isearch) - (if (or isearch-nonincremental + (let ((lax (not (or isearch-nonincremental (eq (length isearch-string) - (length (isearch-string-state (car isearch-cmds))))) - (if isearch-forward 'word-search-forward 'word-search-backward) - (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax))) + (length (isearch-string-state (car isearch-cmds)))))))) + (funcall + (if isearch-forward #'re-search-forward #'re-search-backward) + (if (functionp isearch-word) + (funcall isearch-word string lax) + (word-search-regexp string lax)) + bound noerror count)))) (isearch-regexp (if isearch-forward 're-search-forward 're-search-backward)) (t - (if isearch-forward 'search-forward 'search-backward))))) + (if isearch-forward 'search-forward 'search-backward)))) (defun isearch-search-string (string bound noerror) "Search for the first occurrence of STRING or its translation. === modified file 'lisp/comint.el' --- lisp/comint.el 2012-05-15 16:58:35 +0000 +++ lisp/comint.el 2012-05-28 08:50:41 +0000 @@ -1463,18 +1463,10 @@ (defun comint-goto-input (pos) (defun comint-history-isearch-search () "Return the proper search function, for Isearch in input history." - (cond - (isearch-word - (if isearch-forward 'word-search-forward 'word-search-backward)) - (t (lambda (string bound noerror) (let ((search-fun ;; Use standard functions to search within comint text - (cond - (isearch-regexp - (if isearch-forward 're-search-forward 're-search-backward)) - (t - (if isearch-forward 'search-forward 'search-backward)))) + (isearch-search-fun-default)) found) ;; Avoid lazy-highlighting matches in the comint prompt and in the ;; output when searching forward. Lazy-highlight calls this lambda @@ -1523,7 +1515,7 @@ (defun comint-history-isearch-search () ;; Return point of the new search result (point)) ;; Return nil on the error "no next/preceding item" - (error nil))))))))) + (error nil))))))) (defun comint-history-isearch-message (&optional c-q-hack ellipsis) "Display the input history search prompt. @@ -1556,14 +1548,13 @@ (defun comint-history-isearch-wrap () "Wrap the input history search when search fails. Move point to the first history element for a forward search, or to the last history element for a backward search." - (unless isearch-word ;; When `comint-history-isearch-search' fails on reaching the ;; beginning/end of the history, wrap the search to the first/last ;; input history element. (if isearch-forward (comint-goto-input (1- (ring-length comint-input-ring))) (comint-goto-input nil)) - (setq isearch-success t)) + (setq isearch-success t) (goto-char (if isearch-forward (comint-line-beginning-position) (point-max)))) (defun comint-history-isearch-push-state () === modified file 'lisp/info.el' --- lisp/info.el 2012-05-22 03:31:34 +0000 +++ lisp/info.el 2012-05-28 08:27:29 +0000 @@ -1913,26 +1916,23 @@ (defun Info-search-backward (regexp &opt (defun Info-isearch-search () (if Info-isearch-search (lambda (string &optional bound noerror count) - (if isearch-word - (Info-search (concat "\\b" (replace-regexp-in-string - "\\W+" "\\W+" - (replace-regexp-in-string - "^\\W+\\|\\W+$" "" string) - nil t) + (Info-search + (cond + (isearch-word ;; Lax version of word search - (if (or isearch-nonincremental + (let ((lax (not (or isearch-nonincremental (eq (length string) (length (isearch-string-state - (car isearch-cmds))))) - "\\b")) + (car isearch-cmds)))))))) + (if (functionp isearch-word) + (funcall isearch-word string lax) + (word-search-regexp string lax)))) + (isearch-regexp string) + (t (regexp-quote string))) bound noerror count (unless isearch-forward 'backward)) - (Info-search (if isearch-regexp string (regexp-quote string)) - bound noerror count - (unless isearch-forward 'backward))) (point)) - (let ((isearch-search-fun-function nil)) - (isearch-search-fun)))) + (isearch-search-fun-default))) (defun Info-isearch-wrap () (if Info-isearch-search === modified file 'lisp/misearch.el' --- lisp/misearch.el 2012-01-19 07:21:25 +0000 +++ lisp/misearch.el 2012-05-28 08:43:16 +0000 @@ -130,13 +130,7 @@ (defun multi-isearch-search-fun () (lambda (string bound noerror) (let ((search-fun ;; Use standard functions to search within one buffer - (cond - (isearch-word - (if isearch-forward 'word-search-forward 'word-search-backward)) - (isearch-regexp - (if isearch-forward 're-search-forward 're-search-backward)) - (t - (if isearch-forward 'search-forward 'search-backward)))) + (isearch-search-fun-default)) found buffer) (or ;; 1. First try searching in the initial buffer === modified file 'lisp/simple.el' --- lisp/simple.el 2012-05-04 23:16:47 +0000 +++ lisp/simple.el 2012-05-28 08:29:25 +0000 @@ -1699,18 +1771,10 @@ (defun minibuffer-history-isearch-end () (defun minibuffer-history-isearch-search () "Return the proper search function, for isearch in minibuffer history." - (cond - (isearch-word - (if isearch-forward 'word-search-forward 'word-search-backward)) - (t (lambda (string bound noerror) (let ((search-fun ;; Use standard functions to search within minibuffer text - (cond - (isearch-regexp - (if isearch-forward 're-search-forward 're-search-backward)) - (t - (if isearch-forward 'search-forward 'search-backward)))) + (isearch-search-fun-default)) found) ;; Avoid lazy-highlighting matches in the minibuffer prompt when ;; searching forward. Lazy-highlight calls this lambda with the @@ -1750,7 +1814,7 @@ (defun minibuffer-history-isearch-search ;; Return point of the new search result (point)) ;; Return nil when next(prev)-history-element fails - (error nil))))))))) + (error nil))))))) (defun minibuffer-history-isearch-message (&optional c-q-hack ellipsis) "Display the minibuffer history search prompt. @@ -1781,14 +1845,13 @@ (defun minibuffer-history-isearch-wrap ( "Wrap the minibuffer history search when search fails. Move point to the first history element for a forward search, or to the last history element for a backward search." - (unless isearch-word ;; When `minibuffer-history-isearch-search' fails on reaching the ;; beginning/end of the history, wrap the search to the first/last ;; minibuffer history element. (if isearch-forward (goto-history-element (length (symbol-value minibuffer-history-variable))) (goto-history-element 0)) - (setq isearch-success t)) + (setq isearch-success t) (goto-char (if isearch-forward (minibuffer-prompt-end) (point-max)))) (defun minibuffer-history-isearch-push-state () === modified file 'lisp/textmodes/reftex-global.el' --- lisp/textmodes/reftex-global.el 2012-01-19 07:21:25 +0000 +++ lisp/textmodes/reftex-global.el 2012-05-28 08:49:52 +0000 @@ -350,9 +350,8 @@ (defun reftex-ensure-write-access (files ;; variable `multi-isearch-next-buffer-function'. (defun reftex-isearch-wrap-function () - (if (not isearch-word) (switch-to-buffer - (funcall isearch-next-buffer-function (current-buffer) t))) + (funcall isearch-next-buffer-function (current-buffer) t)) (goto-char (if isearch-forward (point-min) (point-max)))) (defun reftex-isearch-push-state-function () @@ -364,14 +363,7 @@ (defun reftex-isearch-pop-state-function (defun reftex-isearch-isearch-search (string bound noerror) (let ((nxt-buff nil) - (search-fun - (cond - (isearch-word - (if isearch-forward 'word-search-forward 'word-search-backward)) - (isearch-regexp - (if isearch-forward 're-search-forward 're-search-backward)) - (t - (if isearch-forward 'search-forward 'search-backward))))) + (search-fun (isearch-search-fun-default))) (or (funcall search-fun string bound noerror) (unless bound From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 10:10:00 2012 Received: (at 11381) by debbugs.gnu.org; 28 May 2012 14:10:00 +0000 Received: from localhost ([127.0.0.1]:46686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZ0e0-00071q-3x for submit@debbugs.gnu.org; Mon, 28 May 2012 10:10:00 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:28030) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZ0dg-00071N-B8 for 11381@debbugs.gnu.org; Mon, 28 May 2012 10:09:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0FAG6Zu09MCpYd/2dsb2JhbABEsEiDSYEIghUBAQQBViMFCws0EhQYDSSIHAW6CZBEA6MzgViDBQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="183124215" Received: from 76-10-150-29.dsl.teksavvy.com (HELO pastel.home) ([76.10.150.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 May 2012 10:08:16 -0400 Received: by pastel.home (Postfix, from userid 20848) id 26105594DE; Mon, 28 May 2012 10:08:16 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: 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> <87mx4u0xiu.fsf@mail.jurta.org> <87y5oc3cab.fsf@mail.jurta.org> Date: Mon, 28 May 2012 10:08:15 -0400 In-Reply-To: <87y5oc3cab.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 28 May 2012 11:55:20 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> Do we really need those 4? I think we can just get away with >> symbol-search-regexp (whose name also needs to start with "isearch-"). > In the next patch these functions are removed and symbol-search-regexp > is renamed to isearch-symbol-regexp. Thanks, see comments below. >>> Also it splits the standard default part of `isearch-search-fun' >> You could actually set isearch-search-fun-function's default to >> isearch-search-fun-default so we can just unconditionally call >> isearch-search-fun-function's. > It still needs protection against such cases as currently existing in > several places in internal and probably also in external packages: > (let ((isearch-search-fun-function nil)) > (isearch-search-fun)) For the internal cases, the above should be replaced by a call to isearch-search-fun-default. Obviously, if there are external such cases, we'll indeed need to additionally keep: > (funcall (or isearch-search-fun-function 'isearch-search-fun-default)) [...] > === modified file 'lisp/isearch.el' > --- lisp/isearch.el 2012-05-17 00:03:49 +0000 > +++ lisp/isearch.el 2012-05-28 08:38:31 +0000 > @@ -503,6 +512,7 @@ (defvar isearch-mode-map > (define-key map "\M-sr" 'isearch-toggle-regexp) > (define-key map "\M-sw" 'isearch-toggle-word) > + (define-key map "\M-s_" 'isearch-toggle-symbol) BTW, could you add isearch-toggle-case-fold to the M-s prefix, while you're at it? > (defun Info-isearch-search () I think we can share even more code here with isearch.el. But in any case, the patch looks good now, thank you, Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 11:48:31 2012 Received: (at 11381) by debbugs.gnu.org; 28 May 2012 15:48:31 +0000 Received: from localhost ([127.0.0.1]:46804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZ2BL-0000qo-DZ for submit@debbugs.gnu.org; Mon, 28 May 2012 11:48:31 -0400 Received: from mtaout23.012.net.il ([80.179.55.175]:42017) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZ2BJ-0000qZ-3X for 11381@debbugs.gnu.org; Mon, 28 May 2012 11:48:30 -0400 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0M4Q00L00OM2UK00@a-mtaout23.012.net.il> for 11381@debbugs.gnu.org; Mon, 28 May 2012 18:44:43 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M4Q00L2CP2IOV60@a-mtaout23.012.net.il>; Mon, 28 May 2012 18:44:43 +0300 (IDT) Date: Mon, 28 May 2012 18:44:47 +0300 From: Eli Zaretskii Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <83pq9o1f9s.fsf@gnu.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> <878vge3ri7.fsf@mail.jurta.org> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 11381 Cc: juri@jurta.org, 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > From: Stefan Monnier > Date: Mon, 28 May 2012 00:23:10 -0400 > Cc: 11381@debbugs.gnu.org > > > Comparing two functions can be avoided by using properties > > on function symbols like in the patch below. > > It's not perfect, but yes, it's much better. Actually, I very much dislike this "feature" of putting properties on function symbols, or at least the way we use it. The problem is documentation: there's no good place visible to users where to document the possible values of these properties and their meanings, so they are only documented in the code. This makes maintenance much harder and error-prone than it needs to be. Look at delsel.el, for one such example. The various uses of the related properties, scattered through half a dozen other Lisp packages, are completely obfuscated, and the only place you can really understand what these properties mean is by looking at the code in delsel.el that handles them, because even the commentary in delsel.el leaves a lot of place for improvement. I say, either we start documenting these properties in the doc strings and in the manual, or we should deprecate and discourage the practice of using them. From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 13:36:19 2012 Received: (at 11381) by debbugs.gnu.org; 28 May 2012 17:36:19 +0000 Received: from localhost ([127.0.0.1]:46891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZ3re-0003HP-Ny for submit@debbugs.gnu.org; Mon, 28 May 2012 13:36:19 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:49690) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZ3rc-0003HB-3V for 11381@debbugs.gnu.org; Mon, 28 May 2012 13:36:17 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q4SHYo4K004919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 28 May 2012 17:34:51 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q4SHYnwI020544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 May 2012 17:34:49 GMT 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 q4SHYm11001927; Mon, 28 May 2012 12:34:49 -0500 Received: from dradamslap1 (/10.159.220.56) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 28 May 2012 10:34:48 -0700 From: "Drew Adams" To: "'Eli Zaretskii'" , "'Stefan Monnier'" 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><878vge3ri7.fsf@mail.jurta.org> <83pq9o1f9s.fsf@gnu.org> Subject: use and doc of function symbol properties [was: bug#11381: 23.3; isearch-search-and-update issue?] Date: Mon, 28 May 2012 10:34:34 -0700 Message-ID: <09237F12532B42C381CDBC71FA09EA08@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <83pq9o1f9s.fsf@gnu.org> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac086T4RcmhF2wJTT4a4bSGUphp2gAAAMUiw X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org, emacs-devel@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) The question you (Eli) raise is not specific to isearch or to delsel. The proper place to discuss it is emacs-devel - especially if you propose to change things. So I'm ccing emacs-devel - but bug #11381 should be dropped from the cc list from now on. > Actually, I very much dislike this "feature" of putting properties on > function symbols, or at least the way we use it. The problem is > documentation: We agree that that is the problem. It is not something else. > there's no good place visible to users where to > document the possible values of these properties and their meanings, > so they are only documented in the code. Yes. Documentation could be improved. But the use of symbol properties, including for function symbols, is nothing special. It is similar to using attributes or methods with objects in OOP. What's sometimes missing perhaps is better documentation/discoverability. Emacs Lisp symbols are rudimentary objects, and, yes, there is not a lot of built-in support for discovering or navigating them - how particular properties are used in various contexts etc. > This makes maintenance much harder and error-prone than > it needs to be. If Emacs maintainers substitute basic Emacs keys/commands here and there then they need to be aware of `delete-selection-mode' - yes. The same is true for other modes that users might use - whether visual lines or whatever. Changing one thing can affect another. The consequence for delsel if that advice is ignored is to risk making it a no-op in some cases: you can neuter `delete-selection-mode' if you do not pay attention when you replace commands with new ones (e.g. in some mode). Wrt the user, and visibility of this information: In some cases, the user (yes, user) is an Elisp programmer, and s?he would sometimes need to consult the code anyway, depending on what s?he wants to do. A user of delsel can be someone who never changes such a property on any function symbol (most users), or it can be someone who does. For the latter, it would probably not be necessary to consult the delsel code if the documentation included some information that is currently only in the delsel.el Commentary. [This is not unique to delsel.el, BTW - there are other libraries for which a programming user must consult the Commentary in order to understand - even when it might not be necessary to read the code itself. IOW, there are other cases where some of the Commentary info might fruitfully be added to the doc. Library thingatpt.el comes to mind - e.g., the doc strings where we say "See the file `thingatpt.el' for documentation on how to define a symbol as a valid THING." That's almost as long as the info in the Commentary.] Typically, someone minimally familiar with using delsel as a programmer can easily answer a question from a user about what's happening or how to change the behavior. This info could be added to the `delete-selection-mode' doc string. The doc could include info about programming/customizing the behavior. That info is not a big deal IMO, either to present or to understand. Some libraries have whole Info manuals that delve into such programming/customization aspects. Library delsel.el is very simple, so that info could just be added to the doc string for the mode. The entire Commentary text that explains it is only a few lines long (labeled "Interface"), and that is all that is needed, I think. > Look at delsel.el, for one such example. The various uses of the > related properties, scattered through half a dozen other Lisp > packages, are completely obfuscated, and the only place you can really > understand what these properties mean is by looking at the code in > delsel.el that handles them, because even the commentary in delsel.el > leaves a lot of place for improvement. Not sure I agree, though it is hard to disagree that the application of properties to function symbols is scattered. It is of course the case that the place to look for understanding delete-selection mode is function `delete-selection-mode'. And it is true that today that means looking also at the delsel.el Commentary. Moving that info to the doc string would help. Can you be more specific about what is missing from the Commentary in delsel.el? It seems to me that how delsel works and how to customize the behavior is pretty well explained there, if a bit succinctly. What else would you like to see documented in this regard? > I say, either we start documenting these properties in the doc strings > and in the manual, or we should deprecate and discourage the practice > of using them. OK for the former. I disagree with the latter. Let's not throw out the baby with the bathwater. I really don't think this is a big deal. I've seen a few user questions about delsel behavior in help-gnu-emacs over the years, and IIRC all of them had an obvious explanation to someone familiar with the behavior of delsel (which is quite simple). Putting the info about that behavior into the doc string would be helpful - and sufficient, I think. But of course that won't stop a few "end" users from having the occasional question because some library they picked up effectively customizes delsel behavior without saying so. A typical question comes from someone who already uses delsel (and who is used to using it), who then picks up a library that changes some key bindings, effectively replacing some commands that are handled by delsel with some commands that are not. This case is not a big deal. Such a user can tell right away that something has changed the delsel behavior, and a quick question to help-gnu-emacs - or a quick check of the new doc string - would likely turn on the light. But a user who has never used delsel before, and who already uses some library that substitutes keys/commands so that delsel becomes a no-op for them, will perhaps not understand why delsel does not seem to behave as advertised. IOW, trying to understand the expected vanilla behavior of delsel (having never used it), and trying to understand a modified behavior at the same time, might be more difficult. But even that user, if s?he consults the new doc string, would have a good chance of understanding the situation. Attaching properties to Lisp function symbols in order to affect behavior is as old as Lisp symbols themselves. Please do not try to discourage this practice. But it is fine to try to improve the documentation or discoverability. [Belongs in a separate thread, at another time, but if `delete-selection-mode' were the default (yes) then: (a) users new to Emacs would find behavior much closer to what they are used to, and (b) Emacs developers (including 3rd-party) would be more conscious of delsel, so would likely DTRT wrt it more often.] (Just one opinion.) From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 15:36:17 2012 Received: (at 11381) by debbugs.gnu.org; 28 May 2012 19:36:17 +0000 Received: from localhost ([127.0.0.1]:47025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZ5jk-0006Fw-Tw for submit@debbugs.gnu.org; Mon, 28 May 2012 15:36:17 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:46149) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZ5jQ-0006FC-F3 for 11381@debbugs.gnu.org; Mon, 28 May 2012 15:36:15 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q4SJYasA023258; Mon, 28 May 2012 15:34:36 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id DF544B4191; Mon, 28 May 2012 15:34:35 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: 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> <878vge3ri7.fsf@mail.jurta.org> <83pq9o1f9s.fsf@gnu.org> Date: Mon, 28 May 2012 15:34:35 -0400 In-Reply-To: <83pq9o1f9s.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 28 May 2012 18:44:47 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4235=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4235> : streams <761728> : uri <1120538> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 11381 Cc: juri@jurta.org, 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >> > Comparing two functions can be avoided by using properties >> > on function symbols like in the patch below. >> It's not perfect, but yes, it's much better. > Actually, I very much dislike this "feature" of putting properties on > function symbols, or at least the way we use it. Agreed, hence the "not perfect". > I say, either we start documenting these properties in the doc strings > and in the manual, or we should deprecate and discourage the practice > of using them. For delsel, I think the answer is to not use properties (which is why I insisted we use another mechanism for the shift-select and delete-active-region thingies). For the case at hand, it's more difficult to fold the functionality directly into the function (that would make us turn those functions into object-like functions, along the lines of what we do for completion tables). And, I agree that the docstring of isearch-search-fun-function should then clearly document what the `isearch-message-prefix' means. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 20:36:02 2012 Received: (at 11381) by debbugs.gnu.org; 29 May 2012 00:36:02 +0000 Received: from localhost ([127.0.0.1]:47332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZAPq-00072v-3f for submit@debbugs.gnu.org; Mon, 28 May 2012 20:36:02 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:50853 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZAPo-00072h-6U for 11381@debbugs.gnu.org; Mon, 28 May 2012 20:36:01 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 692A6451C91D; Mon, 28 May 2012 17:34:37 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA 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> <878vge3ri7.fsf@mail.jurta.org> <83pq9o1f9s.fsf@gnu.org> Date: Tue, 29 May 2012 03:27:10 +0300 In-Reply-To: (Stefan Monnier's message of "Mon, 28 May 2012 15:34:35 -0400") Message-ID: <87ipffbzmp.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: Eli Zaretskii , 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > And, I agree that the docstring of isearch-search-fun-function should > then clearly document what the `isearch-message-prefix' means. The problem is to find the right docstring to document the property. The docstring of `isearch-search-fun-function' is about a function that returns a search function. But the property `isearch-message-prefix' is put on a function that converts a string into a regexp. So it could be documented in the docstring of `isearch-message-prefix', but this function has no docstring (and neither `isearch-message'). From debbugs-submit-bounces@debbugs.gnu.org Mon May 28 21:27:49 2012 Received: (at 11381) by debbugs.gnu.org; 29 May 2012 01:27:49 +0000 Received: from localhost ([127.0.0.1]:47383 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZBDx-0008Hl-Hy for submit@debbugs.gnu.org; Mon, 28 May 2012 21:27:49 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:19029) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZBDd-0008Gu-Gt for 11381@debbugs.gnu.org; Mon, 28 May 2012 21:27:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCpYd/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="183356905" Received: from 76-10-150-29.dsl.teksavvy.com (HELO pastel.home) ([76.10.150.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 May 2012 21:26:03 -0400 Received: by pastel.home (Postfix, from userid 20848) id 54ACA599A3; Mon, 28 May 2012 21:26:03 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: 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> <878vge3ri7.fsf@mail.jurta.org> <83pq9o1f9s.fsf@gnu.org> <87ipffbzmp.fsf@mail.jurta.org> Date: Mon, 28 May 2012 21:26:03 -0400 In-Reply-To: <87ipffbzmp.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 29 May 2012 03:27:10 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: Eli Zaretskii , 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) >> And, I agree that the docstring of isearch-search-fun-function should >> then clearly document what the `isearch-message-prefix' means. > The problem is to find the right docstring to document the property. Sorry, I mistyped. It should be in the docstring of isearch-word, of course, since that's the variable that will hold the function that needs the property. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue May 29 06:00:34 2012 Received: (at 11381) by debbugs.gnu.org; 29 May 2012 10:00:34 +0000 Received: from localhost ([127.0.0.1]:47589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZJE4-0003JZ-Ib for submit@debbugs.gnu.org; Tue, 29 May 2012 06:00:33 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:59768 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZJDw-0003JC-Us for 11381@debbugs.gnu.org; Tue, 29 May 2012 06:00:27 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id BBBE6451CA58; Tue, 29 May 2012 02:58:46 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Organization: JURTA 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> <87mx4u0xiu.fsf@mail.jurta.org> <87y5oc3cab.fsf@mail.jurta.org> Date: Tue, 29 May 2012 12:49:11 +0300 In-Reply-To: (Stefan Monnier's message of "Mon, 28 May 2012 10:08:15 -0400") Message-ID: <87y5ob5nc8.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > BTW, could you add isearch-toggle-case-fold to the M-s prefix, while > you're at it? Added. > But in any case, the patch looks good now, thank you, Installed, with the docstring added to `isearch-word'. Later I'll post a patch to start Isearch with an initial search string. From debbugs-submit-bounces@debbugs.gnu.org Tue May 29 09:36:34 2012 Received: (at 11381) by debbugs.gnu.org; 29 May 2012 13:36:34 +0000 Received: from localhost ([127.0.0.1]:48013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZMbC-0003vQ-0g for submit@debbugs.gnu.org; Tue, 29 May 2012 09:36:34 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:25698) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SZMb5-0003v8-Ay for 11381@debbugs.gnu.org; Tue, 29 May 2012 09:36:31 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCpYd/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="183651318" Received: from 76-10-150-29.dsl.teksavvy.com (HELO pastel.home) ([76.10.150.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 29 May 2012 09:34:58 -0400 Received: by pastel.home (Postfix, from userid 20848) id EBEBD58F58; Tue, 29 May 2012 09:34:57 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#11381: 23.3; isearch-search-and-update issue? Message-ID: 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> <87mx4u0xiu.fsf@mail.jurta.org> <87y5oc3cab.fsf@mail.jurta.org> <87y5ob5nc8.fsf@mail.jurta.org> Date: Tue, 29 May 2012 09:34:57 -0400 In-Reply-To: <87y5ob5nc8.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 29 May 2012 12:49:11 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11381 Cc: 11381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Installed, with the docstring added to `isearch-word'. Thanks, Juri, Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 29 19:31:05 2012 Received: (at control) by debbugs.gnu.org; 29 Oct 2012 23:31:05 +0000 Received: from localhost ([127.0.0.1]:38658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TSynQ-0002eB-Ec for submit@debbugs.gnu.org; Mon, 29 Oct 2012 19:31:04 -0400 Received: from mail-da0-f44.google.com ([209.85.210.44]:46707) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TSynO-0002dj-At for control@debbugs.gnu.org; Mon, 29 Oct 2012 19:31:02 -0400 Received: by mail-da0-f44.google.com with SMTP id h15so2554781dan.3 for ; Mon, 29 Oct 2012 16:28:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=Fi4smGrIPMlx0Zs/9Szgw5Ogpuix7PXHOgF1nT+dGNo=; b=eoI+X35aFP52Sd7sB/iSnJDyZdHrI4GIoI0qgQuobdUCvcKFvhcgtGLghIIBFIQChT cw5+oM65tivHC/+0vJIqoa5HW33fGf6gl8GlTrdysa6VL1m/4OLw8jjqe2cdVrlILeNE XH/DRzjDO8QmjKbvKY4cJhk8euG5neb4R2QhqjIKMyAF7ZxuNkv7i41KcYjkmqkSzdAC rk+BMaHyUkXg3mTvaiS9B56oh/t8DP1iBc1hpqbr7SoFRU9PAGq4sJ39cpgfuja1N3xb jipE/mf3bvhoKLI6uBvsED1shPXaRulE1qbdALAnPnbog4HXSlQGnnxX6vYeuMB8nAvy e9jg== Received: by 10.68.230.135 with SMTP id sy7mr62367671pbc.76.1351553313098; Mon, 29 Oct 2012 16:28:33 -0700 (PDT) Received: from ulysses ([155.69.187.103]) by mx.google.com with ESMTPS id rw5sm6678533pbc.54.2012.10.29.16.28.30 (version=SSLv3 cipher=OTHER); Mon, 29 Oct 2012 16:28:31 -0700 (PDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 11381 Date: Tue, 30 Oct 2012 07:28:28 +0800 Message-ID: <87y5iodfj7.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.1 (/) close 11381 thanks From unknown Wed Jun 18 23:11:18 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 27 Nov 2012 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator