fix #5448: guard nil buffer size

This commit is contained in:
Muneeb Shaikh 2016-03-11 17:00:13 +05:30
parent d52eb414bb
commit 6c17e3bc3a
1 changed files with 6 additions and 6 deletions

View File

@ -329,12 +329,12 @@ argument takes the kindows rotate backwards."
;; check when opening large files - literal file open
(defun spacemacs/check-large-file ()
(when (> (nth 7 (file-attributes (buffer-file-name)))
(* 1024 1024 dotspacemacs-large-file-size))
(when (y-or-n-p "This is a large file, open literally to avoid performance issues?")
(setq buffer-read-only t)
(buffer-disable-undo)
(fundamental-mode))))
(let ((size (nth 7 (file-attributes (buffer-file-name)))))
(when (and size (> size (* 1024 1024 dotspacemacs-large-file-size)))
(when (y-or-n-p "This is a large file, open literally to avoid performance issues?")
(setq buffer-read-only t)
(buffer-disable-undo)
(fundamental-mode)))))
;; found at http://emacswiki.org/emacs/KillingBuffers
(defun spacemacs/kill-other-buffers ()