diff options
| author | Stefan Monnier | 2005-07-07 04:59:32 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-07-07 04:59:32 +0000 |
| commit | a5717394ea6fbd7ea179c362646f4495f88245cb (patch) | |
| tree | 69531624d93799d412ba1ede01a05a9544a5c26b | |
| parent | 67bb20fadb44b7022c706fc1b6146b85bcbaf072 (diff) | |
| download | emacs-a5717394ea6fbd7ea179c362646f4495f88245cb.tar.gz emacs-a5717394ea6fbd7ea179c362646f4495f88245cb.zip | |
(CSI-map, SS3-map, GOLD-map, GOLD-CSI-map)
(GOLD-SS3-map): Initialize in declaration.
(tpu-set-mode-line): Don't throw away other minor mode strings when
turning off the mode.
(tpu-set-match, tpu-match-beginning, tpu-check-match)
(tpu-show-match-markers): Use the insertion-type rather than the +1
offset kludge for tpu-match-beginning-mark.
(tpu-edt-mode): Use define-minor-mode.
(minibuffer-local-must-match-map, minibuffer-local-map): Try to avoid
using the escape sequence and use the real key name instead.
(tpu-reset-control-keys): Don't copy a keymap needlessly.
(tpu-arrow-history): Simplify.
(tpu-edt-on): Set control keys after changing the global map.
(tpu-edt-on, tpu-edt-off): Work unconditionally.
| -rw-r--r-- | lisp/emulation/tpu-edt.el | 715 |
1 files changed, 345 insertions, 370 deletions
diff --git a/lisp/emulation/tpu-edt.el b/lisp/emulation/tpu-edt.el index a9a690648fc..3c18e2f608f 100644 --- a/lisp/emulation/tpu-edt.el +++ b/lisp/emulation/tpu-edt.el | |||
| @@ -265,8 +265,16 @@ | |||
| 265 | ;; than the emulated TPU commands. Also, it works only in the forward | 265 | ;; than the emulated TPU commands. Also, it works only in the forward |
| 266 | ;; direction, regardless of the current TPU-edt direction. | 266 | ;; direction, regardless of the current TPU-edt direction. |
| 267 | 267 | ||
| 268 | ;;; Todo/Bugs: | ||
| 269 | |||
| 270 | ;; We shouldn't use vt100 ESC sequences since it is uselessly fighting | ||
| 271 | ;; against function-key-map. Better use real key names. | ||
| 272 | |||
| 268 | ;;; Code: | 273 | ;;; Code: |
| 269 | 274 | ||
| 275 | ;; we use picture-mode functions | ||
| 276 | (require 'picture) | ||
| 277 | |||
| 270 | (defgroup tpu nil | 278 | (defgroup tpu nil |
| 271 | "Emacs emulating TPU emulating EDT." | 279 | "Emacs emulating TPU emulating EDT." |
| 272 | :prefix "tpu-" | 280 | :prefix "tpu-" |
| @@ -316,29 +324,270 @@ | |||
| 316 | ;;; | 324 | ;;; |
| 317 | ;;; Global Keymaps | 325 | ;;; Global Keymaps |
| 318 | ;;; | 326 | ;;; |
| 319 | (defvar CSI-map (make-sparse-keymap) | 327 | (defvar CSI-map |
| 328 | (let ((map (make-sparse-keymap))) | ||
| 329 | (define-key map "A" 'tpu-previous-line) ; up | ||
| 330 | (define-key map "B" 'tpu-next-line) ; down | ||
| 331 | (define-key map "D" 'tpu-backward-char) ; left | ||
| 332 | (define-key map "C" 'tpu-forward-char) ; right | ||
| 333 | |||
| 334 | (define-key map "1~" 'tpu-search) ; Find | ||
| 335 | (define-key map "2~" 'tpu-paste) ; Insert Here | ||
| 336 | (define-key map "3~" 'tpu-cut) ; Remove | ||
| 337 | (define-key map "4~" 'tpu-select) ; Select | ||
| 338 | (define-key map "5~" 'tpu-scroll-window-down) ; Prev Screen | ||
| 339 | (define-key map "6~" 'tpu-scroll-window-up) ; Next Screen | ||
| 340 | |||
| 341 | (define-key map "11~" 'nil) ; F1 | ||
| 342 | (define-key map "12~" 'nil) ; F2 | ||
| 343 | (define-key map "13~" 'nil) ; F3 | ||
| 344 | (define-key map "14~" 'nil) ; F4 | ||
| 345 | (define-key map "15~" 'nil) ; F5 | ||
| 346 | (define-key map "17~" 'nil) ; F6 | ||
| 347 | (define-key map "18~" 'nil) ; F7 | ||
| 348 | (define-key map "19~" 'nil) ; F8 | ||
| 349 | (define-key map "20~" 'nil) ; F9 | ||
| 350 | (define-key map "21~" 'tpu-exit) ; F10 | ||
| 351 | (define-key map "23~" 'tpu-insert-escape) ; F11 (ESC) | ||
| 352 | (define-key map "24~" 'tpu-next-beginning-of-line) ; F12 (BS) | ||
| 353 | (define-key map "25~" 'tpu-delete-previous-word) ; F13 (LF) | ||
| 354 | (define-key map "26~" 'tpu-toggle-overwrite-mode) ; F14 | ||
| 355 | (define-key map "28~" 'tpu-help) ; HELP | ||
| 356 | (define-key map "29~" 'execute-extended-command) ; DO | ||
| 357 | (define-key map "31~" 'tpu-goto-breadcrumb) ; F17 | ||
| 358 | (define-key map "32~" 'nil) ; F18 | ||
| 359 | (define-key map "33~" 'nil) ; F19 | ||
| 360 | (define-key map "34~" 'nil) ; F20 | ||
| 361 | map) | ||
| 320 | "Maps the CSI function keys on the VT100 keyboard. | 362 | "Maps the CSI function keys on the VT100 keyboard. |
| 321 | CSI is DEC's name for the sequence <ESC>[.") | 363 | CSI is DEC's name for the sequence <ESC>[.") |
| 322 | 364 | ||
| 323 | (defvar SS3-map (make-sparse-keymap) | 365 | (defvar GOLD-CSI-map |
| 324 | "Maps the SS3 function keys on the VT100 keyboard. | 366 | (let ((map (make-sparse-keymap))) |
| 325 | SS3 is DEC's name for the sequence <ESC>O.") | 367 | (define-key map "A" 'tpu-move-to-beginning) ; up-arrow |
| 368 | (define-key map "B" 'tpu-move-to-end) ; down-arrow | ||
| 369 | (define-key map "C" 'end-of-line) ; right-arrow | ||
| 370 | (define-key map "D" 'beginning-of-line) ; left-arrow | ||
| 371 | |||
| 372 | (define-key map "1~" 'nil) ; Find | ||
| 373 | (define-key map "2~" 'nil) ; Insert Here | ||
| 374 | (define-key map "3~" 'tpu-store-text) ; Remove | ||
| 375 | (define-key map "4~" 'tpu-unselect) ; Select | ||
| 376 | (define-key map "5~" 'tpu-previous-window) ; Prev Screen | ||
| 377 | (define-key map "6~" 'tpu-next-window) ; Next Screen | ||
| 378 | |||
| 379 | (define-key map "11~" 'nil) ; F1 | ||
| 380 | (define-key map "12~" 'nil) ; F2 | ||
| 381 | (define-key map "13~" 'nil) ; F3 | ||
| 382 | (define-key map "14~" 'nil) ; F4 | ||
| 383 | (define-key map "16~" 'nil) ; F5 | ||
| 384 | (define-key map "17~" 'nil) ; F6 | ||
| 385 | (define-key map "18~" 'nil) ; F7 | ||
| 386 | (define-key map "19~" 'nil) ; F8 | ||
| 387 | (define-key map "20~" 'nil) ; F9 | ||
| 388 | (define-key map "21~" 'nil) ; F10 | ||
| 389 | (define-key map "23~" 'nil) ; F11 | ||
| 390 | (define-key map "24~" 'nil) ; F12 | ||
| 391 | (define-key map "25~" 'nil) ; F13 | ||
| 392 | (define-key map "26~" 'nil) ; F14 | ||
| 393 | (define-key map "28~" 'describe-bindings) ; HELP | ||
| 394 | (define-key map "29~" 'nil) ; DO | ||
| 395 | (define-key map "31~" 'tpu-drop-breadcrumb) ; F17 | ||
| 396 | (define-key map "32~" 'nil) ; F18 | ||
| 397 | (define-key map "33~" 'nil) ; F19 | ||
| 398 | (define-key map "34~" 'nil) ; F20 | ||
| 399 | map) | ||
| 400 | "Maps the function keys on the VT100 keyboard preceded by GOLD-CSI.") | ||
| 401 | |||
| 402 | (defvar GOLD-SS3-map | ||
| 403 | (let ((map (make-sparse-keymap))) | ||
| 404 | (define-key map "A" 'tpu-move-to-beginning) ; up-arrow | ||
| 405 | (define-key map "B" 'tpu-move-to-end) ; down-arrow | ||
| 406 | (define-key map "C" 'end-of-line) ; right-arrow | ||
| 407 | (define-key map "D" 'beginning-of-line) ; left-arrow | ||
| 408 | |||
| 409 | (define-key map "P" 'keyboard-quit) ; PF1 | ||
| 410 | (define-key map "Q" 'help-for-help) ; PF2 | ||
| 411 | (define-key map "R" 'tpu-search) ; PF3 | ||
| 412 | (define-key map "S" 'tpu-undelete-lines) ; PF4 | ||
| 413 | (define-key map "p" 'open-line) ; KP0 | ||
| 414 | (define-key map "q" 'tpu-change-case) ; KP1 | ||
| 415 | (define-key map "r" 'tpu-delete-to-eol) ; KP2 | ||
| 416 | (define-key map "s" 'tpu-special-insert) ; KP3 | ||
| 417 | (define-key map "t" 'tpu-move-to-end) ; KP4 | ||
| 418 | (define-key map "u" 'tpu-move-to-beginning) ; KP5 | ||
| 419 | (define-key map "v" 'tpu-paste) ; KP6 | ||
| 420 | (define-key map "w" 'execute-extended-command) ; KP7 | ||
| 421 | (define-key map "x" 'tpu-fill) ; KP8 | ||
| 422 | (define-key map "y" 'tpu-replace) ; KP9 | ||
| 423 | (define-key map "m" 'tpu-undelete-words) ; KP- | ||
| 424 | (define-key map "l" 'tpu-undelete-char) ; KP, | ||
| 425 | (define-key map "n" 'tpu-unselect) ; KP. | ||
| 426 | (define-key map "M" 'tpu-substitute) ; KPenter | ||
| 427 | map) | ||
| 428 | "Maps the function keys on the VT100 keyboard preceded by GOLD-SS3.") | ||
| 326 | 429 | ||
| 327 | (defvar GOLD-map (make-keymap) | 430 | (defvar GOLD-map |
| 431 | (let ((map (make-keymap))) | ||
| 432 | (define-key map "\e[" GOLD-CSI-map) ; GOLD-CSI map | ||
| 433 | (define-key map "\eO" GOLD-SS3-map) ; GOLD-SS3 map | ||
| 434 | ;; | ||
| 435 | (define-key map "\C-A" 'tpu-toggle-overwrite-mode) ; ^A | ||
| 436 | (define-key map "\C-B" 'nil) ; ^B | ||
| 437 | (define-key map "\C-C" 'nil) ; ^C | ||
| 438 | (define-key map "\C-D" 'nil) ; ^D | ||
| 439 | (define-key map "\C-E" 'nil) ; ^E | ||
| 440 | (define-key map "\C-F" 'set-visited-file-name) ; ^F | ||
| 441 | (define-key map "\C-g" 'keyboard-quit) ; safety first | ||
| 442 | (define-key map "\C-h" 'delete-other-windows) ; BS | ||
| 443 | (define-key map "\C-i" 'other-window) ; TAB | ||
| 444 | (define-key map "\C-J" 'nil) ; ^J | ||
| 445 | (define-key map "\C-K" 'tpu-define-macro-key) ; ^K | ||
| 446 | (define-key map "\C-l" 'downcase-region) ; ^L | ||
| 447 | (define-key map "\C-M" 'nil) ; ^M | ||
| 448 | (define-key map "\C-N" 'nil) ; ^N | ||
| 449 | (define-key map "\C-O" 'nil) ; ^O | ||
| 450 | (define-key map "\C-P" 'nil) ; ^P | ||
| 451 | (define-key map "\C-Q" 'nil) ; ^Q | ||
| 452 | (define-key map "\C-R" 'nil) ; ^R | ||
| 453 | (define-key map "\C-S" 'nil) ; ^S | ||
| 454 | (define-key map "\C-T" 'tpu-toggle-control-keys) ; ^T | ||
| 455 | (define-key map "\C-u" 'upcase-region) ; ^U | ||
| 456 | (define-key map "\C-V" 'nil) ; ^V | ||
| 457 | (define-key map "\C-w" 'tpu-write-current-buffers) ; ^W | ||
| 458 | (define-key map "\C-X" 'nil) ; ^X | ||
| 459 | (define-key map "\C-Y" 'nil) ; ^Y | ||
| 460 | (define-key map "\C-Z" 'nil) ; ^Z | ||
| 461 | (define-key map " " 'undo) ; SPC | ||
| 462 | (define-key map "!" 'nil) ; ! | ||
| 463 | (define-key map "#" 'nil) ; # | ||
| 464 | (define-key map "$" 'tpu-add-at-eol) ; $ | ||
| 465 | (define-key map "%" 'tpu-goto-percent) ; % | ||
| 466 | (define-key map "&" 'nil) ; & | ||
| 467 | (define-key map "(" 'nil) ; ( | ||
| 468 | (define-key map ")" 'nil) ; ) | ||
| 469 | (define-key map "*" 'tpu-toggle-regexp) ; * | ||
| 470 | (define-key map "+" 'nil) ; + | ||
| 471 | (define-key map "," 'tpu-goto-breadcrumb) ; , | ||
| 472 | (define-key map "-" 'negative-argument) ; - | ||
| 473 | (define-key map "." 'tpu-drop-breadcrumb) ; . | ||
| 474 | (define-key map "/" 'tpu-emacs-replace) ; / | ||
| 475 | (define-key map "0" 'digit-argument) ; 0 | ||
| 476 | (define-key map "1" 'digit-argument) ; 1 | ||
| 477 | (define-key map "2" 'digit-argument) ; 2 | ||
| 478 | (define-key map "3" 'digit-argument) ; 3 | ||
| 479 | (define-key map "4" 'digit-argument) ; 4 | ||
| 480 | (define-key map "5" 'digit-argument) ; 5 | ||
| 481 | (define-key map "6" 'digit-argument) ; 6 | ||
| 482 | (define-key map "7" 'digit-argument) ; 7 | ||
| 483 | (define-key map "8" 'digit-argument) ; 8 | ||
| 484 | (define-key map "9" 'digit-argument) ; 9 | ||
| 485 | (define-key map ":" 'nil) ; : | ||
| 486 | (define-key map ";" 'tpu-trim-line-ends) ; ; | ||
| 487 | (define-key map "<" 'nil) ; < | ||
| 488 | (define-key map "=" 'nil) ; = | ||
| 489 | (define-key map ">" 'nil) ; > | ||
| 490 | (define-key map "?" 'tpu-spell-check) ; ? | ||
| 491 | (define-key map "A" 'tpu-toggle-newline-and-indent) ; A | ||
| 492 | (define-key map "B" 'tpu-next-buffer) ; B | ||
| 493 | (define-key map "C" 'repeat-complex-command) ; C | ||
| 494 | (define-key map "D" 'shell-command) ; D | ||
| 495 | (define-key map "E" 'tpu-exit) ; E | ||
| 496 | (define-key map "F" 'tpu-set-cursor-free) ; F | ||
| 497 | (define-key map "G" 'tpu-get) ; G | ||
| 498 | (define-key map "H" 'nil) ; H | ||
| 499 | (define-key map "I" 'tpu-include) ; I | ||
| 500 | (define-key map "K" 'tpu-kill-buffer) ; K | ||
| 501 | (define-key map "L" 'tpu-what-line) ; L | ||
| 502 | (define-key map "M" 'buffer-menu) ; M | ||
| 503 | (define-key map "N" 'tpu-next-file-buffer) ; N | ||
| 504 | (define-key map "O" 'occur) ; O | ||
| 505 | (define-key map "P" 'lpr-buffer) ; P | ||
| 506 | (define-key map "Q" 'tpu-quit) ; Q | ||
| 507 | (define-key map "R" 'tpu-toggle-rectangle) ; R | ||
| 508 | (define-key map "S" 'replace) ; S | ||
| 509 | (define-key map "T" 'tpu-line-to-top-of-window) ; T | ||
| 510 | (define-key map "U" 'undo) ; U | ||
| 511 | (define-key map "V" 'tpu-version) ; V | ||
| 512 | (define-key map "W" 'save-buffer) ; W | ||
| 513 | (define-key map "X" 'tpu-save-all-buffers-kill-emacs) ; X | ||
| 514 | (define-key map "Y" 'copy-region-as-kill) ; Y | ||
| 515 | (define-key map "Z" 'suspend-emacs) ; Z | ||
| 516 | (define-key map "[" 'blink-matching-open) ; [ | ||
| 517 | (define-key map "\\" 'nil) ; \ | ||
| 518 | (define-key map "]" 'blink-matching-open) ; ] | ||
| 519 | (define-key map "^" 'tpu-add-at-bol) ; ^ | ||
| 520 | (define-key map "_" 'split-window-vertically) ; - | ||
| 521 | (define-key map "`" 'what-line) ; ` | ||
| 522 | (define-key map "a" 'tpu-toggle-newline-and-indent) ; a | ||
| 523 | (define-key map "b" 'tpu-next-buffer) ; b | ||
| 524 | (define-key map "c" 'repeat-complex-command) ; c | ||
| 525 | (define-key map "d" 'shell-command) ; d | ||
| 526 | (define-key map "e" 'tpu-exit) ; e | ||
| 527 | (define-key map "f" 'tpu-set-cursor-free) ; f | ||
| 528 | (define-key map "g" 'tpu-get) ; g | ||
| 529 | (define-key map "h" 'nil) ; h | ||
| 530 | (define-key map "i" 'tpu-include) ; i | ||
| 531 | (define-key map "k" 'tpu-kill-buffer) ; k | ||
| 532 | (define-key map "l" 'goto-line) ; l | ||
| 533 | (define-key map "m" 'buffer-menu) ; m | ||
| 534 | (define-key map "n" 'tpu-next-file-buffer) ; n | ||
| 535 | (define-key map "o" 'occur) ; o | ||
| 536 | (define-key map "p" 'lpr-region) ; p | ||
| 537 | (define-key map "q" 'tpu-quit) ; q | ||
| 538 | (define-key map "r" 'tpu-toggle-rectangle) ; r | ||
| 539 | (define-key map "s" 'replace) ; s | ||
| 540 | (define-key map "t" 'tpu-line-to-top-of-window) ; t | ||
| 541 | (define-key map "u" 'undo) ; u | ||
| 542 | (define-key map "v" 'tpu-version) ; v | ||
| 543 | (define-key map "w" 'save-buffer) ; w | ||
| 544 | (define-key map "x" 'tpu-save-all-buffers-kill-emacs) ; x | ||
| 545 | (define-key map "y" 'copy-region-as-kill) ; y | ||
| 546 | (define-key map "z" 'suspend-emacs) ; z | ||
| 547 | (define-key map "{" 'nil) ; { | ||
| 548 | (define-key map "|" 'split-window-horizontally) ; | | ||
| 549 | (define-key map "}" 'nil) ; } | ||
| 550 | (define-key map "~" 'exchange-point-and-mark) ; ~ | ||
| 551 | (define-key map "\177" 'delete-window) ; <X] | ||
| 552 | map) | ||
| 328 | "Maps the function keys on the VT100 keyboard preceded by PF1. | 553 | "Maps the function keys on the VT100 keyboard preceded by PF1. |
| 329 | GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | 554 | GOLD is the ASCII 7-bit escape sequence <ESC>OP.") |
| 330 | 555 | ||
| 331 | (defvar GOLD-CSI-map (make-sparse-keymap) | 556 | (defvar SS3-map |
| 332 | "Maps the function keys on the VT100 keyboard preceded by GOLD-CSI.") | 557 | (let ((map (make-sparse-keymap))) |
| 333 | 558 | (define-key map "P" GOLD-map) ; GOLD map | |
| 334 | (defvar GOLD-SS3-map (make-sparse-keymap) | 559 | ;; |
| 335 | "Maps the function keys on the VT100 keyboard preceded by GOLD-SS3.") | 560 | (define-key map "A" 'tpu-previous-line) ; up |
| 561 | (define-key map "B" 'tpu-next-line) ; down | ||
| 562 | (define-key map "C" 'tpu-forward-char) ; right | ||
| 563 | (define-key map "D" 'tpu-backward-char) ; left | ||
| 564 | |||
| 565 | (define-key map "Q" 'tpu-help) ; PF2 | ||
| 566 | (define-key map "R" 'tpu-search-again) ; PF3 | ||
| 567 | (define-key map "S" 'tpu-delete-current-line) ; PF4 | ||
| 568 | (define-key map "p" 'tpu-line) ; KP0 | ||
| 569 | (define-key map "q" 'tpu-word) ; KP1 | ||
| 570 | (define-key map "r" 'tpu-end-of-line) ; KP2 | ||
| 571 | (define-key map "s" 'tpu-char) ; KP3 | ||
| 572 | (define-key map "t" 'tpu-advance-direction) ; KP4 | ||
| 573 | (define-key map "u" 'tpu-backup-direction) ; KP5 | ||
| 574 | (define-key map "v" 'tpu-cut) ; KP6 | ||
| 575 | (define-key map "w" 'tpu-page) ; KP7 | ||
| 576 | (define-key map "x" 'tpu-scroll-window) ; KP8 | ||
| 577 | (define-key map "y" 'tpu-append-region) ; KP9 | ||
| 578 | (define-key map "m" 'tpu-delete-current-word) ; KP- | ||
| 579 | (define-key map "l" 'tpu-delete-current-char) ; KP, | ||
| 580 | (define-key map "n" 'tpu-select) ; KP. | ||
| 581 | (define-key map "M" 'newline) ; KPenter | ||
| 582 | map) | ||
| 583 | "Maps the SS3 function keys on the VT100 keyboard. | ||
| 584 | SS3 is DEC's name for the sequence <ESC>O.") | ||
| 336 | 585 | ||
| 337 | (defvar tpu-global-map nil "TPU-edt global keymap.") | 586 | (defvar tpu-global-map nil "TPU-edt global keymap.") |
| 338 | (defvar tpu-original-global-map global-map | 587 | (defvar tpu-original-global-map global-map |
| 339 | "Original global keymap.") | 588 | "Original non-TPU global keymap.") |
| 340 | 589 | ||
| 341 | (and tpu-lucid-emacs-p | 590 | (and (not (boundp 'minibuffer-local-ns-map)) |
| 342 | (defvar minibuffer-local-ns-map (make-sparse-keymap) | 591 | (defvar minibuffer-local-ns-map (make-sparse-keymap) |
| 343 | "Hack to give Lucid Emacs the same maps as ordinary Emacs.")) | 592 | "Hack to give Lucid Emacs the same maps as ordinary Emacs.")) |
| 344 | 593 | ||
| @@ -346,9 +595,6 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 346 | ;;; | 595 | ;;; |
| 347 | ;;; Global Variables | 596 | ;;; Global Variables |
| 348 | ;;; | 597 | ;;; |
| 349 | (defvar tpu-edt-mode nil | ||
| 350 | "If non-nil, TPU-edt mode is active.") | ||
| 351 | |||
| 352 | (defvar tpu-last-replaced-text "" | 598 | (defvar tpu-last-replaced-text "" |
| 353 | "Last text deleted by a TPU-edt replace command.") | 599 | "Last text deleted by a TPU-edt replace command.") |
| 354 | (defvar tpu-last-deleted-region "" | 600 | (defvar tpu-last-deleted-region "" |
| @@ -433,26 +679,14 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 433 | 679 | ||
| 434 | (defun tpu-set-mode-line (for-tpu) | 680 | (defun tpu-set-mode-line (for-tpu) |
| 435 | "Set ``minor-mode-alist'' for TPU-edt, or reset it to default Emacs." | 681 | "Set ``minor-mode-alist'' for TPU-edt, or reset it to default Emacs." |
| 436 | (cond ((not for-tpu) | 682 | (let ((entries '((tpu-newline-and-indent-p tpu-newline-and-indent-string) |
| 437 | (setq minor-mode-alist tpu-original-mm-alist)) | 683 | (tpu-rectangular-p tpu-rectangle-string) |
| 438 | (t | 684 | (tpu-direction-string tpu-direction-string) |
| 439 | (or (assq 'tpu-newline-and-indent-p minor-mode-alist) | 685 | (tpu-mark-flag tpu-mark-flag)))) |
| 440 | (setq minor-mode-alist | 686 | (dolist (entry entries) |
| 441 | (cons '(tpu-newline-and-indent-p | 687 | (if for-tpu |
| 442 | tpu-newline-and-indent-string) | 688 | (add-to-list 'minor-mode-alist entry) |
| 443 | minor-mode-alist))) | 689 | (setq minor-mode-alist (remove entry minor-mode-alist)))))) |
| 444 | (or (assq 'tpu-rectangular-p minor-mode-alist) | ||
| 445 | (setq minor-mode-alist | ||
| 446 | (cons '(tpu-rectangular-p tpu-rectangle-string) | ||
| 447 | minor-mode-alist))) | ||
| 448 | (or (assq 'tpu-direction-string minor-mode-alist) | ||
| 449 | (setq minor-mode-alist | ||
| 450 | (cons '(tpu-direction-string tpu-direction-string) | ||
| 451 | minor-mode-alist))) | ||
| 452 | (or (assq 'tpu-mark-flag minor-mode-alist) | ||
| 453 | (setq minor-mode-alist | ||
| 454 | (cons '(tpu-mark-flag tpu-mark-flag) | ||
| 455 | minor-mode-alist)))))) | ||
| 456 | 690 | ||
| 457 | (defun tpu-update-mode-line nil | 691 | (defun tpu-update-mode-line nil |
| 458 | "Make sure mode-line in the current buffer reflects all changes." | 692 | "Make sure mode-line in the current buffer reflects all changes." |
| @@ -482,7 +716,7 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 482 | "Set markers at match beginning and end." | 716 | "Set markers at match beginning and end." |
| 483 | ;; Add one to beginning mark so it stays with the first character of | 717 | ;; Add one to beginning mark so it stays with the first character of |
| 484 | ;; the string even if characters are added just before the string. | 718 | ;; the string even if characters are added just before the string. |
| 485 | (setq tpu-match-beginning-mark (copy-marker (1+ (match-beginning 0)))) | 719 | (setq tpu-match-beginning-mark (copy-marker (match-beginning 0) t)) |
| 486 | (setq tpu-match-end-mark (copy-marker (match-end 0)))) | 720 | (setq tpu-match-end-mark (copy-marker (match-end 0)))) |
| 487 | 721 | ||
| 488 | (defun tpu-unset-match nil | 722 | (defun tpu-unset-match nil |
| @@ -492,7 +726,7 @@ GOLD is the ASCII 7-bit escape sequence <ESC>OP.") | |||
| 492 | 726 | ||
| 493 | (defun tpu-match-beginning nil | 727 | (defun tpu-match-beginning nil |
| 494 | "Returns the location of the last match beginning." | 728 | "Returns the location of the last match beginning." |
| 495 | (1- (marker-position tpu-match-beginning-mark))) | 729 | (marker-position tpu-match-beginning-mark)) |
| 496 | 730 | ||
| 497 | (defun tpu-match-end nil | 731 | (defun tpu-match-end nil |
| 498 | "Returns the location of the last match end." | 732 | "Returns the location of the last match end." |
| @@ -508,10 +742,10 @@ Otherwise sets the tpu-match markers to nil and returns nil." | |||
| 508 | ;; beginning, end, and point are equal. | 742 | ;; beginning, end, and point are equal. |
| 509 | (cond ((and | 743 | (cond ((and |
| 510 | (equal (marker-buffer tpu-match-beginning-mark) (current-buffer)) | 744 | (equal (marker-buffer tpu-match-beginning-mark) (current-buffer)) |
| 511 | (>= (point) (1- (marker-position tpu-match-beginning-mark))) | 745 | (>= (point) (marker-position tpu-match-beginning-mark)) |
| 512 | (or | 746 | (or |
| 513 | (< (point) (marker-position tpu-match-end-mark)) | 747 | (< (point) (marker-position tpu-match-end-mark)) |
| 514 | (and (= (1- (marker-position tpu-match-beginning-mark)) | 748 | (and (= (marker-position tpu-match-beginning-mark) |
| 515 | (marker-position tpu-match-end-mark)) | 749 | (marker-position tpu-match-end-mark)) |
| 516 | (= (marker-position tpu-match-end-mark) (point))))) t) | 750 | (= (marker-position tpu-match-end-mark) (point))))) t) |
| 517 | (t | 751 | (t |
| @@ -521,12 +755,11 @@ Otherwise sets the tpu-match markers to nil and returns nil." | |||
| 521 | "Show the values of the match markers." | 755 | "Show the values of the match markers." |
| 522 | (interactive) | 756 | (interactive) |
| 523 | (if (markerp tpu-match-beginning-mark) | 757 | (if (markerp tpu-match-beginning-mark) |
| 524 | (let ((beg (marker-position tpu-match-beginning-mark))) | 758 | (message "(%s, %s) in %s -- current %s in %s" |
| 525 | (message "(%s, %s) in %s -- current %s in %s" | 759 | (marker-position tpu-match-beginning-mark) |
| 526 | (if beg (1- beg) nil) | 760 | (marker-position tpu-match-end-mark) |
| 527 | (marker-position tpu-match-end-mark) | 761 | (marker-buffer tpu-match-end-mark) |
| 528 | (marker-buffer tpu-match-end-mark) | 762 | (point) (current-buffer)))) |
| 529 | (point) (current-buffer))))) | ||
| 530 | 763 | ||
| 531 | 764 | ||
| 532 | ;;; | 765 | ;;; |
| @@ -549,7 +782,9 @@ version of Emacs." | |||
| 549 | Sets the mark at POS and activates the region according to the | 782 | Sets the mark at POS and activates the region according to the |
| 550 | current version of Emacs." | 783 | current version of Emacs." |
| 551 | (set-mark pos) | 784 | (set-mark pos) |
| 552 | (and tpu-lucid-emacs-p pos (zmacs-activate-region))) | 785 | ;; We use a separate `if' for the fboundp so the byte-compiler notices it |
| 786 | ;; and doesn't complain about the subsequent call. | ||
| 787 | (if (fboundp 'zmacs-activate-region) (if pos (zmacs-activate-region)))) | ||
| 553 | 788 | ||
| 554 | (defun tpu-string-prompt (prompt history-symbol) | 789 | (defun tpu-string-prompt (prompt history-symbol) |
| 555 | "Read a string with PROMPT." | 790 | "Read a string with PROMPT." |
| @@ -775,8 +1010,12 @@ This is useful for inserting control characters." | |||
| 775 | ;;; Command and Function Aliases | 1010 | ;;; Command and Function Aliases |
| 776 | ;;; | 1011 | ;;; |
| 777 | ;;;###autoload | 1012 | ;;;###autoload |
| 778 | (defalias 'tpu-edt-mode 'tpu-edt-on) | 1013 | (define-minor-mode tpu-edt-mode |
| 779 | (defalias 'TPU-EDT-MODE 'tpu-edt-on) | 1014 | "TPU/edt emulation." |
| 1015 | :global t | ||
| 1016 | (if tpu-edt-mode (tpu-edt-on) (tpu-edt-off))) | ||
| 1017 | |||
| 1018 | (defalias 'TPU-EDT-MODE 'tpu-edt-mode) | ||
| 780 | 1019 | ||
| 781 | ;;;###autoload | 1020 | ;;;###autoload |
| 782 | (defalias 'tpu-edt 'tpu-edt-on) | 1021 | (defalias 'tpu-edt 'tpu-edt-on) |
| @@ -1164,7 +1403,7 @@ The search is performed in the current direction." | |||
| 1164 | (defun tpu-set-search (&optional arg) | 1403 | (defun tpu-set-search (&optional arg) |
| 1165 | "Set the search functions and set the search direction to the current | 1404 | "Set the search functions and set the search direction to the current |
| 1166 | direction. If an argument is specified, don't set the search direction." | 1405 | direction. If an argument is specified, don't set the search direction." |
| 1167 | (if (not arg) (setq tpu-searching-forward (if tpu-advance t nil))) | 1406 | (if (not arg) (setq tpu-searching-forward tpu-advance)) |
| 1168 | (cond (tpu-searching-forward | 1407 | (cond (tpu-searching-forward |
| 1169 | (cond (tpu-regexp-p | 1408 | (cond (tpu-regexp-p |
| 1170 | (fset 'tpu-emacs-search 're-search-forward) | 1409 | (fset 'tpu-emacs-search 're-search-forward) |
| @@ -1217,7 +1456,7 @@ direction. If an argument is specified, don't set the search direction." | |||
| 1217 | "%sSearch failed: \"%s\"" | 1456 | "%sSearch failed: \"%s\"" |
| 1218 | (if tpu-regexp-p "RE " "") tpu-search-last-string))))))))) | 1457 | (if tpu-regexp-p "RE " "") tpu-search-last-string))))))))) |
| 1219 | 1458 | ||
| 1220 | (fset 'tpu-search-internal-core (symbol-function 'tpu-search-internal)) | 1459 | (defalias 'tpu-search-internal-core (symbol-function 'tpu-search-internal)) |
| 1221 | 1460 | ||
| 1222 | (defun tpu-check-search-case (string) | 1461 | (defun tpu-check-search-case (string) |
| 1223 | "Returns t if string contains upper case." | 1462 | "Returns t if string contains upper case." |
| @@ -2005,278 +2244,23 @@ Accepts a prefix argument for the number of tpu-pan-columns to scroll." | |||
| 2005 | 2244 | ||
| 2006 | 2245 | ||
| 2007 | ;;; | 2246 | ;;; |
| 2008 | ;;; Define keymaps | ||
| 2009 | ;;; | ||
| 2010 | (define-key SS3-map "P" GOLD-map) ; GOLD map | ||
| 2011 | (define-key GOLD-map "\e[" GOLD-CSI-map) ; GOLD-CSI map | ||
| 2012 | (define-key GOLD-map "\eO" GOLD-SS3-map) ; GOLD-SS3 map | ||
| 2013 | |||
| 2014 | |||
| 2015 | ;;; | ||
| 2016 | ;;; CSI-map key definitions | ||
| 2017 | ;;; | ||
| 2018 | (define-key CSI-map "A" 'tpu-previous-line) ; up | ||
| 2019 | (define-key CSI-map "B" 'tpu-next-line) ; down | ||
| 2020 | (define-key CSI-map "D" 'tpu-backward-char) ; left | ||
| 2021 | (define-key CSI-map "C" 'tpu-forward-char) ; right | ||
| 2022 | |||
| 2023 | (define-key CSI-map "1~" 'tpu-search) ; Find | ||
| 2024 | (define-key CSI-map "2~" 'tpu-paste) ; Insert Here | ||
| 2025 | (define-key CSI-map "3~" 'tpu-cut) ; Remove | ||
| 2026 | (define-key CSI-map "4~" 'tpu-select) ; Select | ||
| 2027 | (define-key CSI-map "5~" 'tpu-scroll-window-down) ; Prev Screen | ||
| 2028 | (define-key CSI-map "6~" 'tpu-scroll-window-up) ; Next Screen | ||
| 2029 | |||
| 2030 | (define-key CSI-map "11~" 'nil) ; F1 | ||
| 2031 | (define-key CSI-map "12~" 'nil) ; F2 | ||
| 2032 | (define-key CSI-map "13~" 'nil) ; F3 | ||
| 2033 | (define-key CSI-map "14~" 'nil) ; F4 | ||
| 2034 | (define-key CSI-map "15~" 'nil) ; F5 | ||
| 2035 | (define-key CSI-map "17~" 'nil) ; F6 | ||
| 2036 | (define-key CSI-map "18~" 'nil) ; F7 | ||
| 2037 | (define-key CSI-map "19~" 'nil) ; F8 | ||
| 2038 | (define-key CSI-map "20~" 'nil) ; F9 | ||
| 2039 | (define-key CSI-map "21~" 'tpu-exit) ; F10 | ||
| 2040 | (define-key CSI-map "23~" 'tpu-insert-escape) ; F11 (ESC) | ||
| 2041 | (define-key CSI-map "24~" 'tpu-next-beginning-of-line) ; F12 (BS) | ||
| 2042 | (define-key CSI-map "25~" 'tpu-delete-previous-word) ; F13 (LF) | ||
| 2043 | (define-key CSI-map "26~" 'tpu-toggle-overwrite-mode) ; F14 | ||
| 2044 | (define-key CSI-map "28~" 'tpu-help) ; HELP | ||
| 2045 | (define-key CSI-map "29~" 'execute-extended-command) ; DO | ||
| 2046 | (define-key CSI-map "31~" 'tpu-goto-breadcrumb) ; F17 | ||
| 2047 | (define-key CSI-map "32~" 'nil) ; F18 | ||
| 2048 | (define-key CSI-map "33~" 'nil) ; F19 | ||
| 2049 | (define-key CSI-map "34~" 'nil) ; F20 | ||
| 2050 | |||
| 2051 | |||
| 2052 | ;;; | ||
| 2053 | ;;; SS3-map key definitions | ||
| 2054 | ;;; | ||
| 2055 | (define-key SS3-map "A" 'tpu-previous-line) ; up | ||
| 2056 | (define-key SS3-map "B" 'tpu-next-line) ; down | ||
| 2057 | (define-key SS3-map "C" 'tpu-forward-char) ; right | ||
| 2058 | (define-key SS3-map "D" 'tpu-backward-char) ; left | ||
| 2059 | |||
| 2060 | (define-key SS3-map "Q" 'tpu-help) ; PF2 | ||
| 2061 | (define-key SS3-map "R" 'tpu-search-again) ; PF3 | ||
| 2062 | (define-key SS3-map "S" 'tpu-delete-current-line) ; PF4 | ||
| 2063 | (define-key SS3-map "p" 'tpu-line) ; KP0 | ||
| 2064 | (define-key SS3-map "q" 'tpu-word) ; KP1 | ||
| 2065 | (define-key SS3-map "r" 'tpu-end-of-line) ; KP2 | ||
| 2066 | (define-key SS3-map "s" 'tpu-char) ; KP3 | ||
| 2067 | (define-key SS3-map "t" 'tpu-advance-direction) ; KP4 | ||
| 2068 | (define-key SS3-map "u" 'tpu-backup-direction) ; KP5 | ||
| 2069 | (define-key SS3-map "v" 'tpu-cut) ; KP6 | ||
| 2070 | (define-key SS3-map "w" 'tpu-page) ; KP7 | ||
| 2071 | (define-key SS3-map "x" 'tpu-scroll-window) ; KP8 | ||
| 2072 | (define-key SS3-map "y" 'tpu-append-region) ; KP9 | ||
| 2073 | (define-key SS3-map "m" 'tpu-delete-current-word) ; KP- | ||
| 2074 | (define-key SS3-map "l" 'tpu-delete-current-char) ; KP, | ||
| 2075 | (define-key SS3-map "n" 'tpu-select) ; KP. | ||
| 2076 | (define-key SS3-map "M" 'newline) ; KPenter | ||
| 2077 | |||
| 2078 | |||
| 2079 | ;;; | ||
| 2080 | ;;; GOLD-map key definitions | ||
| 2081 | ;;; | ||
| 2082 | (define-key GOLD-map "\C-A" 'tpu-toggle-overwrite-mode) ; ^A | ||
| 2083 | (define-key GOLD-map "\C-B" 'nil) ; ^B | ||
| 2084 | (define-key GOLD-map "\C-C" 'nil) ; ^C | ||
| 2085 | (define-key GOLD-map "\C-D" 'nil) ; ^D | ||
| 2086 | (define-key GOLD-map "\C-E" 'nil) ; ^E | ||
| 2087 | (define-key GOLD-map "\C-F" 'set-visited-file-name) ; ^F | ||
| 2088 | (define-key GOLD-map "\C-g" 'keyboard-quit) ; safety first | ||
| 2089 | (define-key GOLD-map "\C-h" 'delete-other-windows) ; BS | ||
| 2090 | (define-key GOLD-map "\C-i" 'other-window) ; TAB | ||
| 2091 | (define-key GOLD-map "\C-J" 'nil) ; ^J | ||
| 2092 | (define-key GOLD-map "\C-K" 'tpu-define-macro-key) ; ^K | ||
| 2093 | (define-key GOLD-map "\C-l" 'downcase-region) ; ^L | ||
| 2094 | (define-key GOLD-map "\C-M" 'nil) ; ^M | ||
| 2095 | (define-key GOLD-map "\C-N" 'nil) ; ^N | ||
| 2096 | (define-key GOLD-map "\C-O" 'nil) ; ^O | ||
| 2097 | (define-key GOLD-map "\C-P" 'nil) ; ^P | ||
| 2098 | (define-key GOLD-map "\C-Q" 'nil) ; ^Q | ||
| 2099 | (define-key GOLD-map "\C-R" 'nil) ; ^R | ||
| 2100 | (define-key GOLD-map "\C-S" 'nil) ; ^S | ||
| 2101 | (define-key GOLD-map "\C-T" 'tpu-toggle-control-keys) ; ^T | ||
| 2102 | (define-key GOLD-map "\C-u" 'upcase-region) ; ^U | ||
| 2103 | (define-key GOLD-map "\C-V" 'nil) ; ^V | ||
| 2104 | (define-key GOLD-map "\C-w" 'tpu-write-current-buffers) ; ^W | ||
| 2105 | (define-key GOLD-map "\C-X" 'nil) ; ^X | ||
| 2106 | (define-key GOLD-map "\C-Y" 'nil) ; ^Y | ||
| 2107 | (define-key GOLD-map "\C-Z" 'nil) ; ^Z | ||
| 2108 | (define-key GOLD-map " " 'undo) ; SPC | ||
| 2109 | (define-key GOLD-map "!" 'nil) ; ! | ||
| 2110 | (define-key GOLD-map "#" 'nil) ; # | ||
| 2111 | (define-key GOLD-map "$" 'tpu-add-at-eol) ; $ | ||
| 2112 | (define-key GOLD-map "%" 'tpu-goto-percent) ; % | ||
| 2113 | (define-key GOLD-map "&" 'nil) ; & | ||
| 2114 | (define-key GOLD-map "(" 'nil) ; ( | ||
| 2115 | (define-key GOLD-map ")" 'nil) ; ) | ||
| 2116 | (define-key GOLD-map "*" 'tpu-toggle-regexp) ; * | ||
| 2117 | (define-key GOLD-map "+" 'nil) ; + | ||
| 2118 | (define-key GOLD-map "," 'tpu-goto-breadcrumb) ; , | ||
| 2119 | (define-key GOLD-map "-" 'negative-argument) ; - | ||
| 2120 | (define-key GOLD-map "." 'tpu-drop-breadcrumb) ; . | ||
| 2121 | (define-key GOLD-map "/" 'tpu-emacs-replace) ; / | ||
| 2122 | (define-key GOLD-map "0" 'digit-argument) ; 0 | ||
| 2123 | (define-key GOLD-map "1" 'digit-argument) ; 1 | ||
| 2124 | (define-key GOLD-map "2" 'digit-argument) ; 2 | ||
| 2125 | (define-key GOLD-map "3" 'digit-argument) ; 3 | ||
| 2126 | (define-key GOLD-map "4" 'digit-argument) ; 4 | ||
| 2127 | (define-key GOLD-map "5" 'digit-argument) ; 5 | ||
| 2128 | (define-key GOLD-map "6" 'digit-argument) ; 6 | ||
| 2129 | (define-key GOLD-map "7" 'digit-argument) ; 7 | ||
| 2130 | (define-key GOLD-map "8" 'digit-argument) ; 8 | ||
| 2131 | (define-key GOLD-map "9" 'digit-argument) ; 9 | ||
| 2132 | (define-key GOLD-map ":" 'nil) ; : | ||
| 2133 | (define-key GOLD-map ";" 'tpu-trim-line-ends) ; ; | ||
| 2134 | (define-key GOLD-map "<" 'nil) ; < | ||
| 2135 | (define-key GOLD-map "=" 'nil) ; = | ||
| 2136 | (define-key GOLD-map ">" 'nil) ; > | ||
| 2137 | (define-key GOLD-map "?" 'tpu-spell-check) ; ? | ||
| 2138 | (define-key GOLD-map "A" 'tpu-toggle-newline-and-indent) ; A | ||
| 2139 | (define-key GOLD-map "B" 'tpu-next-buffer) ; B | ||
| 2140 | (define-key GOLD-map "C" 'repeat-complex-command) ; C | ||
| 2141 | (define-key GOLD-map "D" 'shell-command) ; D | ||
| 2142 | (define-key GOLD-map "E" 'tpu-exit) ; E | ||
| 2143 | (define-key GOLD-map "F" 'tpu-set-cursor-free) ; F | ||
| 2144 | (define-key GOLD-map "G" 'tpu-get) ; G | ||
| 2145 | (define-key GOLD-map "H" 'nil) ; H | ||
| 2146 | (define-key GOLD-map "I" 'tpu-include) ; I | ||
| 2147 | (define-key GOLD-map "K" 'tpu-kill-buffer) ; K | ||
| 2148 | (define-key GOLD-map "L" 'tpu-what-line) ; L | ||
| 2149 | (define-key GOLD-map "M" 'buffer-menu) ; M | ||
| 2150 | (define-key GOLD-map "N" 'tpu-next-file-buffer) ; N | ||
| 2151 | (define-key GOLD-map "O" 'occur) ; O | ||
| 2152 | (define-key GOLD-map "P" 'lpr-buffer) ; P | ||
| 2153 | (define-key GOLD-map "Q" 'tpu-quit) ; Q | ||
| 2154 | (define-key GOLD-map "R" 'tpu-toggle-rectangle) ; R | ||
| 2155 | (define-key GOLD-map "S" 'replace) ; S | ||
| 2156 | (define-key GOLD-map "T" 'tpu-line-to-top-of-window) ; T | ||
| 2157 | (define-key GOLD-map "U" 'undo) ; U | ||
| 2158 | (define-key GOLD-map "V" 'tpu-version) ; V | ||
| 2159 | (define-key GOLD-map "W" 'save-buffer) ; W | ||
| 2160 | (define-key GOLD-map "X" 'tpu-save-all-buffers-kill-emacs) ; X | ||
| 2161 | (define-key GOLD-map "Y" 'copy-region-as-kill) ; Y | ||
| 2162 | (define-key GOLD-map "Z" 'suspend-emacs) ; Z | ||
| 2163 | (define-key GOLD-map "[" 'blink-matching-open) ; [ | ||
| 2164 | (define-key GOLD-map "\\" 'nil) ; \ | ||
| 2165 | (define-key GOLD-map "]" 'blink-matching-open) ; ] | ||
| 2166 | (define-key GOLD-map "^" 'tpu-add-at-bol) ; ^ | ||
| 2167 | (define-key GOLD-map "_" 'split-window-vertically) ; - | ||
| 2168 | (define-key GOLD-map "`" 'what-line) ; ` | ||
| 2169 | (define-key GOLD-map "a" 'tpu-toggle-newline-and-indent) ; a | ||
| 2170 | (define-key GOLD-map "b" 'tpu-next-buffer) ; b | ||
| 2171 | (define-key GOLD-map "c" 'repeat-complex-command) ; c | ||
| 2172 | (define-key GOLD-map "d" 'shell-command) ; d | ||
| 2173 | (define-key GOLD-map "e" 'tpu-exit) ; e | ||
| 2174 | (define-key GOLD-map "f" 'tpu-set-cursor-free) ; f | ||
| 2175 | (define-key GOLD-map "g" 'tpu-get) ; g | ||
| 2176 | (define-key GOLD-map "h" 'nil) ; h | ||
| 2177 | (define-key GOLD-map "i" 'tpu-include) ; i | ||
| 2178 | (define-key GOLD-map "k" 'tpu-kill-buffer) ; k | ||
| 2179 | (define-key GOLD-map "l" 'goto-line) ; l | ||
| 2180 | (define-key GOLD-map "m" 'buffer-menu) ; m | ||
| 2181 | (define-key GOLD-map "n" 'tpu-next-file-buffer) ; n | ||
| 2182 | (define-key GOLD-map "o" 'occur) ; o | ||
| 2183 | (define-key GOLD-map "p" 'lpr-region) ; p | ||
| 2184 | (define-key GOLD-map "q" 'tpu-quit) ; q | ||
| 2185 | (define-key GOLD-map "r" 'tpu-toggle-rectangle) ; r | ||
| 2186 | (define-key GOLD-map "s" 'replace) ; s | ||
| 2187 | (define-key GOLD-map "t" 'tpu-line-to-top-of-window) ; t | ||
| 2188 | (define-key GOLD-map "u" 'undo) ; u | ||
| 2189 | (define-key GOLD-map "v" 'tpu-version) ; v | ||
| 2190 | (define-key GOLD-map "w" 'save-buffer) ; w | ||
| 2191 | (define-key GOLD-map "x" 'tpu-save-all-buffers-kill-emacs) ; x | ||
| 2192 | (define-key GOLD-map "y" 'copy-region-as-kill) ; y | ||
| 2193 | (define-key GOLD-map "z" 'suspend-emacs) ; z | ||
| 2194 | (define-key GOLD-map "{" 'nil) ; { | ||
| 2195 | (define-key GOLD-map "|" 'split-window-horizontally) ; | | ||
| 2196 | (define-key GOLD-map "}" 'nil) ; } | ||
| 2197 | (define-key GOLD-map "~" 'exchange-point-and-mark) ; ~ | ||
| 2198 | (define-key GOLD-map "\177" 'delete-window) ; <X] | ||
| 2199 | |||
| 2200 | |||
| 2201 | ;;; | ||
| 2202 | ;;; GOLD-CSI-map key definitions | ||
| 2203 | ;;; | ||
| 2204 | (define-key GOLD-CSI-map "A" 'tpu-move-to-beginning) ; up-arrow | ||
| 2205 | (define-key GOLD-CSI-map "B" 'tpu-move-to-end) ; down-arrow | ||
| 2206 | (define-key GOLD-CSI-map "C" 'end-of-line) ; right-arrow | ||
| 2207 | (define-key GOLD-CSI-map "D" 'beginning-of-line) ; left-arrow | ||
| 2208 | |||
| 2209 | (define-key GOLD-CSI-map "1~" 'nil) ; Find | ||
| 2210 | (define-key GOLD-CSI-map "2~" 'nil) ; Insert Here | ||
| 2211 | (define-key GOLD-CSI-map "3~" 'tpu-store-text) ; Remove | ||
| 2212 | (define-key GOLD-CSI-map "4~" 'tpu-unselect) ; Select | ||
| 2213 | (define-key GOLD-CSI-map "5~" 'tpu-previous-window) ; Prev Screen | ||
| 2214 | (define-key GOLD-CSI-map "6~" 'tpu-next-window) ; Next Screen | ||
| 2215 | |||
| 2216 | (define-key GOLD-CSI-map "11~" 'nil) ; F1 | ||
| 2217 | (define-key GOLD-CSI-map "12~" 'nil) ; F2 | ||
| 2218 | (define-key GOLD-CSI-map "13~" 'nil) ; F3 | ||
| 2219 | (define-key GOLD-CSI-map "14~" 'nil) ; F4 | ||
| 2220 | (define-key GOLD-CSI-map "16~" 'nil) ; F5 | ||
| 2221 | (define-key GOLD-CSI-map "17~" 'nil) ; F6 | ||
| 2222 | (define-key GOLD-CSI-map "18~" 'nil) ; F7 | ||
| 2223 | (define-key GOLD-CSI-map "19~" 'nil) ; F8 | ||
| 2224 | (define-key GOLD-CSI-map "20~" 'nil) ; F9 | ||
| 2225 | (define-key GOLD-CSI-map "21~" 'nil) ; F10 | ||
| 2226 | (define-key GOLD-CSI-map "23~" 'nil) ; F11 | ||
| 2227 | (define-key GOLD-CSI-map "24~" 'nil) ; F12 | ||
| 2228 | (define-key GOLD-CSI-map "25~" 'nil) ; F13 | ||
| 2229 | (define-key GOLD-CSI-map "26~" 'nil) ; F14 | ||
| 2230 | (define-key GOLD-CSI-map "28~" 'describe-bindings) ; HELP | ||
| 2231 | (define-key GOLD-CSI-map "29~" 'nil) ; DO | ||
| 2232 | (define-key GOLD-CSI-map "31~" 'tpu-drop-breadcrumb) ; F17 | ||
| 2233 | (define-key GOLD-CSI-map "32~" 'nil) ; F18 | ||
| 2234 | (define-key GOLD-CSI-map "33~" 'nil) ; F19 | ||
| 2235 | (define-key GOLD-CSI-map "34~" 'nil) ; F20 | ||
| 2236 | |||
| 2237 | |||
| 2238 | ;;; | ||
| 2239 | ;;; GOLD-SS3-map key definitions | ||
| 2240 | ;;; | ||
| 2241 | (define-key GOLD-SS3-map "A" 'tpu-move-to-beginning) ; up-arrow | ||
| 2242 | (define-key GOLD-SS3-map "B" 'tpu-move-to-end) ; down-arrow | ||
| 2243 | (define-key GOLD-SS3-map "C" 'end-of-line) ; right-arrow | ||
| 2244 | (define-key GOLD-SS3-map "D" 'beginning-of-line) ; left-arrow | ||
| 2245 | |||
| 2246 | (define-key GOLD-SS3-map "P" 'keyboard-quit) ; PF1 | ||
| 2247 | (define-key GOLD-SS3-map "Q" 'help-for-help) ; PF2 | ||
| 2248 | (define-key GOLD-SS3-map "R" 'tpu-search) ; PF3 | ||
| 2249 | (define-key GOLD-SS3-map "S" 'tpu-undelete-lines) ; PF4 | ||
| 2250 | (define-key GOLD-SS3-map "p" 'open-line) ; KP0 | ||
| 2251 | (define-key GOLD-SS3-map "q" 'tpu-change-case) ; KP1 | ||
| 2252 | (define-key GOLD-SS3-map "r" 'tpu-delete-to-eol) ; KP2 | ||
| 2253 | (define-key GOLD-SS3-map "s" 'tpu-special-insert) ; KP3 | ||
| 2254 | (define-key GOLD-SS3-map "t" 'tpu-move-to-end) ; KP4 | ||
| 2255 | (define-key GOLD-SS3-map "u" 'tpu-move-to-beginning) ; KP5 | ||
| 2256 | (define-key GOLD-SS3-map "v" 'tpu-paste) ; KP6 | ||
| 2257 | (define-key GOLD-SS3-map "w" 'execute-extended-command) ; KP7 | ||
| 2258 | (define-key GOLD-SS3-map "x" 'tpu-fill) ; KP8 | ||
| 2259 | (define-key GOLD-SS3-map "y" 'tpu-replace) ; KP9 | ||
| 2260 | (define-key GOLD-SS3-map "m" 'tpu-undelete-words) ; KP- | ||
| 2261 | (define-key GOLD-SS3-map "l" 'tpu-undelete-char) ; KP, | ||
| 2262 | (define-key GOLD-SS3-map "n" 'tpu-unselect) ; KP. | ||
| 2263 | (define-key GOLD-SS3-map "M" 'tpu-substitute) ; KPenter | ||
| 2264 | |||
| 2265 | |||
| 2266 | ;;; | ||
| 2267 | ;;; Minibuffer map additions to make KP_enter = RET | 2247 | ;;; Minibuffer map additions to make KP_enter = RET |
| 2268 | ;;; | 2248 | ;;; |
| 2269 | (define-key minibuffer-local-map "\eOM" 'exit-minibuffer) | 2249 | ;; Standard Emacs settings under xterm in function-key-map map |
| 2270 | (define-key minibuffer-local-ns-map "\eOM" 'exit-minibuffer) | 2250 | ;; "\eOM" to [kp-enter] and [kp-enter] to RET, but since the output of the map |
| 2271 | (define-key minibuffer-local-completion-map "\eOM" 'exit-minibuffer) | 2251 | ;; is not fed back into the map, the key stays as kp-enter :-(. |
| 2272 | (define-key minibuffer-local-must-match-map "\eOM" 'minibuffer-complete-and-exit) | 2252 | (define-key minibuffer-local-map [kp-enter] 'exit-minibuffer) |
| 2253 | ;; These are not necessary because they are inherited. | ||
| 2254 | ;; (define-key minibuffer-local-ns-map [kp-enter] 'exit-minibuffer) | ||
| 2255 | ;; (define-key minibuffer-local-completion-map [kp-enter] 'exit-minibuffer) | ||
| 2256 | (define-key minibuffer-local-must-match-map [kp-enter] 'minibuffer-complete-and-exit) | ||
| 2273 | 2257 | ||
| 2274 | 2258 | ||
| 2275 | ;;; | 2259 | ;;; |
| 2276 | ;;; Minibuffer map additions to set search direction | 2260 | ;;; Minibuffer map additions to set search direction |
| 2277 | ;;; | 2261 | ;;; |
| 2278 | (define-key minibuffer-local-map "\eOt" 'tpu-search-forward-exit) | 2262 | (define-key minibuffer-local-map "\eOt" 'tpu-search-forward-exit) ;KP4 |
| 2279 | (define-key minibuffer-local-map "\eOu" 'tpu-search-backward-exit) | 2263 | (define-key minibuffer-local-map "\eOu" 'tpu-search-backward-exit) ;KP5 |
| 2280 | 2264 | ||
| 2281 | 2265 | ||
| 2282 | ;;; | 2266 | ;;; |
| @@ -2306,9 +2290,7 @@ Accepts a prefix argument for the number of tpu-pan-columns to scroll." | |||
| 2306 | (doit (or tpu emacs))) | 2290 | (doit (or tpu emacs))) |
| 2307 | (cond (doit | 2291 | (cond (doit |
| 2308 | (if emacs (setq tpu-global-map (copy-keymap global-map))) | 2292 | (if emacs (setq tpu-global-map (copy-keymap global-map))) |
| 2309 | (let ((map (if tpu | 2293 | (let ((map (if tpu tpu-global-map tpu-original-global-map))) |
| 2310 | (copy-keymap tpu-global-map) | ||
| 2311 | (copy-keymap tpu-original-global-map)))) | ||
| 2312 | 2294 | ||
| 2313 | (define-key global-map "\C-\\" (lookup-key map "\C-\\")) ; ^\ | 2295 | (define-key global-map "\C-\\" (lookup-key map "\C-\\")) ; ^\ |
| 2314 | (define-key global-map "\C-a" (lookup-key map "\C-a")) ; ^A | 2296 | (define-key global-map "\C-a" (lookup-key map "\C-a")) ; ^A |
| @@ -2352,23 +2334,23 @@ Accepts a prefix argument for the number of tpu-pan-columns to scroll." | |||
| 2352 | (defun tpu-arrow-history nil | 2334 | (defun tpu-arrow-history nil |
| 2353 | "Modify minibuffer maps to use arrows for history recall." | 2335 | "Modify minibuffer maps to use arrows for history recall." |
| 2354 | (interactive) | 2336 | (interactive) |
| 2355 | (let ((loc (where-is-internal 'tpu-previous-line)) (cur nil)) | 2337 | (dolist (cur (where-is-internal 'tpu-previous-line)) |
| 2356 | (while (setq cur (car loc)) | 2338 | (define-key read-expression-map cur 'tpu-previous-history-element) |
| 2357 | (define-key read-expression-map cur 'tpu-previous-history-element) | 2339 | (define-key minibuffer-local-map cur 'tpu-previous-history-element) |
| 2358 | (define-key minibuffer-local-map cur 'tpu-previous-history-element) | 2340 | ;; These are inherited anyway. --Stef |
| 2359 | (define-key minibuffer-local-ns-map cur 'tpu-previous-history-element) | 2341 | ;; (define-key minibuffer-local-ns-map cur 'tpu-previous-history-element) |
| 2360 | (define-key minibuffer-local-completion-map cur 'tpu-previous-history-element) | 2342 | ;; (define-key minibuffer-local-completion-map cur 'tpu-previous-history-element) |
| 2361 | (define-key minibuffer-local-must-match-map cur 'tpu-previous-history-element) | 2343 | ;; (define-key minibuffer-local-must-match-map cur 'tpu-previous-history-element) |
| 2362 | (setq loc (cdr loc))) | 2344 | ) |
| 2363 | 2345 | ||
| 2364 | (setq loc (where-is-internal 'tpu-next-line)) | 2346 | (dolist (cur (where-is-internal 'tpu-next-line)) |
| 2365 | (while (setq cur (car loc)) | 2347 | (define-key read-expression-map cur 'tpu-next-history-element) |
| 2366 | (define-key read-expression-map cur 'tpu-next-history-element) | 2348 | (define-key minibuffer-local-map cur 'tpu-next-history-element) |
| 2367 | (define-key minibuffer-local-map cur 'tpu-next-history-element) | 2349 | ;; These are inherited anyway. --Stef |
| 2368 | (define-key minibuffer-local-ns-map cur 'tpu-next-history-element) | 2350 | ;; (define-key minibuffer-local-ns-map cur 'tpu-next-history-element) |
| 2369 | (define-key minibuffer-local-completion-map cur 'tpu-next-history-element) | 2351 | ;; (define-key minibuffer-local-completion-map cur 'tpu-next-history-element) |
| 2370 | (define-key minibuffer-local-must-match-map cur 'tpu-next-history-element) | 2352 | ;; (define-key minibuffer-local-must-match-map cur 'tpu-next-history-element) |
| 2371 | (setq loc (cdr loc))))) | 2353 | )) |
| 2372 | 2354 | ||
| 2373 | 2355 | ||
| 2374 | ;;; | 2356 | ;;; |
| @@ -2461,46 +2443,39 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 2461 | ;;; Start and Stop TPU-edt | 2443 | ;;; Start and Stop TPU-edt |
| 2462 | ;;; | 2444 | ;;; |
| 2463 | ;;;###autoload | 2445 | ;;;###autoload |
| 2464 | (defun tpu-edt-on nil | 2446 | (defun tpu-edt-on () |
| 2465 | "Turn on TPU/edt emulation." | 2447 | "Turn on TPU/edt emulation." |
| 2466 | (interactive) | 2448 | (interactive) |
| 2467 | (cond | 2449 | (and window-system (tpu-load-xkeys nil)) |
| 2468 | ((not tpu-edt-mode) | 2450 | (tpu-arrow-history) |
| 2469 | ;; we use picture-mode functions | 2451 | (transient-mark-mode t) |
| 2470 | (require 'picture) | 2452 | (add-hook 'post-command-hook 'tpu-search-highlight) |
| 2471 | (tpu-set-control-keys) | 2453 | (tpu-set-mode-line t) |
| 2472 | (and window-system (tpu-load-xkeys nil)) | 2454 | (tpu-advance-direction) |
| 2473 | (tpu-arrow-history) | 2455 | ;; set page delimiter, display line truncation, and scrolling like TPU |
| 2474 | (transient-mark-mode t) | 2456 | (setq-default page-delimiter "\f") |
| 2475 | (add-hook 'post-command-hook 'tpu-search-highlight) | 2457 | (setq-default truncate-lines t) |
| 2476 | (tpu-set-mode-line t) | 2458 | (setq scroll-step 1) |
| 2477 | (tpu-advance-direction) | 2459 | (setq global-map (copy-keymap global-map)) |
| 2478 | ;; set page delimiter, display line truncation, and scrolling like TPU | 2460 | (tpu-set-control-keys) |
| 2479 | (setq-default page-delimiter "\f") | 2461 | (define-key global-map "\e[" CSI-map) |
| 2480 | (setq-default truncate-lines t) | 2462 | (define-key global-map "\eO" SS3-map) |
| 2481 | (setq scroll-step 1) | 2463 | (setq tpu-edt-mode t)) |
| 2482 | (setq tpu-original-global-map global-map) | 2464 | |
| 2483 | (setq global-map (copy-keymap global-map)) | 2465 | (defun tpu-edt-off () |
| 2484 | (define-key global-map "\e[" CSI-map) | ||
| 2485 | (define-key global-map "\eO" SS3-map) | ||
| 2486 | (setq tpu-edt-mode t)))) | ||
| 2487 | |||
| 2488 | (defun tpu-edt-off nil | ||
| 2489 | "Turn off TPU/edt emulation. Note that the keypad is left on." | 2466 | "Turn off TPU/edt emulation. Note that the keypad is left on." |
| 2490 | (interactive) | 2467 | (interactive) |
| 2491 | (cond | 2468 | (tpu-reset-control-keys nil) |
| 2492 | (tpu-edt-mode | 2469 | (remove-hook 'post-command-hook 'tpu-search-highlight) |
| 2493 | (tpu-reset-control-keys nil) | 2470 | (tpu-set-mode-line nil) |
| 2494 | (remove-hook 'post-command-hook 'tpu-search-highlight) | 2471 | (setq-default page-delimiter "^\f") |
| 2495 | (tpu-set-mode-line nil) | 2472 | (setq-default truncate-lines nil) |
| 2496 | (setq-default page-delimiter "^\f") | 2473 | (setq scroll-step 0) |
| 2497 | (setq-default truncate-lines nil) | 2474 | (setq global-map tpu-original-global-map) |
| 2498 | (setq scroll-step 0) | 2475 | (use-global-map global-map) |
| 2499 | (setq global-map tpu-original-global-map) | 2476 | (setq tpu-edt-mode nil)) |
| 2500 | (use-global-map global-map) | ||
| 2501 | (setq tpu-edt-mode nil)))) | ||
| 2502 | 2477 | ||
| 2503 | (provide 'tpu-edt) | 2478 | (provide 'tpu-edt) |
| 2504 | 2479 | ||
| 2505 | ;;; arch-tag: f3dfe61c-2cbd-4f73-b9cc-eb215020b857 | 2480 | ;; arch-tag: f3dfe61c-2cbd-4f73-b9cc-eb215020b857 |
| 2506 | ;;; tpu-edt.el ends here | 2481 | ;;; tpu-edt.el ends here |