Paste number 12790: slime/tramp filename translation helpers

Index of paste annotations: 2 | 1

Paste number 12790: slime/tramp filename translation helpers
Pasted by: antifuchs
When:4 years, 4 months ago
Share:Tweet this! | http://paste.lisp.org/+9VA
Channel:#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 2: here's what I use at the moment.
Pasted by: antifuchs
When:3 years, 7 months ago
Share:Tweet this! | http://paste.lisp.org/+9VA/2
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")

Annotation number 1: eh, not quite (removed debugging statements)
Pasted by: antifuchs
When:4 years, 4 months ago
Share:Tweet this! | http://paste.lisp.org/+9VA/1
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))

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

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