perf(lib): use syntax table instead of major mode
Should speed up doom/info a bit, and reduce potential edge cases caused by emacs-lisp-mode hooks.
This commit is contained in:
parent
2180d44a26
commit
336e7f0087
1 changed files with 8 additions and 8 deletions
|
@ -119,14 +119,14 @@ Activate this advice with:
|
||||||
(let (forms)
|
(let (forms)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert-file-contents file)
|
(insert-file-contents file)
|
||||||
(let (emacs-lisp-mode-hook) (emacs-lisp-mode))
|
(with-syntax-table emacs-lisp-mode-syntax-table
|
||||||
(while (re-search-forward (format "(%s " (regexp-quote form)) nil t)
|
(while (re-search-forward (format "(%s " (regexp-quote form)) nil t)
|
||||||
(let ((ppss (syntax-ppss)))
|
(let ((ppss (syntax-ppss)))
|
||||||
(unless (or (nth 4 ppss)
|
(unless (or (nth 4 ppss)
|
||||||
(nth 3 ppss))
|
(nth 3 ppss))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (match-beginning 0))
|
(goto-char (match-beginning 0))
|
||||||
(push (sexp-at-point) forms)))))
|
(push (sexp-at-point) forms))))))
|
||||||
(nreverse forms)))))
|
(nreverse forms)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue