From 72ca2347fcd433e00b481d803b31e1cbcf67333c Mon Sep 17 00:00:00 2001 From: Syohei YOSHIDA Date: Sat, 16 Jan 2016 16:18:56 +0900 Subject: [PATCH] Make safe for avoiding infinite loop --- markdown-mode.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index b0c346d5..629c5d19 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -4895,8 +4895,10 @@ With argument, repeats or can move backward if negative." For example, headings inside preformatted code blocks may match `outline-regexp' but should not be considered as headings." (funcall move-fn arg) - (while (markdown-code-block-at-point) - (funcall move-fn arg))) + (let ((prev -1)) + (while (and (/= prev (point)) (markdown-code-block-at-point)) + (setq prev (point)) + (funcall move-fn arg)))) (defun markdown-next-visible-heading (arg) "Move to the next visible heading line of any level.