From 1cbf2655db40cd474411b77ece57a287eb85ea2c Mon Sep 17 00:00:00 2001 From: Michael Albinus <michael.albinus@gmx.de> Date: Sun, 27 Nov 2022 16:57:03 +0100 Subject: Extend memory-info for remote systems * doc/lispref/files.texi (Magic File Names): Add memory-info. * doc/lispref/internals.texi (Garbage Collection): memory-info can also retrieve values from remote systems. * etc/NEWS: Document changes in memory-info. Fix typos. * lisp/files.el (warn-maybe-out-of-memory): Ensure local memory info. * lisp/net/tramp.el (tramp-handle-memory-info): New defun. (tramp-file-name-for-operation) * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist) * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add 'memory-info'. * lisp/net/tramp-sshfs.el (tramp-sshfs-handle-exec-path): Let-bind `process-file-side-effects'. * src/alloc.c (Fmemory_info): Support remote systems. (Qmemory_info): Declare. * test/lisp/net/tramp-tests.el (tramp-test31-memory-info): New test. --- lisp/files.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/files.el') diff --git a/lisp/files.el b/lisp/files.el index f1f890430f1..cd35fe38350 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2308,7 +2308,8 @@ it returns nil or exits non-locally." "Warn if an attempt to open file of SIZE bytes may run out of memory." (when (and (numberp size) (not (zerop size)) (integerp out-of-memory-warning-percentage)) - (let ((meminfo (memory-info))) + (let* ((default-directory temporary-file-directory) + (meminfo (memory-info))) (when (consp meminfo) (let ((total-free-memory (float (+ (nth 1 meminfo) (nth 3 meminfo))))) (when (> (/ size 1024) -- cgit v1.2.3