* bug#22756: 25.1.50; thing-at-point-looking-at endless loop
@ 2016-02-21 15:06 Tino Calancha
2016-02-27 11:28 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Tino Calancha @ 2016-02-21 15:06 UTC (permalink / raw)
To: 22756
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
Good (or morning afternoon evening night)
emacs -Q:
;; OK
(with-temp-buffer
(looking-at "^"))
t
;; OK
(with-temp-buffer
(looking-back "^"))
t
;; Bad: endless loop
(with-temp-buffer
(require 'thingatpt)
(thing-at-point-looking-at "^"))
In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.29)
Repository revision: 27d343070d02210316e69e4f7da1faeea2d87608
[-- Attachment #2: Type: text/plain, Size: 1028 bytes --]
diff --git a/thingatpt.el b/thingatpt.el
index 1686c02..1040f15 100644
--- a/thingatpt.el
+++ b/thingatpt.el
@@ -501,11 +501,14 @@ 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)
- (while (and (re-search-backward regexp backward-bound t)
- (or (> (match-beginning 0) old-point)
- (and (looking-at regexp) ; Extend match-end past search start
- (>= (match-end 0) old-point)
- (setq match (point))))))
+ (let (old-match)
+ (while (and (re-search-backward regexp backward-bound t)
+ (setq old-match (point))
+ (not (equal old-match match))
+ (or (> (match-beginning 0) old-point)
+ (and (looking-at regexp) ; Extend match-end past search start
+ (>= (match-end 0) old-point)
+ (setq old-match match match (point)))))))
(if (not match) nil
(goto-char match)
;; Back up a char at a time in case search skipped
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#22756: 25.1.50; thing-at-point-looking-at endless loop
2016-02-21 15:06 bug#22756: 25.1.50; thing-at-point-looking-at endless loop Tino Calancha
@ 2016-02-27 11:28 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2016-02-27 11:28 UTC (permalink / raw)
To: Tino Calancha; +Cc: 22756-done
> Date: Mon, 22 Feb 2016 00:06:27 +0900 (JST)
> From: Tino Calancha <f92capac@gmail.com>
>
> ;; Bad: endless loop
> (with-temp-buffer
> (require 'thingatpt)
> (thing-at-point-looking-at "^"))
Thanks, fixed on the emacs-25 branch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-27 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-21 15:06 bug#22756: 25.1.50; thing-at-point-looking-at endless loop Tino Calancha
2016-02-27 11:28 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).