From c17758390ae006567bad1e9bd52201030d143f7c Mon Sep 17 00:00:00 2001 From: pcookse1 Date: Tue, 26 Nov 2024 09:03:28 -0800 Subject: [PATCH] Fix rtags completion over tramp with unsaved buffer for remote file 1. Use the tramp aware function make-nearby-temp-file to create the tmp file on the remote host (if default-directory is remote). 2. Change the path prefix to a relative path as absolute forces it to always be a local file. 3. Change the path prefix to be unique to rtags as suggested by the documentation for make-temp-file. 4. Use rtags-untrampify on the temp file name so that we pass the local file name to rc on the remote system. --- src/rtags.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rtags.el b/src/rtags.el index 6f0c3f1a3..63171916c 100644 --- a/src/rtags.el +++ b/src/rtags.el @@ -1309,8 +1309,8 @@ to only call this when `rtags-socket-address' is defined. (when path-filter-regex (push "-Z" arguments))) (when (and unsaved (rtags-buffer-file-name unsaved)) - (setq tempfile (make-temp-file "/tmp/")) - (push (format "--unsaved-file=%s:%s" (rtags-untrampify (rtags-buffer-file-name unsaved)) tempfile) arguments) + (setq tempfile (make-nearby-temp-file "rtags")) + (push (format "--unsaved-file=%s:%s" (rtags-untrampify (rtags-buffer-file-name unsaved)) (rtags-untrampify tempfile)) arguments) (with-current-buffer unsaved (save-restriction (widen)