From 4728db20a571762f3da708a78e09857f55cee547 Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Thu, 21 Dec 2017 08:14:16 -0500 Subject: [PATCH] Marginally speed up markdown-cur-list-item-end Combine regular expression checks. Reorder condiitons to put least expensive ones earlier where possible. --- markdown-mode.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index 7db7263..ed62db0 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -2578,21 +2578,21 @@ original point. If the point is not in a list item, do nothing." (cond ;; Stop at end of the buffer. ((eobp) nil) - ;; Continue if the current line is blank - ((looking-at markdown-regex-blank-line) t) ;; Continue while indentation is the same or greater ((>= indent level) t) + ;; Continue if the current line is blank + ((looking-at markdown-regex-blank-line) t) ;; Stop if current indentation is less than list item ;; and the previous line was blank. ((and (< indent level) (markdown-prev-line-blank)) nil) - ;; Stop at a new list item of the same or lesser indentation - ((looking-at markdown-regex-list) nil) - ;; Stop at a header - ((looking-at markdown-regex-header) nil) - ;; Stop at a horizontal rule - ((looking-at markdown-regex-hr) nil) + ;; Stop at a new list items of the same or lesser + ;; indentation, headings, and horizontal rules. + ((looking-at (concat "\\(?:" markdown-regex-list + "\\|" markdown-regex-header + "\\|" markdown-regex-hr "\\)")) + nil) ;; Otherwise, continue. (t t)) (forward-line) -- 2.11.4.GIT