From e32bae617788bc22f2d6643d920ebcafa70a002d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 16 Jan 2020 21:21:29 -0800 Subject: [PATCH] Replace add-hook load-hook with with-eval-after-load * lisp/info.el (Info-install-speedbar-variables): * lisp/cedet/ede.el (speedbar): * lisp/cedet/semantic/imenu.el (speedbar): * lisp/emacs-lisp/eieio-opt.el (eieio-class-speedbar-key-map): * lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-create): * lisp/erc/erc-speedbar.el (erc-install-speedbar-variables): * lisp/mail/rmail.el (rmail-install-speedbar-variables): * lisp/progmodes/gud.el (gud-install-speedbar-variables): Use with-eval-after-load. --- lisp/cedet/ede.el | 5 ++--- lisp/cedet/semantic/imenu.el | 5 ++--- lisp/emacs-lisp/eieio-opt.el | 9 +-------- lisp/emacs-lisp/eieio-speedbar.el | 6 +----- lisp/erc/erc-speedbar.el | 5 ++--- lisp/info.el | 5 ++--- lisp/mail/rmail.el | 5 ++--- lisp/progmodes/gud.el | 5 ++--- 8 files changed, 14 insertions(+), 31 deletions(-) diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el index 1418ad9539d..c2036878288 100644 --- a/lisp/cedet/ede.el +++ b/lisp/cedet/ede.el @@ -1527,8 +1527,7 @@ It does not apply the value to buffers." ;; If this does not occur after the provide, we can get a recursive ;; load. Yuck! -(if (featurep 'speedbar) - (ede-speedbar-file-setup) - (add-hook 'speedbar-load-hook 'ede-speedbar-file-setup)) +(with-eval-after-load 'speedbar + (ede-speedbar-file-setup)) ;;; ede.el ends here diff --git a/lisp/cedet/semantic/imenu.el b/lisp/cedet/semantic/imenu.el index 19e0515ac63..cdf0a23fa07 100644 --- a/lisp/cedet/semantic/imenu.el +++ b/lisp/cedet/semantic/imenu.el @@ -44,9 +44,8 @@ ;; Because semantic imenu tags will hose the current imenu handling ;; code in speedbar, force semantic/sb in. -(if (featurep 'speedbar) - (require 'semantic/sb) - (add-hook 'speedbar-load-hook (lambda () (require 'semantic/sb)))) +(with-eval-after-load 'speedbar + (require 'semantic/sb)) (defgroup semantic-imenu nil "Semantic interface to Imenu." diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el index dda90373069..59af7e12d21 100644 --- a/lisp/emacs-lisp/eieio-opt.el +++ b/lisp/emacs-lisp/eieio-opt.el @@ -278,14 +278,7 @@ are not abstract." (if eieio-class-speedbar-key-map nil - (if (not (featurep 'speedbar)) - (add-hook 'speedbar-load-hook (lambda () - (eieio-class-speedbar-make-map) - (speedbar-add-expansion-list - '("EIEIO" - eieio-class-speedbar-menu - eieio-class-speedbar-key-map - eieio-class-speedbar)))) + (with-eval-after-load 'speedbar (eieio-class-speedbar-make-map) (speedbar-add-expansion-list '("EIEIO" eieio-class-speedbar-menu diff --git a/lisp/emacs-lisp/eieio-speedbar.el b/lisp/emacs-lisp/eieio-speedbar.el index c11608da5d8..5c6e0e516d1 100644 --- a/lisp/emacs-lisp/eieio-speedbar.el +++ b/lisp/emacs-lisp/eieio-speedbar.el @@ -140,11 +140,7 @@ MENU-VAR is the symbol containing an easymenu compatible menu part to use. MODENAME is a string used to identify this browser mode. FETCHER is a generic function used to fetch the base object list used when creating the speedbar display." - (if (not (featurep 'speedbar)) - (add-hook 'speedbar-load-hook - (list 'lambda nil - (list 'eieio-speedbar-create-engine - map-fn map-var menu-var modename fetcher))) + (with-eval-after-load 'speedbar (eieio-speedbar-create-engine map-fn map-var menu-var modename fetcher))) (defun eieio-speedbar-create-engine (map-fn map-var menu-var modename fetcher) diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el index 1ff44afe46d..e1f27b0a8f6 100644 --- a/lisp/erc/erc-speedbar.el +++ b/lisp/erc/erc-speedbar.el @@ -89,9 +89,8 @@ nil - Do not sort users" "Additional menu-items to add to speedbar frame.") ;; Make sure our special speedbar major mode is loaded -(if (featurep 'speedbar) - (erc-install-speedbar-variables) - (add-hook 'speedbar-load-hook 'erc-install-speedbar-variables)) +(with-eval-after-load 'speedbar + (erc-install-speedbar-variables)) ;;; ERC hierarchy display method ;;;###autoload diff --git a/lisp/info.el b/lisp/info.el index 7a11bb3ff9d..3d4bdb969b3 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -5135,9 +5135,8 @@ first line or header line, and for breadcrumb links.") "Additional menu-items to add to speedbar frame.") ;; Make sure our special speedbar major mode is loaded -(if (featurep 'speedbar) - (Info-install-speedbar-variables) - (add-hook 'speedbar-load-hook 'Info-install-speedbar-variables)) +(with-eval-after-load 'speedbar + (Info-install-speedbar-variables)) ;;; Info hierarchy display method ;;;###autoload diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index d798ffa0516..d79cea987e9 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -4392,9 +4392,8 @@ browsing, and moving of messages." (text face mouse function &optional token prevline)) ;; Make sure our special speedbar major mode is loaded -(if (featurep 'speedbar) - (rmail-install-speedbar-variables) - (add-hook 'speedbar-load-hook 'rmail-install-speedbar-variables)) +(with-eval-after-load 'speedbar + (rmail-install-speedbar-variables)) (defun rmail-speedbar-buttons (buffer) "Create buttons for BUFFER containing rmail messages. diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index d5fd1dce6f5..567f452b935 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -486,9 +486,8 @@ The value t means that there is no stack, and we are in display-file mode.") "Additional menu items to add to the speedbar frame.") ;; Make sure our special speedbar mode is loaded -(if (featurep 'speedbar) - (gud-install-speedbar-variables) - (add-hook 'speedbar-load-hook 'gud-install-speedbar-variables)) +(with-eval-after-load 'speedbar + (gud-install-speedbar-variables)) (defun gud-expansion-speedbar-buttons (_directory _zero) "Wrapper for call to `speedbar-add-expansion-list'. -- 2.39.2