add ansi-color to be required#600
Merged
ricardoricho merged 2 commits intoemacs-dashboard:masterfrom Mar 29, 2026
Merged
Conversation
The ansi-color-apply-on-region function from ansi-color is used in this script, but the ansi-color is not required in the beginning of loading the package. This means that a race condition can happen that the dashboard is loaded before ansi-color and causes the following error: Warning` (native-compiler): dashboard-widgets.el:875:12: Warning: the function ‘ansi-color-apply-on-region’ is not known to be defined. This commit fixes that by requiring the ansi-color in the correct place.
ricardoricho
requested changes
Mar 29, 2026
Member
ricardoricho
left a comment
There was a problem hiding this comment.
Great, thanks for the PR.
This is as per kind comment of Ricardo Arredondo (https://github.com/ricardoricho) since only the ansi-color-apply-on-region function is used from all the functions in the ansi-color package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recently when I load my Emacs I get the following warning:
Which refers to this line:
dashboard/dashboard-widgets.el
Line 875 in f28b8e1
The issue mostly happens when running Emacs daemon and then connect an emacsclient to it. Also the issue does not always happen.
The
ansi-color-apply-on-regionis a natively compiled function defined inansi-color.el.gz. So I think the problem is some sort of race condition, that ifdashboard.elis loaded before theansi-color.el, the error occurs.I managed to solve it permanently (as far as my testing goes) using the following:
Considering this ad-hoc fix, I added
(require 'ansi-color)to thedashboard-widgets.elto make sure `ansi-color' is always loaded before we use its functions.