From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 12 17:29:07 2013 Received: (at submit) by debbugs.gnu.org; 12 Jun 2013 21:29:07 +0000 Received: from localhost ([127.0.0.1]:59566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UmsbK-0001BP-RL for submit@debbugs.gnu.org; Wed, 12 Jun 2013 17:29:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34429) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UmsbJ-0001As-66 for submit@debbugs.gnu.org; Wed, 12 Jun 2013 17:29:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UmsbC-00034n-Hj for submit@debbugs.gnu.org; Wed, 12 Jun 2013 17:28:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-99.2 required=5.0 tests=BAYES_50,USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmsbC-00034e-EO for submit@debbugs.gnu.org; Wed, 12 Jun 2013 17:28:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmsbA-000247-Dp for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2013 17:28:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Umsb8-00033a-DU for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2013 17:28:56 -0400 Received: from ps18281.dreamhost.com ([69.163.218.105]:50108 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umsb8-00032v-7J for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2013 17:28:54 -0400 Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id CB63B258B9E91C for ; Wed, 12 Jun 2013 14:28:51 -0700 (PDT) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: Yank and delete characters in word and symbol isearch Organization: JURTA Date: Wed, 12 Jun 2013 23:57:04 +0300 Message-ID: <87zjuv6o9r.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) As found in http://lists.gnu.org/archive/html/emacs-devel/2013-06/msg00390.html the currently existing commands `isearch-yank-char' and `isearch-del-char' fail to yank and delete characters in a word/symbol search. The test case is typing `M-s w C-M-y C-M-y ... C-M-w C-M-w ...' in the middle of a word/symbol or at the beginning/end of a word/symbol. To remove the failure to yank a character in the middle of a word/symbol it helps to lax the regexp at both ends of the word/symbol. And to remove the failure to yank a character at the beginning/end of a word/symbol it helps to match leading/trailing whitespace at the word/symbol boundaries as well. Then both `word-search-regexp' and `isearch-symbol-regexp' could share the same body with the difference where the former uses word-based regexps with \\<, \\> and \\W, and the latter uses symbol-based regexps with \\_< and \\_>. The remaining problem is how to translate \\W to the symbol-based regexp that will match a non-word non-symbol character. The only solution that I found is to list all possible syntaxes except word and symbol syntax. I tested this and it successfully passes all tests. === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-06-06 06:23:19 +0000 +++ lisp/isearch.el 2013-06-12 20:48:17 +0000 @@ -1545,12 +1649,15 @@ (defun word-search-regexp (string &optio 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")))) + (cond + ((equal string "") "") + ((string-match-p "\\`\\W+\\'" string) "\\W+") + (t (concat + (if (string-match-p "\\`\\W" string) "\\W+" + (unless lax "\\<")) + (mapconcat 'regexp-quote (split-string string "\\W+" t) "\\W+") + (if (string-match-p "\\W\\'" string) "\\W+" + (unless lax "\\>")))))) (defun word-search-backward (string &optional bound noerror count) "Search backward from point for STRING, ignoring differences in punctuation. @@ -1627,7 +1733,17 @@ (defun isearch-symbol-regexp (string &op "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 "\\_>"))) + (let ((not-word-symbol-re + "\\(?:\\s-\\|\\s.\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s/\\|\\s$\\|\\s'\\|\\s<\\|\\s>\\|\\s@\\|\\s!\\|\\s|\\)+")) + (cond + ((equal string "") "") + ((string-match-p (format "\\`%s\\'" not-word-symbol-re) string) not-word-symbol-re) + (t (concat + (if (string-match-p (format "\\`%s" not-word-symbol-re) string) not-word-symbol-re + (unless lax "\\_<")) + (mapconcat 'regexp-quote (split-string string not-word-symbol-re t) not-word-symbol-re) + (if (string-match-p (format "%s\\'" not-word-symbol-re) string) not-word-symbol-re + (unless lax "\\_>"))))))) (put 'isearch-symbol-regexp 'isearch-message-prefix "symbol ") From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 23 02:38:04 2014 Received: (at 14602-done) by debbugs.gnu.org; 23 Mar 2014 06:38:04 +0000 Received: from localhost ([127.0.0.1]:45342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WRc2l-0001Cy-3r for submit@debbugs.gnu.org; Sun, 23 Mar 2014 02:38:04 -0400 Received: from dancol.org ([96.126.100.184]:58552) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WRc2e-0001Ch-11 for 14602-done@debbugs.gnu.org; Sun, 23 Mar 2014 02:37:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=dyyIjrfXYYGUK14wmEa2ayZBD+KFr1BILW8q2/CDFko=; b=E9arhBjKNKQyMtpk42Io58Y2YqmVH8Lq/efRUleZWgwHVdKPRaVZJFga6R9kE49RsHW0MpB/j1EzwG7AnCUH48uH5KCUPzDDV0/I/UWhVkkqw1VHrJKQFlmIE7jWXbDciHXgrQLa3KTlEIHzYeDYga8sMlIb1yClztqYbEO4TXp74yB+F5mIkIZXvpJmctj57cqeNOA4rEYfkFaWll35AUkKHDqIp50oMIQfYfn4/CEXt21jUMuyZjlTtkkbdiNU8b0hq3GM9koydq5RZhoRXXopWWZIUTGHUkz0h0zaBkDyfRnCJ3abv2PrCidY18zQul3XfrTGKHRSAyo52eC0pg==; Received: from [2601:8:b200:551::2b1] by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1WRc2d-0000pN-4N for 14602-done@debbugs.gnu.org; Sat, 22 Mar 2014 23:37:55 -0700 Message-ID: <532E8141.1080301@dancol.org> Date: Sat, 22 Mar 2014 23:37:53 -0700 From: Daniel Colascione User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: 14602-done@debbugs.gnu.org Subject: Done X-Enigmail-Version: 1.6 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gFRUWapwswicLpHbAvgtMRwbT1E7aWfGl" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 14602-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gFRUWapwswicLpHbAvgtMRwbT1E7aWfGl Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Worksforme --gFRUWapwswicLpHbAvgtMRwbT1E7aWfGl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIbBAEBAgAGBQJTLoFBAAoJEMAaIROpHW7IYlkP90UF+AEySMbXlQA1D6fXPlAT 1wbf+3oM4upKNjoLk3DBYjKy9nMnP30oVfD7Dga4Hc/CnffVI8aFNKP2rmkCPxP6 TslGOTuL6AOG2wLjhVBcMTrVJEykxjkQFyHJkcHQ0Y0otGsU4Tc+btm52uKnIqdv Xv09OWqTBYJLzCbO5CoqGwEqL0HmOumaSF1qMben0E5h56WH9PmlW8suAAFV9PPM CeUjnurC5uK+rE1TycvE5yKbGxJa9M/WhejQbkxuCXhgsfUeVdSa+26XnNwFWJEt u5WGdlo3M1+eC8BI8JrwVgp56GeQ/AWvyT8uHRFTdseDNOTDrHRgJKTGqiqW2bNP CxdKLV2sgcbwUtSQpJfcpJpuD0RVQ4EcRNSOFBJivwzeqatSdCZMg9bRQHHJqrFV hwxD7wmC2Abs2higaFQKZloI55PG/mOeVf8K6wBBVkg3pcRe5+mkuifObEIWnHY5 g9JUISG3yu125ozUpTQZyxRnqbC4uhSB630IfJqoyoaJVcJ5xM9Bxn1p9ujzPd/H orZBm0D0UyIytqS9AREaugwgNjGRzoTIB00t5BtEmyk7GK4W+Qs0phi9CH3D6MkW Smnj6WGDLwgWnnA0yIhRSqxaXAfPo5WqYvP2spZ7ww7M3q2GacKZBlVN0Lpj5CLk vg3IwpWjf+Lqgo0zr6s= =Nh+T -----END PGP SIGNATURE----- --gFRUWapwswicLpHbAvgtMRwbT1E7aWfGl-- From unknown Sun Jun 15 08:42:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 20 Apr 2014 11: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