From 336e7f0087a400a6e79f849d189812125fe2ff53 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 18 Jun 2022 15:26:22 +0200 Subject: [PATCH] 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. --- core/autoload/debug.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index e491604ae..031558341 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -119,14 +119,14 @@ Activate this advice with: (let (forms) (with-temp-buffer (insert-file-contents file) - (let (emacs-lisp-mode-hook) (emacs-lisp-mode)) - (while (re-search-forward (format "(%s " (regexp-quote form)) nil t) - (let ((ppss (syntax-ppss))) - (unless (or (nth 4 ppss) - (nth 3 ppss)) - (save-excursion - (goto-char (match-beginning 0)) - (push (sexp-at-point) forms))))) + (with-syntax-table emacs-lisp-mode-syntax-table + (while (re-search-forward (format "(%s " (regexp-quote form)) nil t) + (let ((ppss (syntax-ppss))) + (unless (or (nth 4 ppss) + (nth 3 ppss)) + (save-excursion + (goto-char (match-beginning 0)) + (push (sexp-at-point) forms)))))) (nreverse forms))))) ;;;###autoload