mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Perform large-file checks after major-mode is decided
Fixes an issue where pdfs (in pdf-view-mode) weren't been converted correctly because the file was declared large while it was being read in fundamental-mode.
This commit is contained in:
@ -39,13 +39,13 @@ possible."
|
|||||||
(if (setq doom-large-file-p
|
(if (setq doom-large-file-p
|
||||||
(and buffer-file-name
|
(and buffer-file-name
|
||||||
(not doom-large-file-p)
|
(not doom-large-file-p)
|
||||||
(not (memq major-mode doom-large-file-excluded-modes))
|
|
||||||
(file-readable-p buffer-file-name)
|
(file-readable-p buffer-file-name)
|
||||||
(> (nth 7 (file-attributes buffer-file-name))
|
(> (nth 7 (file-attributes buffer-file-name))
|
||||||
(* 1024 1024 doom-large-file-size))))
|
(* 1024 1024 doom-large-file-size))))
|
||||||
(delay-mode-hooks
|
(prog1 (apply orig-fn args)
|
||||||
(prog1 (apply orig-fn args)
|
(if (memq major-mode doom-large-file-excluded-modes)
|
||||||
(buffer-disable-undo)
|
(setq doom-large-file-p nil)
|
||||||
|
(so-long-minor-mode +1)
|
||||||
(message "Large file detected! Cutting a few corners to improve performance...")))
|
(message "Large file detected! Cutting a few corners to improve performance...")))
|
||||||
(apply orig-fn args)))
|
(apply orig-fn args)))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user