aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorJim Blandy1992-08-04 04:15:43 +0000
committerJim Blandy1992-08-04 04:15:43 +0000
commite8a57935cbb4ccde7f621eeeca22141e5a5327b4 (patch)
treecb90c678fa9e79cf41c1b6a22d62b620aaf0e07f /lisp/emulation
parent0b030df78b499fde5f8dd3f20dd24a2e002fe4ee (diff)
downloademacs-e8a57935cbb4ccde7f621eeeca22141e5a5327b4.tar.gz
emacs-e8a57935cbb4ccde7f621eeeca22141e5a5327b4.zip
entered into RCS
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/edt.el114
1 files changed, 50 insertions, 64 deletions
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index 6b2603c8c5f..45c6047651b 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -117,8 +117,6 @@
117 117
118;;; Code: 118;;; Code:
119 119
120(require 'keypad)
121
122(defvar edt-last-deleted-lines "" 120(defvar edt-last-deleted-lines ""
123 "Last text deleted by an EDT emulation `line-delete' command.") 121 "Last text deleted by an EDT emulation `line-delete' command.")
124(defvar edt-last-deleted-words "" 122(defvar edt-last-deleted-words ""
@@ -292,26 +290,26 @@ Accepts a prefix argument for the number of paragraphs."
292 "Set EDT Advance mode so keypad commands move forward." 290 "Set EDT Advance mode so keypad commands move forward."
293 (interactive) 291 (interactive)
294 (setq edt-direction-string " ADVANCE") 292 (setq edt-direction-string " ADVANCE")
295 (define-key function-keymap "\C-c" 'isearch-forward) ; PF3 293 (global-set-key [kp-f1] 'isearch-forward)
296 (define-key function-keymap "8" 'scroll-window-up) ; "8" 294 (global-set-key [kp-8] 'scroll-window-up)
297 (define-key function-keymap "7" 'next-paragraph) ; "7" 295 (global-set-key [kp-7] 'next-paragraph)
298 (define-key function-keymap "1" 'forward-to-word) ; "1" 296 (global-set-key [kp-1] 'forward-to-word)
299 (define-key function-keymap "2" 'next-end-of-line) ; "2" 297 (global-set-key [kp-2] 'next-end-of-line)
300 (define-key function-keymap "3" 'forward-char) ; "3" 298 (global-set-key [kp-3] 'forward-char)
301 (define-key function-keymap "0" 'forward-line) ; "0" 299 (global-set-key [kp-0] 'forward-line)
302 (update-mode-line)) 300 (update-mode-line))
303 301
304(defun backup-direction () 302(defun backup-direction ()
305 "Set EDT Backup mode so keypad commands move backward." 303 "Set EDT Backup mode so keypad commands move backward."
306 (interactive) 304 (interactive)
307 (setq edt-direction-string " BACKUP") 305 (setq edt-direction-string " BACKUP")
308 (define-key function-keymap "\C-c" 'isearch-backward) ; PF3 306 (global-set-key [kp-f3] 'isearch-backward)
309 (define-key function-keymap "8" 'scroll-window-down) ; "8" 307 (global-set-key [kp-8] 'scroll-window-down)
310 (define-key function-keymap "7" 'previous-paragraph) ; "7" 308 (global-set-key [kp-7] 'previous-paragraph)
311 (define-key function-keymap "1" 'backward-to-word) ; "1" 309 (global-set-key [kp-1] 'backward-to-word)
312 (define-key function-keymap "2" 'previous-end-of-line) ; "2" 310 (global-set-key [kp-2] 'previous-end-of-line)
313 (define-key function-keymap "3" 'backward-char) ; "3" 311 (global-set-key [kp-3] 'backward-char)
314 (define-key function-keymap "0" 'backward-line) ; "0" 312 (global-set-key [kp-9] 'backward-line)
315 (update-mode-line)) 313 (update-mode-line))
316 314
317(defun edt-beginning-of-window () 315(defun edt-beginning-of-window ()
@@ -366,13 +364,10 @@ and mark-paragraph for other modes."
366(defun edt-emulation-on () 364(defun edt-emulation-on ()
367 "Emulate DEC's EDT editor. 365 "Emulate DEC's EDT editor.
368Note that many keys are rebound; including nearly all keypad keys. 366Note that many keys are rebound; including nearly all keypad keys.
369Use \\[edt-emulation-off] to undo all rebindings except the keypad keys. 367Use \\[edt-emulation-off] to undo all rebindings except the keypad keys."
370Note that this function does not work if called directly from the .emacs file.
371Instead, the .emacs file should do \"(setq term-setup-hook 'edt-emulation-on)\"
372Then this function will be called at the time when it will work."
373 (interactive) 368 (interactive)
374 (advance-direction) 369 (advance-direction)
375 (edt-bind-gold-keypad) ;Must do this *after* $TERM.el is loaded 370 (edt-bind-gold-keypad)
376 (setq edt-mode-old-c-\\ (lookup-key global-map "\C-\\")) 371 (setq edt-mode-old-c-\\ (lookup-key global-map "\C-\\"))
377 (global-set-key "\C-\\" 'quoted-insert) 372 (global-set-key "\C-\\" 'quoted-insert)
378 (setq edt-mode-old-delete (lookup-key global-map "\177")) 373 (setq edt-mode-old-delete (lookup-key global-map "\177"))
@@ -395,33 +390,24 @@ The keys redefined by \\[edt-emulation-on] are given their old definitions."
395 (define-key lisp-mode-map "\177" edt-mode-old-lisp-delete) ;"Delete" 390 (define-key lisp-mode-map "\177" edt-mode-old-lisp-delete) ;"Delete"
396 (global-set-key "\C-j" edt-mode-old-linefeed)) ;"LineFeed" 391 (global-set-key "\C-j" edt-mode-old-linefeed)) ;"LineFeed"
397 392
398(define-key function-keymap "u" 'previous-line) ;Up arrow
399(define-key function-keymap "d" 'next-line) ;down arrow
400(define-key function-keymap "l" 'backward-char) ;right arrow
401(define-key function-keymap "r" 'forward-char) ;left arrow
402(define-key function-keymap "h" 'edt-beginning-of-window) ;home
403(define-key function-keymap "\C-b" 'describe-key) ;PF2
404(define-key function-keymap "\C-d" 'delete-current-line);PF4
405(define-key function-keymap "9" 'append-to-buffer) ;9 keypad key, etc.
406(define-key function-keymap "-" 'delete-current-word)
407(define-key function-keymap "4" 'advance-direction)
408(define-key function-keymap "5" 'backup-direction)
409(define-key function-keymap "6" 'kill-region)
410(define-key function-keymap "," 'delete-current-char)
411(define-key function-keymap "." 'set-mark-command)
412(define-key function-keymap "e" 'other-window) ;enter key
413(define-key function-keymap "\C-a" 'GOLD-prefix) ;PF1 ("gold")
414
415(fset 'GOLD-prefix GOLD-map) 393(fset 'GOLD-prefix GOLD-map)
416 394
417(defvar GOLD-map (make-keymap) 395(defvar GOLD-map (make-keymap)
418 "`GOLD-map' maps the function keys on the VT100 keyboard preceeded 396 "`GOLD-map' maps the function keys on the VT100 keyboard preceeded
419by the PF1 key. GOLD is the ASCII the 7-bit escape sequence <ESC>OP.") 397by the PF1 key. GOLD is the ASCII the 7-bit escape sequence <ESC>OP.")
420 398
421(defun define-keypad-key (keymap function-keymap-slot definition) 399(global-set-key [home] 'edt-beginning-of-window)
422 (let ((function-key-sequence (function-key-sequence function-keymap-slot))) 400(global-set-key [kp-f2] 'describe-key)
423 (if function-key-sequence 401(global-set-key [kp-f4] 'delete-current-line)
424 (define-key keymap function-key-sequence definition)))) 402(global-set-key [kp-9] 'append-to-buffer)
403(global-set-key [kp-subtract] 'delete-current-word)
404(global-set-key [kp-4] 'advance-direction)
405(global-set-key [kp-5] 'backup-direction)
406(global-set-key [kp-6] 'kill-region)
407(global-set-key [kp-separator] 'delete-current-char)
408(global-set-key [kp-decimal] 'set-mark-command)
409(global-set-key [kp-enter] 'other-window)
410(global-set-key [kp-f1] 'GOLD-prefix)
425 411
426;;Bind GOLD/Keyboard keys 412;;Bind GOLD/Keyboard keys
427 413
@@ -465,28 +451,28 @@ by the PF1 key. GOLD is the ASCII the 7-bit escape sequence <ESC>OP.")
465 451
466;Bind GOLD/Keypad keys 452;Bind GOLD/Keypad keys
467(defun edt-bind-gold-keypad () 453(defun edt-bind-gold-keypad ()
468 (define-keypad-key GOLD-map ?u 'edt-line-to-top-of-window) ;"up-arrow" 454 (define-key GOLD-map [up] 'edt-line-to-top-of-window)
469 (define-keypad-key GOLD-map ?d 'edt-line-to-bottom-of-window) ;"down-arrow" 455 (define-key GOLD-map [down] 'edt-line-to-bottom-of-window)
470 (define-keypad-key GOLD-map ?l 'backward-sentence) ;"left-arrow" 456 (define-key GOLD-map [left] 'backward-sentence)
471 (define-keypad-key GOLD-map ?r 'forward-sentence) ;"right-arrow" 457 (define-key GOLD-map [right] 'forward-sentence)
472 (define-keypad-key GOLD-map ?\C-a 'mark-section-wisely) ;Gold "PF1" 458 (define-key GOLD-map [kp-f1] 'mark-section-wisely)
473 (define-keypad-key GOLD-map ?\C-b 'describe-function) ;Help "PF2" 459 (define-key GOLD-map [kp-f2] 'describe-function)
474 (define-keypad-key GOLD-map ?\C-c 'occur) ;Find "PF3" 460 (define-key GOLD-map [kp-f3] 'occur)
475 (define-keypad-key GOLD-map ?\C-d 'undelete-lines) ;Und Line "PF4" 461 (define-key GOLD-map [kp-f4] 'undelete-lines)
476 (define-keypad-key GOLD-map ?0 'open-line) ;Open L "0" 462 (define-key GOLD-map [kp-0] 'open-line)
477 (define-keypad-key GOLD-map ?1 'case-flip-character) ;Chgcase "1" 463 (define-key GOLD-map [kp-1] 'case-flip-character)
478 (define-keypad-key GOLD-map ?2 'delete-to-eol) ;Del EOL "2" 464 (define-key GOLD-map [kp-2] 'delete-to-eol)
479 (define-keypad-key GOLD-map ?3 'copy-region-as-kill) ;Copy "3" 465 (define-key GOLD-map [kp-3] 'copy-region-as-kill)
480 (define-keypad-key GOLD-map ?4 'move-to-end) ;Bottom "4" 466 (define-key GOLD-map [kp-4] 'move-to-end)
481 (define-keypad-key GOLD-map ?5 'move-to-beginning) ;Top "5" 467 (define-key GOLD-map [kp-5] 'move-to-beginning)
482 (define-keypad-key GOLD-map ?6 'yank) ;Paste "6" 468 (define-key GOLD-map [kp-6] 'yank)
483 (define-keypad-key GOLD-map ?7 'execute-extended-command) ;Command "7" 469 (define-key GOLD-map [kp-7] 'execute-extended-command)
484 (define-keypad-key GOLD-map ?8 'indent-or-fill-region) ;Fill "8" 470 (define-key GOLD-map [kp-8] 'indent-or-fill-region)
485 (define-keypad-key GOLD-map ?9 'replace-regexp) ;Replace "9" 471 (define-key GOLD-map [kp-9] 'replace-regexp)
486 (define-keypad-key GOLD-map ?- 'undelete-words) ;UND word "-" 472 (define-key GOLD-map [kp-subtract] 'undelete-words)
487 (define-keypad-key GOLD-map ?, 'undelete-chars) ;UND Char "," 473 (define-key GOLD-map [kp-separator] 'undelete-chars)
488 (define-keypad-key GOLD-map ?. 'redraw-display) ;Reset Window "." 474 (define-key GOLD-map [kp-decimal] 'redraw-display)
489 (define-keypad-key GOLD-map ?e 'shell-command)) ;"ENTER" 475 (define-key GOLD-map [kp-enter] 'shell-command))
490 476
491;; Make direction of motion show in mode line 477;; Make direction of motion show in mode line
492;; while EDT emulation is turned on. 478;; while EDT emulation is turned on.