Improved automatic tangling logic in Emacs.org#100
Open
Martinsos wants to merge 2 commits intodaviwil:masterfrom
Open
Improved automatic tangling logic in Emacs.org#100Martinsos wants to merge 2 commits intodaviwil:masterfrom
Martinsos wants to merge 2 commits intodaviwil:masterfrom
Conversation
Martinsos
commented
Oct 30, 2024
| (org-babel-tangle)))) | ||
|
|
||
| (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config))) | ||
| ;; Automatically tangle any org file in our emacs directory when we save it. |
Author
There was a problem hiding this comment.
While at it I updated the comment to reflect the changes you at some point did to the code (before it was just Emacs.org, now it is all org files in user emacs directory).
Martinsos
commented
Nov 1, 2024
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.
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 tparams in theadd-hookcall).I hope the suggestion is clear, if not, I believe the code in this PR should clear it up.
Thanks!