Refactor doom|check-large-file
This commit is contained in:
parent
3ad39af712
commit
cecff39a7e
1 changed files with 2 additions and 3 deletions
|
@ -56,14 +56,13 @@ modes are active and the buffer is read-only.")
|
|||
"Check if the buffer's file is large (see `doom-large-file-size'). If so, ask
|
||||
for confirmation to open it literally (read-only, disabled undo and in
|
||||
fundamental-mode) for performance sake."
|
||||
(let* ((filename (buffer-file-name))
|
||||
(size (nth 7 (file-attributes filename))))
|
||||
(let ((size (nth 7 (file-attributes buffer-file-name))))
|
||||
(when (and (not (memq major-mode doom-large-file-modes-list))
|
||||
size (> size (* 1024 1024 doom-large-file-size))
|
||||
(y-or-n-p
|
||||
(format (concat "%s is a large file, open literally to "
|
||||
"avoid performance issues?")
|
||||
(file-relative-name filename))))
|
||||
(file-relative-name buffer-file-name))))
|
||||
(setq buffer-read-only t)
|
||||
(buffer-disable-undo)
|
||||
(fundamental-mode))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue