Let's not do tramp for now

This commit is contained in:
Benson Chu 2026-04-04 16:56:15 -05:00
parent a4e62fe73e
commit cf32daf8ce
4 changed files with 36 additions and 51 deletions

View file

@ -54,7 +54,7 @@
(defclass comp-dev-config ()
((root-dir :initarg :root-dir :type string)
(target :initarg :target :type string)
(tramp-connection :initarg :tramp :type list :initform nil)
;; (tramp-connection :initarg :tramp :type list :initform nil)
(aux-props :initarg :aux-props :type list :initform nil)))
@ -105,20 +105,6 @@
(setf (slot-value (comp-dev/get-config) key)
val))
(defun lls/tramp-connection ()
(lls/conf-get 'tramp-connection))
(defun lls/trampify (path)
(if-let ((vec (lls/tramp-connection)))
(tramp-make-tramp-file-name vec path)
path))
(defun lls/un-trampify (path)
(if-let ((vec (lls/tramp-connection)))
(with-parsed-tramp-file-name path nil
localname)
path))
(defun lls/default-initialize ()
(interactive)
(let ((lls/target-init-fun #'lls/default-target-init))
@ -200,7 +186,6 @@
collection nil nil initial-input)))))
(defun lls/prompt-tool (tool-regexp &optional directories)
(lls/un-trampify
(let (;;(vertico-sort-function nil)
)
(my/completing-read tool-regexp
@ -210,7 +195,7 @@
directories))
(awhen (ti/current-tools-directory)
(concat (file-name-nondirectory it)
" "))))))
" ")))))
(defun lls/get-tool (tool-regexp &optional directories)
(cl-mapcan #'(lambda (dir)

View file

@ -134,8 +134,8 @@
(ediff-files "/tmp/no-option.asm" "/tmp/yes-option.asm")))
(defun ll/diff-on-compiler (file action)
(let ((comm (ll/build-clang-command (lls/un-trampify file) action))
(second-command (ll/build-clang-command (lls/un-trampify file) action))
(let ((comm (ll/build-clang-command file action))
(second-command (ll/build-clang-command file action))
(pipe (if (y-or-n-p "Diff assembly (y) or debug (n)? ")
">" "2>")))
(when (save-window-excursion
@ -165,7 +165,7 @@
(t ".ll")))))
(if (eq action 'diff)
(ll/diff-c-on-two-compilations file action)
(let ((comm (ll/build-clang-command (lls/un-trampify file) action output)))
(let ((comm (ll/build-clang-command file action output)))
(aprog1
(compilation-start
comm

View file

@ -33,14 +33,14 @@
(cons build-dir it)
(reverse it)
(cons (file-name-directory file) it)
(mapcar #'(lambda (x) (concat "-I" (lls/un-trampify x))) it)
(mapcar #'(lambda (x) (concat "-I" x)) it)
(string-join it " ")))
(defun ll-tblgen/gen-command (file flags output-file build-dir)
(let ((bin (car (lls/get-tool "llvm-tblgen$" (list (expand-file-name "bin" build-dir))))))
(format "%s %s %s %s"
bin
(lls/un-trampify file)
file
(ll-tblgen/get-includes file build-dir)
(string-join
(list
@ -142,11 +142,11 @@
(setq comm (concat comm " --print-records")))
((eq action ?c)
(setq comm (concat (format "mkdir -p %s"
(lls/un-trampify (diredp-parent-dir out)))
(diredp-parent-dir out))
" && "
comm
(format " -o %s"
(lls/un-trampify out))))))
out)))))
(compilation-start
comm

View file

@ -46,24 +46,24 @@
(let ((file (or (buffer-file-name)
(aprog1 (make-temp-file nil nil ".ll")
(write-file it)))))
(when-let ((vec (lls/tramp-connection))
((not (file-remote-p file))))
;; If there's a cache entry, and the cache timestamp matches,
;; then we just reuse the file
(-->
(if-let* ((cache (gethash file ll/buffer-map))
(time (visited-file-modtime))
((equal time (car cache))))
(cdr cache)
;; Otherwise, generate a new tmp file, copy that over, and
;; update the cache.
(let ((tmp (concat (tramp-make-tramp-temp-name vec)
"." (file-name-extension file))))
(puthash file (cons time tmp) ll/buffer-map)
(copy-file file tmp)
tmp))
(setq file it)))
;; Let further compilation-commands be run over tramp
;; (when-let ((vec (lls/tramp-connection))
;; ((not (file-remote-p file))))
;; ;; If there's a cache entry, and the cache timestamp matches,
;; ;; then we just reuse the file
;; (-->
;; (if-let* ((cache (gethash file ll/buffer-map))
;; (time (visited-file-modtime))
;; ((equal time (car cache))))
;; (cdr cache)
;; ;; Otherwise, generate a new tmp file, copy that over, and
;; ;; update the cache.
;; (let ((tmp (concat (tramp-make-tramp-temp-name vec)
;; "." (file-name-extension file))))
;; (puthash file (cons time tmp) ll/buffer-map)
;; (copy-file file tmp)
;; tmp))
;; (setq file it)))
;; ;; Let further compilation-commands be run over tramp
(let ((default-directory (file-name-directory file)))
(pcase (file-name-extension file)
((and _ (guard (ll/is-test-file file)))