Skip to content

Commit f44ea50

Browse files
committed
Use syntax-ppss instead of parse-partial-sexp in protocol docstring detection
parse-partial-sexp from point-min rescans the entire buffer each time, while syntax-ppss uses internal caches making it O(1) amortized during font-lock.
1 parent bc1974e commit f44ea50

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

clojure-mode.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,8 +1274,7 @@ highlighted region)."
12741274
(skip-chars-forward " \t\n\r")
12751275
(eq (char-after) ?\)))
12761276
(save-excursion
1277-
(let ((parent-beg (nth 1 (parse-partial-sexp
1278-
(point-min) listbeg))))
1277+
(let ((parent-beg (nth 1 (syntax-ppss listbeg))))
12791278
(and parent-beg
12801279
(goto-char parent-beg)
12811280
(looking-at "([ \t\n]*defprotocol\\>"))))))

0 commit comments

Comments
 (0)