Public
Snippet $33740 authored by Hermógenes Oliveira

GNU Screen inside GNU Emacs

screen-emacs.el
;; GNU Screen inside GNU Emacs

(defun term-screen ()
  (interactive)
  "Create GNU Screen session on an ansi-term or reattach existing one"
  (require 'term)
  (setq term-ansi-buffer-name (concat "*" "terminal" "*"))
  (term-ansi-make-term term-ansi-buffer-name
                             "/usr/bin/screen" nil "-d" "-R")

  (set-buffer term-ansi-buffer-name)
  (term-mode)
  (term-char-mode)
  
  ;; I like C-x better as a escape char
  (term-set-escape-char ?\C-x)
  
  (switch-to-buffer term-ansi-buffer-name))
  
;; For convenience, we can bind the function to a keystroke

(global-set-key (kbd "C-c t") 'term-screen)