Subject: Re: bug#35708: [27.0.50]: thingatpt.el, thing-at-point-looking-at redundant

From: Noam Postavsky <[email-masked]>
Date: Mon, 13 May 2019 08:41:03 -0400

Andreas Röhler <[email-masked]> writes:

> as result of ‘thing-at-point-looking-at’ finally is delivered by
> ‘looking-at’,
> don't see any sense in calling ‘re-search-forward’ first.

The test added below fails if the re-search-forward in
thing-at-point-looking-at is commented out.  Does that tell you what the
"sense" is?

>From 79b55e8e6dfee9cba9e464860546dbab2cdd36d8 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Mon, 13 May 2019 08:39:00 -0400
Subject: [PATCH] ; Add thing-at-point-looking-at test (Bug#35708)

* test/lisp/thingatpt-tests.el (thing-at-point-looking-at): New test.
---
 test/lisp/thingatpt-tests.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index 452fcc6895..339a4a4b81 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -131,4 +131,15 @@ (ert-deftest thing-at-point-url-in-comment ()
     (goto-char 23)
     (should (equal (thing-at-point 'url) "http://foo/bar(baz)"))))
 
+(ert-deftest thing-at-point-looking-at ()
+  (with-temp-buffer
+    (insert "1abcd 2abcd 3abcd")
+    (goto-char (point-min))
+    (let ((m2 (progn (search-forward "2abcd")
+                     (match-data))))
+      (goto-char (point-min))
+      (search-forward "2ab")
+      (should (thing-at-point-looking-at "2abcd"))
+      (should (equal (match-data) m2)))))
+
 ;;; thingatpt.el ends here
-- 
2.11.0