Emacs Slime mode : slime-tramp 對應遠端檔案路徑
遠端使用 swank 伺服器
在 Emacs slime-connect 連接遠端 SBCL (common lisp) 。
slime-tramp
的用途
-
讓 SLIME 在遠端 Lisp 回報檔案路徑時,可以自動轉換成 TRAMP 格式路徑(像
/ssh:remote-host:/path/to/file.lisp
),
這樣 Emacs 不需要額外的sshfs
掛載就能直接打開遠端檔案。 -
不需要手動維護
slime-filename-translations
的 alist,適合「只用 ssh 連線,不掛載遠端檔案」的情境。
自動路徑轉換
當 Lisp 回傳例如:
(require 'slime)
(slime-setup '( slime-cl-indent
slime-asdf slime-fancy
slime-fancy-inspector
slime-fuzzy slime-autodoc
slime-sprof
slime-tramp))
(push (slime-create-filename-translator
:machine-instance "service-1"
:remote-host "service-1"
:username "user1")
slime-filename-translations)
可以配合遠端 repl 開發源碼。
移除舊的緩存和臨時檔
出現類似
tramp-sh-handle-file-newer-than-file-p: Files /tmp/#!ssh:user1@service-1:!home!user1!src!main.lisp# and /ssh:user1@service-1:/home/user1/src/main.lisp must have same method, user, host...
有時 TRAMP 會因為緩存或舊的臨時檔而產生不一致的行為。你可以試著關閉 Emacs,然後手動刪除 TRAMP 的暫存目錄。
在你的 Linux 或 macOS 系統上,TRAMP 的暫存檔通常位於 /tmp/
目錄下。你可以找找看是否有類似 /tmp/tramp.23423
的目錄,或是檔名中有 #!
的檔案。找到並刪除它們。
留言
張貼留言