I got a file(for instance, ~/.mozilla/firefox/xxx.default/sessionstore-backups/recovery.bak) that its content is one whole line
and size of over 1MB, if I open it in Emacs, Emacs will become very laggy, so I put some configuration in Emacs: if a buffer you are going to open is over 1MB, use fundamental-mode and disables some other minor modes such as font-lock-mode and linum-mode and other configs for high performance, but this configuration is only working for buffers that size is over 1MB AND contents is not very long lines(for example, /var/log/messages), IF the content of the file is long lines, the configuration is totally not working.
My configuration:
(defun check-large-file-hook ()
"If a file is over a given size, turn off minor modes"
(when (> (buffer-size) (* 1024 1024)) ;; 1 MB
(fundamental-mode)
(font-lock-mode -1)
(linum-mode -1)
(setq buffer-read-only t)
(buffer-disable-undo)
))
(add-hook 'find-file-hooks 'check-large-file-hook)
Is there any solution for this kind of problem?
NOTE:
Viewing long lines buffer is laggy is not my problem, so the VLF package would not be the solution to my post, my problem is configuration for lone lines buffer is not working.