From 3b1fd42732f7ca5b2db6ad6e75af1c037e1c54e4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 7 Dec 2023 13:13:47 -0500 Subject: [PATCH] * lisp/loadup.el: Check advice after `rmc.el`; turn error into warning --- lisp/loadup.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lisp/loadup.el b/lisp/loadup.el index ef4203917d4..03ed2186392 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -391,19 +391,6 @@ ;; from the repository. It is generated just after temacs is built. (load "leim/leim-list.el" t) -(unless (featurep 'ls-lisp) - ;; Actively disallow advised functions during preload since: - ;; - advices in Emacs's core are generally considered bad style; - ;; - `Snarf-documentation' looses docstrings of primitives advised - ;; during preload (bug#66032#20). - ;; - ;; Don't verify this under MS-Windows and Android, both systems that - ;; load ls-lisp, which advises insert-directory. - (mapatoms - (lambda (f) - (and (advice--p (symbol-function f)) - (error "Advice installed on preloaded function %s" f))))) - ;; If you want additional libraries to be preloaded and their ;; doc strings kept in the DOC file rather than in core, ;; you may load them with a "site-load.el" file. @@ -422,6 +409,18 @@ lost after dumping"))) ;; Used by `kill-buffer', for instance. (load "emacs-lisp/rmc") +;; Actively check for advised functions during preload since: +;; - advices in Emacs's core are generally considered bad style; +;; - `Snarf-documentation' looses docstrings of primitives advised +;; during preload (bug#66032#20). +(mapatoms + (lambda (f) + (and (advice--p (symbol-function f)) + ;; Don't make it an error because it's not serious enough and + ;; it can be annoying during development. Also there are still + ;; circumstances where we use advice on preloaded functions. + (message "Warning: Advice installed on preloaded function %S" f)))) + ;; Make sure default-directory is unibyte when dumping. This is ;; because we cannot decode and encode it correctly (since the locale ;; environment is not, and should not be, set up). default-directory -- 2.39.2