GNU bug report logs -
#19892
25.0.50; hideshow: hs-hide-all-non-comment-function example infloop
Previous Next
Reported by: michael_heerdegen <at> web.de
Date: Tue, 17 Feb 2015 22:46:01 UTC
Severity: normal
Tags: fixed
Found in version 25.0.50
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
This was introduced (by me applying the following patch) seven years
ago.
Hm... Oh, I see what the brittle logic here really is. The code (by
default) calls this function:
(defun hs-hide-block-at-point (&optional end comment-reg)
[...]
(when (hs-looking-at-block-start-p)
And:
(defun hs-looking-at-block-start-p ()
"Return non-nil if the point is at the block start."
(and (looking-at hs-block-start-regexp)
(save-match-data (not (nth 8 (syntax-ppss))))))
So if the match is successful, but whatever (nth 8 (syntax-ppss)) means
doesn't, then we go to the end of that match data.
So it kinda works... But not if `hs-hide-all-non-comment-function' is
set. I'll try to rework this in a more logical fashion.
commit 43956923c00921499e0582f5da4cd739bc005240
Author: Sébastien Gross <seb <at> chezwam.org>
Date: Wed Apr 11 01:34:25 2012 +0200
(hs-hide-all): Don't infloop on comments that start in the middle of the line.
Fixes: debbugs:10496
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -804,7 +804,10 @@
(if (match-beginning 1)
- ;; we have found a block beginning
+ ;; We have found a block beginning.
(progn
(goto-char (match-beginning 1))
- (if hs-hide-all-non-comment-function
- (funcall hs-hide-all-non-comment-function)
- (hs-hide-block-at-point t)))
+ (unless (if hs-hide-all-non-comment-function
+ (funcall hs-hide-all-non-comment-function)
+ (hs-hide-block-at-point t))
+ ;; Go to end of matched data to prevent from getting stuck
+ ;; with an endless loop.
+ (goto-char (match-end 0))))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 5 years and 293 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.