From de78d0cc62ad142784c02b584313050a06bc0780 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 16 May 2020 20:30:00 -0400 Subject: [PATCH] Fix #3138: infinite loop when reading package! files --- core/core-packages.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/core/core-packages.el b/core/core-packages.el index ddf7e19a9..83020e72c 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -315,19 +315,19 @@ was installed with." (let (emacs-lisp-mode) (emacs-lisp-mode)) ;; Scrape `package!' blocks from FILE for a comprehensive listing of ;; packages used by this module. - (while (search-forward "(package! " nil t) - (goto-char (match-beginning 0)) + (while (search-forward "(package!" nil t) (let ((ppss (save-excursion (syntax-ppss)))) ;; Don't collect packages in comments or strings - (or (nth 3 ppss) - (nth 4 ppss) - (cl-destructuring-bind (_ name . plist) - (read (current-buffer)) - (push (cons - name (plist-put - plist :modules - (list (doom-module-from-path file)))) - doom-packages)))))))) + (unless (or (nth 3 ppss) + (nth 4 ppss)) + (goto-char (match-beginning 0)) + (cl-destructuring-bind (_ name . plist) + (read (current-buffer)) + (push (cons + name (plist-put + plist :modules + (list (doom-module-from-path file)))) + doom-packages)))))))) (error (signal 'doom-package-error (list (doom-module-from-path file)