emacs-diffs
[Top][All Lists]
Advanced

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

master 44cc54e4099: Tweak file/dir creation in eglot-tests


From: Basil L. Contovounesios
Subject: master 44cc54e4099: Tweak file/dir creation in eglot-tests
Date: Mon, 10 Apr 2023 05:29:03 -0400 (EDT)

branch: master
commit 44cc54e409943275f4a600136bf5136e9c655626
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Tweak file/dir creation in eglot-tests
    
    * test/lisp/progmodes/eglot-tests.el (eglot--make-file-or-dir):
    Expand file name only once, under default-directory, avoiding
    duplicate dir separators.  Ensure default-directory ends with a dir
    separator.  Use with-temp-file.  (Bug#61637)
---
 test/lisp/progmodes/eglot-tests.el | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/test/lisp/progmodes/eglot-tests.el 
b/test/lisp/progmodes/eglot-tests.el
index 86e7b21def0..0486c938558 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -70,17 +70,16 @@ directory hierarchy."
   `(eglot--call-with-fixture ,fixture (lambda () ,@body)))
 
 (defun eglot--make-file-or-dir (ass)
-  (let ((file-or-dir-name (car ass))
+  (let ((file-or-dir-name (expand-file-name (car ass)))
         (content (cdr ass)))
     (cond ((listp content)
            (make-directory file-or-dir-name 'parents)
-           (let ((default-directory (concat default-directory "/" 
file-or-dir-name)))
+           (let ((default-directory (file-name-as-directory file-or-dir-name)))
              (mapcan #'eglot--make-file-or-dir content)))
           ((stringp content)
-           (with-temp-buffer
-             (insert content)
-             (write-region nil nil file-or-dir-name nil 'nomessage))
-           (list (expand-file-name file-or-dir-name)))
+           (with-temp-file file-or-dir-name
+             (insert content))
+           (list file-or-dir-name))
           (t
            (eglot--error "Expected a string or a directory spec")))))
 



reply via email to

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