Fix loading large non file-visiting buffers + simplification of the implementation #6
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.
This PR fixes #5 and simplifies the implementation in these manners:
find-file-noselect
, the file will be opened in all cases, and if we want to check for the /file size/ or for /too long lines/, we can do it inside theset-auto-mode-0
advice function (using the current buffer and the(buffer-file-name)
).set-auto-mode-0
's advice?)guard-lf--line-too-long-p
function has been modified to work on a buffer instead of a file (to avoid opening the file temporarily).Edit
I think, by using the
buffer-size
to calculate the current buffer size, we don't even need to get the file size from the file system's attributes. At theset-auto-mode-0
level, the file would be already inserted in the current buffer, so we can relay on(buffer-size)
!