emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117508: * files.el (warn-maybe-out-of-memory): Fix


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117508: * files.el (warn-maybe-out-of-memory): Fix last change.
Date: Thu, 10 Jul 2014 13:01:42 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117508
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2014-07-10 17:00:45 +0400
message:
  * files.el (warn-maybe-out-of-memory): Fix last change.
modified:
  lisp/files.el                  files.el-20091113204419-o5vbwnq5f7feedwu-265
=== modified file 'lisp/files.el'
--- a/lisp/files.el     2014-07-10 12:33:35 +0000
+++ b/lisp/files.el     2014-07-10 13:00:45 +0000
@@ -1798,19 +1798,19 @@
 
 (defun warn-maybe-out-of-memory (size)
   "Warn if an attempt to open file of SIZE bytes may run out of memory."
-  (let ((meminfo (memory-info)))
-    (when (consp meminfo)
-      (let ((total-free-memory (+ (nth 1 meminfo) (nth 3 meminfo))))
-       (when (and (not (zerop size))
-                  (> (/ size 1024) total-free-memory))
-         (warn
-          "You are trying to open file which size (%s)
+  (when (and (numberp size) (not (zerop size)))
+    (let ((meminfo (memory-info)))
+      (when (consp meminfo)
+       (let ((total-free-memory (+ (nth 1 meminfo) (nth 3 meminfo))))
+         (when (> (/ size 1024) total-free-memory)
+           (warn
+            "You are trying to open file which size (%s)
 exceeds an amount of available free memory (%s).  If that
 fails, try to open it with `find-file-literally' (but note
 that some characters may be displayed incorrectly)."
-          (file-size-human-readable size)
-          (file-size-human-readable
-           (* (float total-free-memory) 1024))))))))
+            (file-size-human-readable size)
+            (file-size-human-readable
+             (* (float total-free-memory) 1024)))))))))
 
 (defun find-file-noselect (filename &optional nowarn rawfile wildcards)
   "Read file FILENAME into a buffer and return the buffer.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]