Improved automatic tangling logic in Emacs.org #100
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.
First of all, thanks for amazing effort in creating System Crafters: I am just going through the "emacs from scratch" old playlist and I find it incredibly useful and enjoyable.
I opened this PR because I was curious if we can do automatic tangling in more efficient way. If I am correct, the current logic in this repo (and from the video number 7) is somewhat inefficient, in a way that it will register after-save-hook for every buffer opened with org-mode, and then it will, in that hook, check again and again if that buffer is Emacs.org or not.
However, couldn't we instead do that check just once per buffer, at the moment when we are making a decision if we should register after-save-hook for that buffer or not? That way we register after-save-hook only for Emacs.org buffer (we have to make it a local hook though, that is why additional
nil t
params in theadd-hook
call).I hope the suggestion is clear, if not, I believe the code in this PR should clear it up.
Thanks!