Paste number 12790: slime/tramp filename translation helpers

Index of paste annotations: 1 | 2

Paste number 12790: slime/tramp filename translation helpers
Pasted by: antifuchs
3 years, 2 months ago
#lisp
Paste contents:
Raw Source | XML | Display As
(defun asf-hack-slime-remotely (host)
  (interactive "sHost: ")
  (setq slime-translate-to-lisp-filename-function
        `(lambda (file-name)
           (if (string-match (concat "^/" ,host ":") file-name)
               (subseq file-name (length (concat "/" ,host ":")))
               file-name
)
)

        slime-translate-from-lisp-filename-function
        `(lambda (file-name)
           (let ((foo (concat "/" ,host ":" file-name)))
             (message foo)
             foo
)
)
)
)


(defun asf-hack-slime-locally ()
  (interactive)
  (setq slime-translate-to-lisp-filename-function 'identity
        slime-translate-from-lisp-filename-function 'identity
)
)

Annotations for this paste:

Annotation number 1: eh, not quite (removed debugging statements)
Pasted by: antifuchs
3 years, 2 months ago
Paste contents:
Raw Source | Display As
(defun asf-hack-slime-remotely (host)
  (interactive "sHost: ")
  (setq slime-translate-to-lisp-filename-function
        `(lambda (file-name)
           (if (string-match (concat "^/" ,host ":") file-name)
               (subseq file-name (length (concat "/" ,host ":")))
               file-name
)
)

        slime-translate-from-lisp-filename-function
        `(lambda (file-name)
           (concat "/" ,host ":" file-name)
)
)
)


(defun asf-hack-slime-locally ()
  (interactive)
  (setq slime-translate-to-lisp-filename-function 'identity
        slime-translate-from-lisp-filename-function 'identity
)
)

Annotation number 2: here's what I use at the moment.
Pasted by: antifuchs
2 years, 5 months ago
Paste contents:
Raw Source | Display As
(defun asf-hack-slime-remotely (host)
  (interactive "sHost: ")
  (setq slime-translate-to-lisp-filename-function
        `(lambda (file-name)
           (if (string-match (concat "^\\(/\\(scp:\\)?" ,host ":\\)") file-name)
               (subseq file-name (length (match-string 1 file-name)))
               file-name
)
)

        slime-translate-from-lisp-filename-function
        `(lambda (file-name)
           (concat "/" ,host ":" file-name)
)
)
)


(defun asf-hack-slime-locally ()
  (interactive)
  (setq slime-translate-to-lisp-filename-function 'identity
        slime-translate-from-lisp-filename-function 'identity
)
)


;;; remote slime connections

(defmacro define-slime-connector (name port remote-host-name)
  `(defun ,(intern (format "slime-%s" (symbol-name name))) ()
     (interactive)
     (slime-connect "127.0.0.1" ,port)
     (asf-hack-slime-remotely ,remote-host-name)
)
)


(define-slime-connector autobench-web 4006 "baker")
(define-slime-connector autobench 4007 "baker")
(define-slime-connector chavatar 4008 "baker")

Colorize as:
Show Line Numbers
Index of paste annotations: 1 | 2

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.