4.4BSD/usr/src/contrib/emacs-18.57/lisp/edt.elc


(require (quote keypad))

(defvar edt-last-deleted-lines "" "\
Last text deleted by an EDT emulation line-delete command.")

(defvar edt-last-deleted-words "" "\
Last text deleted by an EDT emulation word-delete command.")

(defvar edt-last-deleted-chars "" "\
Last text deleted by an EDT emulation character-delete command.")

(defun delete-current-line (num) "\
Delete one or specified number of lines after point.
This includes the newline character at the end of each line.
They are saved for the EDT undelete-lines command." (interactive "p") (byte-code "È`	!h=?c`\"`\")" [beg num edt-last-deleted-lines nil forward-line 10 "
" buffer-substring delete-region] 5))

(defun delete-to-eol (num) "\
Delete text up to end of line.
With argument, delete up to to Nth line-end past point.
They are saved for the EDT undelete-lines command." (interactive "p") (byte-code "È`!	!`\"`\")" [beg num edt-last-deleted-lines nil forward-char 1 end-of-line buffer-substring delete-region] 6))

(defun delete-current-word (num) "\
Delete one or specified number of words after point.
They are saved for the EDT undelete-words command." (interactive "p") (byte-code "È`	!`\"`\")" [beg num edt-last-deleted-words nil forward-word buffer-substring delete-region] 5))

(defun delete-previous-word (num) "\
Delete one or specified number of words before point.
They are saved for the EDT undelete-words command." (interactive "p") (byte-code "È`	[!`\"`\")" [beg num edt-last-deleted-words nil forward-word buffer-substring delete-region] 5))

(defun delete-current-char (num) "\
Delete one or specified number of characters after point.
They are saved for the EDT undelete-chars command." (interactive "p") (byte-code "ˆ`d`	\\^\"`d`	\\^\"" [edt-last-deleted-chars num nil buffer-substring delete-region] 6))

(defun delete-previous-char (num) "\
Delete one or specified number of characters before point.
They are saved for the EDT undelete-chars command." (interactive "p") (byte-code "ˆe`	Z]`\"e`	Z]`\"" [edt-last-deleted-chars num nil buffer-substring delete-region] 5))

(defun undelete-lines nil "\
Yank lines deleted by last EDT line-deletion command." (interactive) (byte-code "c" [edt-last-deleted-lines nil] 1))

(defun undelete-words nil "\
Yank words deleted by last EDT word-deletion command." (interactive) (byte-code "c" [edt-last-deleted-words nil] 1))

(defun undelete-chars nil "\
Yank characters deleted by last EDT character-deletion command." (interactive) (byte-code "c" [edt-last-deleted-chars nil] 1))

(defun next-end-of-line (num) "\
Move to end of line; if at end, move to end of next line.
Accepts a prefix argument for the number of lines to move." (interactive "p") (byte-code " !" [num nil forward-char end-of-line] 3))

(defun previous-end-of-line (num) "\
Move EOL upward.
Accepts a prefix argument for the number of lines to move." (interactive "p") (byte-code "Z!" [num nil end-of-line 1] 3))

(defun forward-to-word (num) "\
Move to next word-beginning, or to Nth following word-beginning." (interactive "p") (byte-code "T!!" [num nil forward-word -1] 3))

(defun backward-to-word (num) "\
Move back to word-end, or to Nth word-end seen." (interactive "p") (byte-code "T[!!" [num nil forward-word 1] 3))

(defun backward-line (num) "\
Move point to start of previous line.
Prefix argument serves as repeat-count." (interactive "p") (byte-code "[!" [num nil forward-line] 2))

(defun scroll-window-down (num) "\
Scroll the display down a window-full.
Accepts a prefix argument for the number of window-fulls to scroll." (interactive "p") (byte-code " \"Z!" [num nil scroll-down * window-height 2] 5))

(defun scroll-window-up (num) "\
Scroll the display up a window-full.
Accepts a prefix argument for the number of window-fulls to scroll." (interactive "p") (byte-code " \"Z!" [num nil scroll-up * window-height 2] 5))

(defun next-paragraph (num) "\
Move to beginning of the next indented paragraph.
Accepts a prefix argument for the number of paragraphs." (interactive "p") (byte-code "V#! !l!S" [num nil 0 next-line 1 forward-paragraph previous-line] 7))

(defun previous-paragraph (num) "\
Move to beginning of previous indented paragraph.
Accepts a prefix argument for the number of paragraphs." (interactive "p") (byte-code "V !l!S" [num nil 0 backward-paragraph previous-line 1 next-line] 6))

(defun move-to-beginning nil "\
Move cursor to the beginning of buffer, but don't set the mark." (interactive) (byte-code "eb" [nil] 1))

(defun move-to-end nil "\
Move cursor to the end of buffer, but don't set the mark." (interactive) (byte-code "db" [nil] 1))

(defun goto-percent (perc) "\
Move point to ARG percentage of the buffer." (interactive "NGoto-percentage: ") (byte-code "VW\"d\"\"b" [perc nil 100 0 error "Percentage %d out of range 0 < percent < 100" / *] 5))

(defun update-mode-line nil "\
Make sure mode-line in the current buffer reflects all changes." (byte-code " !!" [set-buffer-modified-p buffer-modified-p sit-for 0] 4))

(defun advance-direction nil "\
Set EDT Advance mode so keypad commands move forward." (interactive) (byte-code "ˆÉ	#	#	#	#	#	#	# " [edt-direction-string function-keymap nil " ADVANCE" define-key "" isearch-forward "8" scroll-window-up "7" next-paragraph "1" forward-to-word "2" next-end-of-line "3" forward-char "0" forward-line update-mode-line] 10))

(defun backup-direction nil "\
Set EDT Backup mode so keypad commands move backward." (interactive) (byte-code "ˆÉ	#	#	#	#	#	#	# " [edt-direction-string function-keymap nil " BACKUP" define-key "" isearch-backward "8" scroll-window-down "7" previous-paragraph "1" backward-to-word "2" previous-end-of-line "3" backward-char "0" backward-line update-mode-line] 10))

(defun beginning-of-window nil "\
Home cursor to top of window." (interactive) (byte-code "!" [nil move-to-window-line 0] 2))

(defun line-to-bottom-of-window nil "\
Move the current line to the top of the window." (interactive) (byte-code "!" [nil recenter -1] 2))

(defun line-to-top-of-window nil "\
Move the current line to the top of the window." (interactive) (byte-code "!" [nil recenter 0] 2))

(defun case-flip-character (num) "\
Change the case of the character under the cursor.
Accepts a prefix argument of the number of characters to invert." (interactive "p") (byte-code "V%gXł``T#!S" [num nil 0 funcall 97 upcase-region downcase-region forward-char 1] 5))

(defun indent-or-fill-region nil "\
Fill region in text modes, indent region in programming language modes." (interactive) (byte-code "\"` #` \"" [paragraph-start nil string= "^$\\|^" indent-region mark fill-region] 7))

(defun mark-section-wisely nil "\
Mark the section in a manner consistent with the major-mode.
Uses mark-defun for emacs-lisp, lisp,
mark-c-function for C,
and mark-paragraph for other modes." (interactive) (byte-code "ˆ=
 %= %=# % " [major-mode t nil emacs-lisp-mode mark-defun lisp-mode c-mode mark-c-function mark-paragraph] 5))

(defun edt-emulation-on nil "\
Begin emulating DEC's EDT editor.
Certain keys are rebound; including nearly all keypad keys.
Use \\[edt-emulation-off] to undo all rebindings except the keypad keys.
Note that this function does not work if called directly from the .emacs file.
Instead, the .emacs file should do (setq term-setup-hook 'edt-emulation-on)
Then this function will be called at the time when it will work." (interactive) (byte-code "Ȉ  	\"\"	\"\"\"#
#	\"\"#" [edt-mode-old-c-\\ global-map edt-mode-old-delete edt-mode-old-lisp-delete emacs-lisp-mode-map lisp-mode-map edt-mode-old-linefeed esc-map nil advance-direction edt-bind-gold-keypad lookup-key "" global-set-key quoted-insert "" delete-previous-char define-key "
" delete-previous-word "?" apropos] 15))

(defun edt-emulation-off nil "\
Return from EDT emulation to normal Emacs key bindings.
The keys redefined by \\[edt-emulation-on] are given their old definitions." (interactive) (byte-code "
\"\"
#
#\"" [edt-direction-string nil edt-mode-old-c-\\ edt-mode-old-delete emacs-lisp-mode-map edt-mode-old-lisp-delete lisp-mode-map edt-mode-old-linefeed global-set-key "" "" define-key "
"] 7))

(define-key function-keymap "u" (quote previous-line))

(define-key function-keymap "d" (quote next-line))

(define-key function-keymap "l" (quote backward-char))

(define-key function-keymap "r" (quote forward-char))

(define-key function-keymap "h" (quote beginning-of-window))

(define-key function-keymap "" (quote describe-key))

(define-key function-keymap "" (quote delete-current-line))

(define-key function-keymap "9" (quote append-to-buffer))

(define-key function-keymap "-" (quote delete-current-word))

(define-key function-keymap "4" (quote advance-direction))

(define-key function-keymap "5" (quote backup-direction))

(define-key function-keymap "6" (quote kill-region))

(define-key function-keymap "," (quote delete-current-char))

(define-key function-keymap "." (quote set-mark-command))

(define-key function-keymap "e" (quote other-window))

(define-key function-keymap "" (quote GOLD-prefix))

(setq GOLD-map (make-keymap))

(fset (quote GOLD-prefix) GOLD-map)

(defvar GOLD-map nil "\
GOLD-map maps the function keys on the VT100 keyboard preceeded
by the PF1 key.  GOLD is the ASCII the 7-bit escape sequence <ESC>OP.")

(defun define-keypad-key (keymap function-keymap-slot definition) (byte-code "	!

#)" [function-key-sequence function-keymap-slot keymap definition define-key] 5))

(define-key GOLD-map "" (quote keyboard-quit))

(define-key GOLD-map "" (quote delete-window))

(define-key GOLD-map "" (quote delete-other-windows))

(define-key GOLD-map "
" (quote newline-and-indent))

(define-key GOLD-map " " (quote undo))

(define-key GOLD-map "%" (quote goto-percent))

(define-key GOLD-map "=" (quote goto-line))

(define-key GOLD-map "`" (quote what-line))

(define-key GOLD-map "" (quote split-window-vertically))

(define-key GOLD-map "b" (quote buffer-menu))

(define-key GOLD-map "B" (quote buffer-menu))

(define-key GOLD-map "d" (quote delete-window))

(define-key GOLD-map "D" (quote delete-window))

(define-key GOLD-map "e" (quote compile))

(define-key GOLD-map "E" (quote compile))

(define-key GOLD-map "i" (quote insert-file))

(define-key GOLD-map "I" (quote insert-file))

(define-key GOLD-map "l" (quote goto-line))

(define-key GOLD-map "L" (quote goto-line))

(define-key GOLD-map "m" (quote save-some-buffers))

(define-key GOLD-map "M" (quote save-some-buffers))

(define-key GOLD-map "n" (quote next-error))

(define-key GOLD-map "N" (quote next-error))

(define-key GOLD-map "o" (quote switch-to-buffer-other-window))

(define-key GOLD-map "O" (quote switch-to-buffer-other-window))

(define-key GOLD-map "r" (quote revert-file))

(define-key GOLD-map "r" (quote revert-file))

(define-key GOLD-map "s" (quote save-buffer))

(define-key GOLD-map "S" (quote save-buffer))

(define-key GOLD-map "v" (quote find-file-other-window))

(define-key GOLD-map "V" (quote find-file-other-window))

(define-key GOLD-map "w" (quote write-file))

(define-key GOLD-map "w" (quote write-file))

(defun edt-bind-gold-keypad nil (byte-code "######################" [GOLD-map define-keypad-key 117 line-to-top-of-window 100 line-to-bottom-of-window 108 backward-sentence 114 forward-sentence 1 mark-section-wisely 2 describe-function 3 occur 4 undelete-lines 48 open-line 49 case-flip-character 50 delete-to-eol 51 copy-region-as-kill 52 move-to-end 53 move-to-beginning 54 yank 55 execute-extended-command 56 indent-or-fill-region 57 replace-regexp 45 undelete-words 44 undelete-chars 46 redraw-display 101 shell-command] 25))

(or (assq (quote edt-direction-string) minor-mode-alist) (setq minor-mode-alist (cons (quote (edt-direction-string edt-direction-string)) minor-mode-alist)))