david@wubios.wustl.edu (David J. Camp) (10/11/90)
Here are my changes to make elm work with gnu emacs. I start emacs and run a terminal-emulator session running elm. I then use 'elmacs' as my editor within elm. This shell script can also be used by elm outside of emacs, in which case it will start emacs as a child process. Inside of emacs, it will cause a window to be opened in the same session. Use ^X^C to exit when run outside of emacs. Use ^X# to exit when run inside of emacs. The suspend.el package requires that you press ^Z twice to suspend emacs instead of once. It allows an emacs command to follow the first ^Z, including when in terminal mode. You can now type C-^ C-Z to send a ^Z to the application. I included the redefinition of C-N just to demonstrate how ^Z is helpful in switching among buffers by typing ^Z^N repeatedly. You will need vi-key.el to remap the other control keys so that ^N is not needed. ----- add these lines to your ~/.emacs file ----- (define-key global-map "\C-N" 'bury-buffer) ; I define ^J as next-line (load "suspend") ----- end of .emacs additions ----- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: ../bin/elmacs suspend.el terminal.pat # Wrapped by david@wubios on Wed Oct 10 04:48:16 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f '../bin/elmacs' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'../bin/elmacs'\" else echo shar: Extracting \"'../bin/elmacs'\" \(182 characters\) sed "s/^X//" >'../bin/elmacs' <<'END_OF_FILE' X#! /bin/sh Xif test "$1" = "" X then X echo "usage: elmacs filename" Xelif test $TERM != emacs-virtual X then X emacs $* Xelse X /usr/local/emacs/etc/emacsclient $* X fi X X X END_OF_FILE if test 182 -ne `wc -c <'../bin/elmacs'`; then echo shar: \"'../bin/elmacs'\" unpacked with wrong size! fi chmod +x '../bin/elmacs' # end of '../bin/elmacs' fi if test -f 'suspend.el' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'suspend.el'\" else echo shar: Extracting \"'suspend.el'\" \(2287 characters\) sed "s/^X//" >'suspend.el' <<'END_OF_FILE' X;; Suspend Processor for GNU Emacs. X;; Copyright (C) 1986, 1987 Free Software Foundation, Inc. X;; Written by David J. Camp, October 1990. X X;; This file is part of GNU Emacs. X X;; GNU Emacs is distributed in the hope that it will be useful, X;; but WITHOUT ANY WARRANTY. No author or distributor X;; accepts responsibility to anyone for the consequences of using it X;; or for whether it serves any particular purpose or works at all, X;; unless he says so in writing. Refer to the GNU Emacs General Public X;; License for full details. X X;; Everyone is granted permission to copy, modify and redistribute X;; GNU Emacs, but only under the conditions described in the X;; GNU Emacs General Public License. A copy of this license is X;; supposed to have been given to you along with GNU Emacs so you X;; can know your rights and responsibilities. It should be in a X;; file named COPYING. Among other things, the copyright notice X;; and this notice must be preserved on all copies. X X(defun noop () X "Do nothing; return nil." X (interactive)) X X(defvar command-escape-char ?\C-Z X "Press ^Z to enter any emacs command. X Press ^Z twice to send a ^Z.") X X(defun pend-command-escape () X "Requires a second ^Z" X (interactive) X (let X ((local (current-local-map)) X (global (current-global-map)) X (suspend-action 'suspend-emacs)) X (accept-emacs-command))) X X(define-key global-map X (make-string 1 command-escape-char) 'pend-command-escape) X X(defun accept-emacs-command () X "Accept an emacs command." X (interactive) X (use-local-map global-map) X (use-global-map global-map) X (setq old-escape (lookup-key (current-local-map) X (make-string 1 command-escape-char))) X (define-key (current-local-map) (make-string 1 command-escape-char) 'noop) X (setq emacs-key-sequence X (read-key-sequence "Enter Emacs Command or ^Z to Quit:")) X (message "") X (define-key (current-local-map) X (make-string 1 command-escape-char) old-escape) X (use-local-map local) X (use-global-map global) X (if (string= emacs-key-sequence (make-string 1 command-escape-char)) X (command-execute suspend-action) X (setq command (lookup-key global-map emacs-key-sequence)) X (command-execute command))) X X X END_OF_FILE if test 2287 -ne `wc -c <'suspend.el'`; then echo shar: \"'suspend.el'\" unpacked with wrong size! fi # end of 'suspend.el' fi if test -f 'terminal.pat' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'terminal.pat'\" else echo shar: Extracting \"'terminal.pat'\" \(2640 characters\) sed "s/^X//" >'terminal.pat' <<'END_OF_FILE' X*** /usr/local/emacs/lisp/terminal.el Fri Apr 15 02:19:45 1988 X--- terminal.el Wed Oct 10 04:43:04 1990 X*************** X*** 30,35 **** X--- 30,38 ---- X (provide 'terminal) X (require 'ehelp) X X+ (server-start) X+ (load "suspend") X+ X (defvar terminal-escape-char ?\C-^ X "*All characters except for this are passed verbatim through the X terminal-emulator. This character acts as a prefix for commands X*************** X*** 64,69 **** X--- 67,73 ---- X (defvar terminal-escape-map nil) X (defvar terminal-map nil) X (defvar terminal-more-break-map nil) X+ X (if terminal-map X nil X (let ((map (make-keymap))) X*************** X*** 90,95 **** X--- 94,106 ---- X (define-key map "m" 'te-toggle-more-processing) X (define-key map "x" 'te-escape-extended-command) X (define-key map "?" 'te-escape-help) X+ (define-key map "\e" 'accept-emacs-command) X+ (define-key map (make-string 1 command-escape-char) X+ '(lambda X+ () X+ "pass ^Z through" X+ (interactive) X+ (let ((command-escape-char -259)) (te-pass-through)))) X (define-key map (char-to-string help-char) 'te-escape-help) X (setq terminal-escape-map map))) X X*************** X*** 389,405 **** X (sit-for 0)))) X X X (defun te-pass-through () X "Send the last character typed through the terminal-emulator X! without any interpretation" X (interactive) X! (if (eql last-input-char terminal-escape-char) X! (call-interactively 'te-escape) X! (and terminal-more-processing X! (null (cdr te-pending-output)) X (te-set-more-count nil)) X (send-string te-process (make-string 1 last-input-char)) X! (te-process-output t))) X X (defun te-set-window-start () X (let* ((w (get-buffer-window (current-buffer))) X--- 400,423 ---- X (sit-for 0)))) X X X+ X (defun te-pass-through () X "Send the last character typed through the terminal-emulator X! without any interpretation" X (interactive) X! (cond X! ((eql last-input-char terminal-escape-char) X! (call-interactively 'te-escape)) X! ((eql last-input-char command-escape-char) X! (let X! ((suspend-action 'suspend-emacs)) X! (setq unread-command-char 27) X! (call-interactively 'te-escape))) X! (t X! (and terminal-more-processing (null (cdr te-pending-output)) X (te-set-more-count nil)) X (send-string te-process (make-string 1 last-input-char)) X! (te-process-output t)))) X X (defun te-set-window-start () X (let* ((w (get-buffer-window (current-buffer))) END_OF_FILE if test 2640 -ne `wc -c <'terminal.pat'`; then echo shar: \"'terminal.pat'\" unpacked with wrong size! fi # end of 'terminal.pat' fi echo shar: End of shell archive. exit 0 david@wubios.wustl.edu ^ Mr. David J. Camp david%wubios@wugate.wustl.edu < * > +1 314 382 0584 ...!uunet!wugate!wubios!david v "White light makes me stupid."