From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Looking at function Date: Tue, 28 Jun 2022 21:01:27 +0300 Organization: LINKOV.NET Message-ID: <86edz8k6q1.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14639"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 28 20:08:22 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6FdO-0003cw-J7 for ged-emacs-devel@m.gmane-mx.org; Tue, 28 Jun 2022 20:08:22 +0200 Original-Received: from localhost ([::1]:37740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6FdN-0001u3-Al for ged-emacs-devel@m.gmane-mx.org; Tue, 28 Jun 2022 14:08:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6FcH-0000cZ-U6 for emacs-devel@gnu.org; Tue, 28 Jun 2022 14:07:13 -0400 Original-Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]:52071) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6FcC-0006bP-ME for emacs-devel@gnu.org; Tue, 28 Jun 2022 14:07:13 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 74D8160009 for ; Tue, 28 Jun 2022 18:07:03 +0000 (UTC) Received-SPF: pass client-ip=2001:4b98:dc4:8::223; envelope-from=juri@linkov.net; helo=relay3-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:291694 Archived-At: Any use of the function ‘looking-at’ is incompatible with a non-default value of ‘isearch-search-fun-function’. So there are following problematic uses of ‘looking-at’: 1. There is 1 call in isearch.el in ‘isearch-search-and-update’: (looking-at (cond ((functionp isearch-regexp-function) (funcall isearch-regexp-function isearch-string t)) (isearch-regexp-function (word-search-regexp isearch-string t)) (isearch-regexp isearch-string) (t (regexp-quote isearch-string)))) It doesn't call a non-default search function when using a key sequence like ‘C-M-r ^’ on rectangular regions — it matches outside of regions when the search function restricts the search within the region bounds. 2. In replace.el ‘looking-at/back’ are used only in ‘perform-replace’ to check if the next match is adjacent. This causes problems during rectangular replacements to find matches based on a non-default search function. These possible solutions were proposed in bug#54733: 1. Replace ‘looking-at’ with a call to the search function, but keep it at point by prepending ‘\\=’ to the regexp. Can it break a complex regexp? 2. Call the search function as above but afterwards check if (match-beginning 0) is equal to the original position. Less efficient. 3. Use looking-at only when the search function is default. 4. Add a new variable ‘looking-at-function’. It could be like ‘isearch-search-fun-function’, so redefining the search function will also require redefining the looking-at function with similar code that doesn't move point. Any better ideas how to replace looking-at with something that uses a search function?