chiark / gitweb /
el/dot-emacs.el: New command for SSH terminal buffers.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 23 Nov 2010 16:53:11 +0000 (16:53 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 23 Nov 2010 16:53:11 +0000 (16:53 +0000)
And some ugly hacking of `term-exec' to allow me to do this.

el/dot-emacs.el

index c51803b7a1308e397ee69d99a2520fa19c516ac4..b5bdfd07cde0142d645235b65d45dcc1735af0d0 100644 (file)
@@ -2473,6 +2473,20 @@      (define-key term-raw-map [?\e ?\M-O ?C] 'term-send-meta-right)
      (define-key term-raw-map [M-left] 'term-send-meta-left)
      (define-key term-raw-map [?\e ?\M-O ?D] 'term-send-meta-left)))
 
+(defadvice term-exec (before program-args-list compile activate)
+  "If the PROGRAM argument is a list, interpret it as (PROGRAM . SWITCHES).
+This allows you to pass a list of arguments through `ansi-term'."
+  (let ((program (ad-get-arg 2)))
+    (if (listp program)
+       (progn
+         (ad-set-arg 2 (car program))
+         (ad-set-arg 4 (cdr program))))))
+
+(defun ssh (host)
+  "Open a terminal containing an ssh session to the HOST."
+  (interactive "sHost: ")
+  (ansi-term (list "ssh" host) (format "ssh@%s" host)))
+
 ;;;--------------------------------------------------------------------------
 ;;; Inferior Emacs Lisp.