From: Mark Wooding Date: Tue, 23 Nov 2010 16:53:11 +0000 (+0000) Subject: el/dot-emacs.el: New command for SSH terminal buffers. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/c4434c20ffaccddde838b10732b3b03fbcb5c171?ds=sidebyside el/dot-emacs.el: New command for SSH terminal buffers. And some ugly hacking of `term-exec' to allow me to do this. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index c51803b..b5bdfd0 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -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.