aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2014-07-10 17:00:45 +0400
committerDmitry Antipov2014-07-10 17:00:45 +0400
commit53dc1728079a2462d5e6ca2e187c2a6a61961e10 (patch)
tree83b859bac0e236438ce60ad0fd4d2ddc807db46c
parent9242810cd3bb14056dde937fc9ad39fc49261dfd (diff)
downloademacs-53dc1728079a2462d5e6ca2e187c2a6a61961e10.tar.gz
emacs-53dc1728079a2462d5e6ca2e187c2a6a61961e10.zip
* files.el (warn-maybe-out-of-memory): Fix last change.
-rw-r--r--lisp/files.el20
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 63bdf636b63..1d3ffe81b99 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1798,19 +1798,19 @@ OP-TYPE specifies the file operation being performed (for message to user)."
1798 1798
1799(defun warn-maybe-out-of-memory (size) 1799(defun warn-maybe-out-of-memory (size)
1800 "Warn if an attempt to open file of SIZE bytes may run out of memory." 1800 "Warn if an attempt to open file of SIZE bytes may run out of memory."
1801 (let ((meminfo (memory-info))) 1801 (when (and (numberp size) (not (zerop size)))
1802 (when (consp meminfo) 1802 (let ((meminfo (memory-info)))
1803 (let ((total-free-memory (+ (nth 1 meminfo) (nth 3 meminfo)))) 1803 (when (consp meminfo)
1804 (when (and (not (zerop size)) 1804 (let ((total-free-memory (+ (nth 1 meminfo) (nth 3 meminfo))))
1805 (> (/ size 1024) total-free-memory)) 1805 (when (> (/ size 1024) total-free-memory)
1806 (warn 1806 (warn
1807 "You are trying to open file which size (%s) 1807 "You are trying to open file which size (%s)
1808exceeds an amount of available free memory (%s). If that 1808exceeds an amount of available free memory (%s). If that
1809fails, try to open it with `find-file-literally' (but note 1809fails, try to open it with `find-file-literally' (but note
1810that some characters may be displayed incorrectly)." 1810that some characters may be displayed incorrectly)."
1811 (file-size-human-readable size) 1811 (file-size-human-readable size)
1812 (file-size-human-readable 1812 (file-size-human-readable
1813 (* (float total-free-memory) 1024)))))))) 1813 (* (float total-free-memory) 1024)))))))))
1814 1814
1815(defun find-file-noselect (filename &optional nowarn rawfile wildcards) 1815(defun find-file-noselect (filename &optional nowarn rawfile wildcards)
1816 "Read file FILENAME into a buffer and return the buffer. 1816 "Read file FILENAME into a buffer and return the buffer.