-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: elpaca example results in initializing dashboard twice #499
Comments
cc @progfolio |
The above assessment looks sound to me. ;; Probably want to avoid the -hook suffix in the actual parameter names.
;; But for example's sake:
(defun dashboard-setup-startup-hook (&optional insert-hook init-hook)
"Setup post initialization hooks unless a command line argument is provided.
If INSERT-HOOK or INIT-HOOK are non-nil, use those instead of the default initalization hooks."
(when (< (length command-line-args) 2) ;; Assume no file name passed
(add-hook 'window-size-change-functions #'dashboard-resize-on-hook 100)
(add-hook 'window-setup-hook #'dashboard-resize-on-hook)
(add-hook (or insert-hook 'after-init-hook) #'dashboard-insert-startupify-lists)
(add-hook (or init-hook 'emacs-startup-hook) #'dashboard-initialize))) That way we avoid extracting the logic from the setup function. (use-package dashboard
:ensure t
:config
(apply #'dashboard-setup-startup-hook
(when (featurep 'elpaca) '(elpaca-after-init-hook elpaca-after-init-hook)))) What do you two think of that idea? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The example for configuring this package for Elpaca compatibility calls
dashboard-setup-startup-hook
, however this results in initializing the dashboard onafter-init-hook
in addition to the correctelpaca-after-init-hook
.Source of
dashboard-setup-startup-hook
:emacs-dashboard/dashboard.el
Lines 497 to 504 in ed1a6a4
README example:
emacs-dashboard/README.org
Lines 58 to 63 in ed1a6a4
Thanks to #475, it is at least possible to work around.
Edit, providing example:
The common
add-hook
usages could be extracted to a separate function and then a call to that function could be added in the Elpaca example. The function should then also be called indashboard-setup-startup-hook
to replace the original lines, preserving backward compatibility.Also note that
:elpaca t
should be replaced with:ensure t
due to upstream changes.The text was updated successfully, but these errors were encountered: