From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68762: 30.0.50; thing-at-point for an e-mail adress stops at "." Date: Sun, 28 Jan 2024 06:58:19 +0100 Message-ID: References: <87sf2izyzi.fsf@titusmueller.de> <86le8a7h9n.fsf@gnu.org> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29669"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Philip Kaludercic , Titus =?UTF-8?Q?M=C3=BCller?= , 68762@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 28 06:59:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rTyCL-0007Ul-BD for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Jan 2024 06:59:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTyCF-0006d4-ND; Sun, 28 Jan 2024 00:59:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTyBz-0006YW-9w for bug-gnu-emacs@gnu.org; Sun, 28 Jan 2024 00:58:57 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTyBz-000873-21 for bug-gnu-emacs@gnu.org; Sun, 28 Jan 2024 00:58:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTyC6-0003EY-Gp for bug-gnu-emacs@gnu.org; Sun, 28 Jan 2024 00:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jan 2024 05:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68762 X-GNU-PR-Package: emacs Original-Received: via spool by 68762-submit@debbugs.gnu.org id=B68762.170642151312393 (code B ref 68762); Sun, 28 Jan 2024 05:59:02 +0000 Original-Received: (at 68762) by debbugs.gnu.org; 28 Jan 2024 05:58:33 +0000 Original-Received: from localhost ([127.0.0.1]:56295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTyBc-0003Do-N7 for submit@debbugs.gnu.org; Sun, 28 Jan 2024 00:58:33 -0500 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:54340 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTyBZ-0003Dg-R0 for 68762@debbugs.gnu.org; Sun, 28 Jan 2024 00:58:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1706421501; bh=z9Zuax1xa2jKOxCECGd1uWzYZfWtb1eB3aM7F97J+lM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=WM16UXZroYXKWktl6hpWS2xQlNlgms0jc/yXw1dKlYgpjQ7FMWIH/jaTFmtJrubIt kCbU6AkSclme6bAYCpSRcLH6cLqrdPjzN2+f4cJfkCVsU46zi0Pse37M0ZinIz0uVp /xevxTSh8KJ6HDn2COH+EWpHjAva9BKhJEZknPnpUh74Yi1gn3t3ZNlUlOXoVEF7sq ltjdN/WICLeUOkv6DZTkvhwomGIgbwbwA5uWD9Z2ZBn8nvCGUFg0eS2gL0zwaSLRBv xT37DsEdZDqUAPJuJt1sPaHOvjjtFP8W4y2y81goWQGXH72naIMiAnnCjl9SsP+Y9Q tFHiDvl2Zk1wQ== In-Reply-To: <86le8a7h9n.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 27 Jan 2024 20:39:16 +0200") X-Hashcash: 1:20:240128:mail@titusmueller.de::VP9ITWcPx9d8hKBd:LUW X-Hashcash: 1:20:240128:philipk@posteo.net::7ZxGQcE0bcXyKSHp:1DA X-Hashcash: 1:20:240128:eliz@gnu.org::PvnDDgWIC0PIC9Nq:6DH6 X-Hashcash: 1:20:240128:68762@debbugs.gnu.org::/ud7qHza584rLzDi:2o7L X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279056 Archived-At: Eli Zaretskii writes: >> From: Titus M=C3=BCller >> Date: Sat, 27 Jan 2024 14:25:08 +0100 >> >> >> When I use (thing-at-point 'email) and point is on an e-mail adress >> like my.name@website.com, thing-at-point only gets name@website.com >> and loses the first part before the "." character. This happens >> after I upgraded from 29.1 to emacs 30.0.50. > > Philip, is this because of the changes in commit ff20898dad? > > Could you please look into this? FWIW, AFAICT this is introduced by 03cfede8f0 (which fixed Bug#61519). I think the real issue resides in `thing-at-point-looking-at`, though: It stops extending the match backwards when it first encounters a non-match. The following change solves this for me, and keeps all the tests happy: diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 323d3d1cf6c..6f7532f9b0f 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -621,34 +621,22 @@ thing-at-point-looking-at back from point." (save-excursion (let ((old-point (point)) - (forward-bound (and distance (+ (point) distance))) - (backward-bound (and distance (- (point) distance))) - match prev-pos new-pos) - (and (looking-at regexp) - (>=3D (match-end 0) old-point) - (setq match (point))) - ;; Search back repeatedly from end of next match. - ;; This may fail if next match ends before this match does. - (re-search-forward regexp forward-bound 'limit) - (setq prev-pos (point)) - (while (and (setq new-pos (re-search-backward regexp backward-bound = t)) - ;; Avoid inflooping with some regexps, such as "^", - ;; matching which never moves point. - (< new-pos prev-pos) - (or (> (match-beginning 0) old-point) - (and (looking-at regexp) ; Extend match-end past search start - (>=3D (match-end 0) old-point) - (setq match (point)))))) - (if (not match) nil - (goto-char match) - ;; Back up a char at a time in case search skipped - ;; intermediate match straddling search start pos. - (while (and (not (bobp)) - (progn (backward-char 1) (looking-at regexp)) - (>=3D (match-end 0) old-point) - (setq match (point)))) - (goto-char match) - (looking-at regexp))))) + prev-point match) + (goto-char (if distance + (max (point-min) (- old-point distance)) + (point-min))) + (while (and (setq prev-point (point)) + (setq match + (re-search-forward regexp + (and distance + (min (point-max) + (+ old-point distance= ))) + t)) + (< (match-end 0) old-point)) + (unless (< prev-point (point)) + (forward-char))) + (and match (<=3D (match-beginning 0) old-point (match-end 0)))))) + ;; Email addresses (defvar thing-at-point-email-regexp