reposting emacs vt100 keypad bindings
William McKeeman
mckeeman at wanginst.UUCP
Fri May 17 06:32:55 AEST 1985
(reposting because cursor bindings were wrong -- sorry)
This is a keypad binding for emacs on a vt100 or lookalike.
It requires Unipress (Gosling) emacs version 2.
It takes some "finger training" to use it effectively.
It is designed for my main emacs activity: document preparation.
Programmers might want to modify it somewhat.
Permission to modify and further distribute is unconditionally given.
/s/ Bill McKeeman, Wang Institute, Tyngsboro, MA 01879
========================cut here=================================
#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# vt100.ml
# This archive created: Thu May 16 16:20:45 1985
export PATH; PATH=/bin:$PATH
echo shar: extracting "'vt100.ml'" '(9381 characters)'
if test -f 'vt100.ml'
then
echo shar: over-writing existing file "'vt100.ml'"
fi
sed 's/^X//' << \SHAR_EOF > 'vt100.ml'
X;-----------------------------------------------------------------------------
X;NAME
X; vt100.ml -- vt100 terminal support package
X;
X;SYNOPSIS
X; No externally useable functions provided; this package is self contained.
X;
X;REQUIREMENTS
X; VT100 or lookalike terminal
X; Emacs version 2.00 or later
X; You should set default value of vt100-ml-path below (near line 121)
X;
X;KEY BINDINGS (^v to page through this documentation, esc v to page back)
X; ------ ------ ------ ------
X; | left | right| para | page |
X; |margin|margin| up | up |
X; ------ ------ ------ ------
X; | word | word | para | page |
X; | left | right| down | down |
X; ------ ------ ------ ------
X; | bof/ | wrap/| line |window|
X; | eof |scroll|?/goto|nxt/dl|
X; ------ ------ ------ ------
X; | mark | paste| macro| w f |
X; | &cut | /undo|xeq/ed| r i |
X; ------------- ------| i l |
X; | visit | gold | t e |
X; | file/shell | /help| e(s) |
X; ------------- ------ ------
X; See below for more detail.
X;
X;DESCRIPTION
X; This package, when loaded, sets up global bindings for the special
X; keys on a VT100 terminal or Wang PC using VT100 emulation.
X; Care has been taken to:
X; (1) maximize functionality
X; (2) minimize keystrokes
X; (3) minimize danger from missed keystrokes
X;
X;EXPLANATION
X; gold enables secondary choice for other keys
X; gold gold (help) visit definition file for this package
X;
X; mark&cut if mark is not set, mark one end of text(^@)
X; if mark is set, cut the text between (^w)
X; mark and present cursor position
X; paste insert the last cut text (^y)
X; after the cursor position
X; gold undo undo last command
X;
X; visit(file) make file visible (read if necessary) (^x ^v)
X; gold visit(shell) make shell visible (start if necessary) (esc s)
X;
X; write file write current buffer to its file (^x ^s)
X; gold write files write all modified buffers to files (^x ^m)
X;
X; nxt window cursor to next window (^x n)
X; gold dl window split the current window (^x 2)
X;
X; macro xeq playout last defined keyboard macro (^x e)
X; gold macro ed examine or edit current keyboard macro
X;
X; line ? display current line number
X; gold line goto goto specified line
X;
X; word left move cursor to first letter of next word to the left
X; word right move cursor to character following word to the right
X;
X; left margin move cursor to left end of current line (^a)
X; right margin move cursor to right end of current line(^e)
X;
X; bof move cursor to beginning of file (esc <)
X; gold eof move cursor to end of file (esc >)
X;
X; page up move display to previous page (esc v)
X; page down move display to next page (^v)
X;
X; para up move to previous paragraph
X; para down move to next paragraph
X;
X; wrap toggle wrap/no-wrap modes
X; gold scroll horizontal scrolling:
X; set distance from begin-of-line to begin-of-screen
X;
X; backspace delete previous character
X; delete delete character over cursor
X; ^c pause emacs and return to unix
X;
X;VT100 TERMCAP
X;
X;d1|vt100|vt-100|pt100|pt-100|dec vt100:\
X; :co#80:li#24:am:cl=50\E[;H\E[2J:bs:cm=5\E[%i%2;%2H:nd=2\E[C:up=2\E[A:\
X; :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\
X; :is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\
X; :if=/usr/lib/tabset/vt100:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:\
X; :kh=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:xn:
X;
X;HISTORY
X; {4} 30-Apr-85 Bill McKeeman at WangInst
X; Elaborated keypad definitions.
X; {3} 22-Nov-84 Mike Gallaher at unipress
X; Added standard keypad and labeled key definitions.
X; {2} 07-Aug-84 Eric S. Raymond
X; Fixed a documentation bug.
X; {1} 12-Jul-84 Eric S. Raymond and Dave Langdon at Rabbit Software
X; Created.
X;-----------------------------------------------------------------------------
X(declare-global vt100-mark-is-set) (setq vt100-mark-is-set 0)
X(declare-global vt100-gold-key-pressed) (setq vt100-gold-key-pressed 0)
X(declare-global vt100-ml-path)
X
X; Preliminaries -- let's get the environment right
X(progn ver ; check for "Emacs V2.00 (12-Feb-85) Unix version"
X (setq ver (emacs-version))
X (if (| (< (substr ver 8 1) "2") (!= (substr ver 9 1) "."))
X (error-message "Need later version of emacs for vt100.ml package")
X )
X (send-string-to-terminal "\e=") ; set keypad alt mode
X (if (error-occurred (setq vt100-ml-path (getenv "EPATH")))
X (progn ; path to help file
X (setq vt100-ml-path "/usr/local/lib/emacs/maclib/"); reasonable default
X (message "Unix environment variable EPATH not set; default used")
X (sit-for 2)
X ) )
X)
X; Special editing keys and settings
X(bind-to-key "delete-previous-character" "\^h") ; backspace
X(bind-to-key "delete-next-character" "\177") ; delete
X(bind-to-key "pause-emacs" "\^c") ; control c
X(bind-to-key "vt100-careful-macro" "\^xe") ; control x e
X(setq right-margin 78) ; avoid edge effects
X(setq scroll-step 1) ; auto scroll amount
X(setq track-eol-on-^N-^P 0) ; vertical curse ctrl
X
X; Cursor controls
X(bind-to-key "backward-character" "\e[D") ; cursor <
X(bind-to-key "previous-line" "\e[A") ; cursor ^
X(bind-to-key "next-line" "\e[B") ; cursor v
X(bind-to-key "forward-character" "\e[C") ; cursor >
X(bind-to-key "backward-character" "\eOD") ; cursor <
X(bind-to-key "previous-line" "\eOA") ; cursor ^
X(bind-to-key "next-line" "\eOB") ; cursor v
X(bind-to-key "forward-character" "\eOC") ; cursor >
X
X; Keypad definitions
X(bind-to-key "beginning-of-line" "\eOP") ; keypad pf1 +
X(bind-to-key "end-of-line" "\eOQ") ; keypad pf2 -
X(bind-to-key "backward-paragraph" "\eOR") ; keypad pf3 *
X(bind-to-key "previous-page" "\eOS") ; keypad pf4 /
X(bind-to-key "forward-paragraph" "\eOy") ; keypad 9
X(bind-to-key "forward-word" "\eOx") ; keypad 8
X(bind-to-key "backward-word" "\eOw") ; keypad 7
X(bind-to-key "vt100-line-number" "\eOv") ; keypad 6
X(bind-to-key "vt100-wrap-or-scroll" "\eOu") ; keypad 5
X(bind-to-key "vt100-file-begin-or-end" "\eOt") ; keypad 4
X(bind-to-key "vt100-macros" "\eOs") ; keypad 3
X(bind-to-key "vt100-paste-or-undo" "\eOr") ; keypad 2
X(bind-to-key "vt100-set-mark-or-cut" "\eOq") ; keypad 1
X(bind-to-key "vt100-visit-file-or-shell" "\eOp") ; keypad 0
X(bind-to-key "next-page" "\eOm") ; keypad - print
X(bind-to-key "vt100-next-or-delete-window" "\eOl") ; keypad , erase
X(bind-to-key "vt100-gold-key" "\eOn") ; keypad .
X(bind-to-key "vt100-write-file-or-files" "\eOM") ; keypad enter
X
X(defun
X (vt100-gold-key
X (if (= vt100-gold-key-pressed 0)
X (setq vt100-gold-key-pressed 1)
X (vt100-help)
X )
X )
X
X (vt100-paste-or-undo
X (if (= vt100-gold-key-pressed 0)
X (yank-from-killbuffer)
X (error-occurred (new-undo))
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-set-mark-or-cut
X (if (error-occurred (mark)) (setq vt100-mark-is-set 0))
X (if (= vt100-mark-is-set 0)
X (progn (set-mark) (setq vt100-mark-is-set 1))
X (progn (delete-to-killbuffer) (setq vt100-mark-is-set 0))
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-write-file-or-files
X (if (= vt100-gold-key-pressed 0)
X (progn (write-current-file)(message(concat "Wrote "(current-file-name))))
X (progn (write-modified-files) (message "Wrote all modified files."))
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-macros
X (if (= vt100-gold-key-pressed 0)
X (vt100-careful-macro)
X (progn
X (error-occurred (define-keyboard-macro "vt100-current-macro"))
X (if (error-occurred (edit-macro "vt100-current-macro"))
X (message "No macro defined. ^x( macro-body ^x) to define macro.")
X (message "Current macro: edit and (define-buffer-macro) or delete window.")
X )
X )
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-careful-macro
X (if (error-occurred (execute-keyboard-macro))
X (if (error-occurred (vt100-current-macro))
X (message "No macro defined. ^x( macro-body ^x) to define macro.")
X (message "Executed macro.")
X )
X (message "Executed macro.")
X )
X )
X
X (vt100-next-or-delete-window
X (if (= vt100-gold-key-pressed 0)
X (next-window)
X (delete-window)
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-line-number
X (if (= vt100-gold-key-pressed 0)
X (message (concat "line number = " (line-number)))
X (goto-line (get-tty-string "go to line number: "))
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-file-begin-or-end
X (if (= vt100-gold-key-pressed 0)
X (beginning-of-file)
X (end-of-file)
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-visit-file-or-shell
X (if (= vt100-gold-key-pressed 0)
X (visit-file (get-tty-file "Enter file name:"))
X (shell)
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-wrap-or-scroll
X (if (= vt100-gold-key-pressed 0)
X (setq wrap-long-lines (! wrap-long-lines))
X (setq left-offset (get-tty-string "Move left screen edge to:"))
X )
X (setq vt100-gold-key-pressed 0)
X )
X
X (vt100-help
X (setq vt100-gold-key-pressed 0)
X (switch-to-buffer "vt100-help")
X (if (error-occurred (read-file (concat vt100-ml-path "vt100.ml")))
X (progn
X (delete-buffer "vt100-help")
X (error-message
X "Unix environment variable EPATH does not point to vt100.ml"
X ) ) )
X (setq read-only 1)
X (beginning-of-file)
X )
X)
X; vt100.ml ends here -----------------------------------------------------
SHAR_EOF
if test 9381 -ne "`wc -c < 'vt100.ml'`"
then
echo shar: error transmitting "'vt100.ml'" '(should have been 9381 characters)'
fi
# End of shell archive
exit 0
More information about the Comp.sources.unix
mailing list