From d9851c6df2d5b5e950329968ac268a06ef4adfbf Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 8 Apr 2022 12:47:53 +0200 Subject: [PATCH] Ensure local `default-directory' when calling `process-attributes'. * lisp/server.el (server-running-p): * lisp/subr.el (memory-limit): Ensure local `default-directory' when calling `process-attributes'. --- lisp/server.el | 3 ++- lisp/subr.el | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index da60f1cda77..763cf27f7ac 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -779,7 +779,8 @@ by the current Emacs process, use the `server-process' variable." (condition-case nil (if server-use-tcp (with-temp-buffer - (insert-file-contents-literally (expand-file-name name server-auth-dir)) + (setq default-directory server-auth-dir) + (insert-file-contents-literally (expand-file-name name)) (or (and (looking-at "127\\.0\\.0\\.1:[0-9]+ \\([0-9]+\\)") (assq 'comm (process-attributes diff --git a/lisp/subr.el b/lisp/subr.el index 34f7bb6888a..e7d5d36461c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2719,7 +2719,8 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'." (defun memory-limit () "Return an estimate of Emacs virtual memory usage, divided by 1024." - (or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0)) + (let ((default-directory temporary-file-directory)) + (or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0))) ;;;; Input and display facilities. -- 2.39.5