From f44e1031b549b37befe97919bd2b3c170fc7648d Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 11 Feb 2024 07:47:04 +0100 Subject: [PATCH] Update 26 YO Bug post --- .../2024-02-10-fixing-a-twenty-six-years-old-emacs-bug.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/posts/2024-02-10-fixing-a-twenty-six-years-old-emacs-bug.org b/source/posts/2024-02-10-fixing-a-twenty-six-years-old-emacs-bug.org index 528d79c..9245d45 100644 --- a/source/posts/2024-02-10-fixing-a-twenty-six-years-old-emacs-bug.org +++ b/source/posts/2024-02-10-fixing-a-twenty-six-years-old-emacs-bug.org @@ -216,7 +216,7 @@ Probably eating paste or some such. Indeed the bug was hiding there all these years, until finally the change from last February---namely, the "disallow '.' at the start" part---brought it to light. It's a simple matter of orientation: just -like the comments suggests, ~thing-at-point-looking-at~ would search +like the comments suggest, ~thing-at-point-looking-at~ would search forward from point, and then start searching backward. But since Emacs doesn't really have a backward-regexp-matching capability, its ~re-search-backward~ works by /moving backward/ and /searching @@ -258,6 +258,7 @@ without breaking a sweat. This leads to the following implementation: (while (and (setq prev (point) match (re-search-forward regexp end t)) (< (match-end 0) old)) + (goto-char (match-beginning 0)) ;; Avoid inflooping when `regexp' matches the empty string. (unless (< prev (point)) (forward-char)))) (and match (<= (match-beginning 0) old (match-end 0))))) -- 2.39.2