Skip to content
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

Show progress when evaluating files using cider-load-all-files #3714

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

katomuso
Copy link
Contributor

Show progress in echo area while recursively evaluating files in directory using cider-load-all-files.

As I've noticed that messages from evaluations keep popping up, so it's very hard to see progress message, I've used inhibit-message around cider-load-file. One possible downside of this is that error messages are not displayed as well (though it will be really hard to notice some error message while messages pop up one after the other).

Also, I've tweaked the prompt of cider-load-all-files because it might not be clear how files are loaded as the word "beneath" is ambiguous (it may mean one level of depth which is not the case).

Closes #3615

@bbatsov
Copy link
Member

bbatsov commented Jun 11, 2024

As I've noticed that messages from evaluations keep popping up, so it's very hard to see progress message, I've used inhibit-message around cider-load-file. One possible downside of this is that error messages are not displayed as well (though it will be really hard to notice some error message while messages pop up one after the other).

Yeah, that's not a big problem - after all most people will get some error buffers anyways.

Just add a changelog entry and we're good to go here.

(directory-files-recursively directory "\\.clj[cs]?$")))
(interactive "DRecursively load files in directory: \nP")
(let* ((files (directory-files-recursively directory "\\.clj[cs]?$"))
(reporter (make-progress-reporter "Loading files" 0 (length files))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should mention the directory name in the message as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, in every reporter message, there is already a name for the loaded file (the file argument of (progress-reporter-update reporter (1+ idx) file)), so I think there is no need to change anything.

(interactive "DRecursively load files in directory: \nP")
(let* ((files (directory-files-recursively directory "\\.clj[cs]?$"))
(reporter (make-progress-reporter "Loading files" 0 (length files))))
(seq-do-indexed (lambda (file idx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have probably used a dolist here, but I'm old-school. :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's a chore to manually manipulate the counter, and I couldn't pass up such a sweet function!

@katomuso
Copy link
Contributor Author

I've updated the changelog.

@bbatsov bbatsov merged commit 3ab2709 into clojure-emacs:master Jun 11, 2024
39 checks passed
@bbatsov
Copy link
Member

bbatsov commented Jun 11, 2024

Thanks!

@katomuso katomuso deleted the load-all-files-progress branch June 11, 2024 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants