home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / modes / edt / edt-user.el-2 < prev    next >
Encoding:
Text File  |  1991-10-25  |  13.6 KB  |  321 lines

  1. ;;; File:  edt-user.el-2, v 1.4
  2. ;;;
  3. ;;; BEFORE USING THIS FILE, rename it to edt-user.el.
  4. ;;;
  5. ;;; See edt-user.doc for general customization instructions BEFORE using
  6. ;;; and/or changing the contents of this file!
  7. ;;; 
  8. ;;;                  -------   ---------------------------
  9. ;;;                  U s e r   C u s t o m i z a t i o n s
  10. ;;;                  -------   ---------------------------
  11. ;;;
  12. ;;;            -----   -----------   -------   -----------------
  13. ;;;            E D T   K e y p a d   M o d e   E m u l a t i o n
  14. ;;;            -----   -----------   -------   -----------------
  15. ;;;
  16. ;;;                        BETA Distribution Version 0.5
  17. ;;;
  18. ;;; Copyright (C) 1986 Free Software Foundation, Inc.
  19. ;;; Copyright (C) 1991 Kevin Gallagher
  20. ;;;
  21. ;;;
  22. ;;; This file contains GNU Emacs User Custom EDT bindings and functions.  In
  23. ;;; this example file, there is a test for the type of terminal being used.
  24. ;;; The file supports custom bindings for two different types of terminals: VT
  25. ;;; terminals and the Apollo Workstation using a Low Profile II keyboard.
  26. ;;; (The individual who wrote this file sometimes logs into the workstation
  27. ;;; over a modem using a VT100 emulator on a PC, as well as logging in at the
  28. ;;; workstation itself.)
  29. ;;;
  30. ;;; WARNING: Each of the three functions, edt-bind-function-key,
  31. ;;;          edt-bind-gold-key, and edt-bind-standard-key, has an optional
  32. ;;;          last argument.  The optional argument should NOT be used in
  33. ;;;          edt-user.el!  When the optional argument is missing, each
  34. ;;;          function knows to make the key binding part of the user's EDT
  35. ;;;          custom bindings, which is what you want to do in edt-user.el!
  36. ;;;
  37. ;;;          The EDT default bindings are set up in edt.el by calling these
  38. ;;;          same functions with the optional last argument set to "t".  So,
  39. ;;;          if you decide to copy such function calls from edt.el to
  40. ;;;          edt-user.el, BE SURE TO DELETE THE "t" AT THE END OF EACH
  41. ;;;          PARAMETER LIST!
  42. ;;;
  43. ;;; Send bug reports and suggestions for improvement to Kevin Gallagher
  44. ;;; (kgallagh@digi.lonestar.org).
  45. ;;;
  46.  
  47.  
  48. ;;;;
  49. ;;;; Setup user custom EDT key bindings.
  50. ;;;;
  51.  
  52. (defun edt-setup-user-bindings ()
  53.   "Assigns user custom EDT Emulation keyboard bindings."
  54.  
  55.   ;; PF1 (GOLD), PF2, PF3, PF4
  56.   ;;
  57.   ;; This file MUST contain a binding of PF1 to edt-user-gold-map.  So
  58.   ;; DON'T CHANGE OR DELETE THE REGULAR KEY BINDING OF PF1 BELOW!
  59.   ;; (However, you may change the GOLD-PF1 binding, if you wish.)
  60.   (edt-bind-function-key "PF1" 'edt-user-gold-map 'edt-mark-section-wisely)
  61.   (edt-bind-function-key "PF2" 'query-replace 'other-window)
  62.   (edt-bind-function-key "PF4" 'edt-delete-entire-line 'edt-undelete-line)
  63.  
  64.   ;; Apollo Function Keys
  65.   (if (or (string-equal "apollo" edt-term)
  66.           (string-equal "apollo_1280_bw" edt-term))
  67.       (progn
  68.         ;; Make my private Apollo Display Manager key bindings to GROW and
  69.         ;; F0-F6 accessible to me when cursor is in an Emacs window.  This is
  70.         ;; done by telling Apollo GNU Emacs to ignore these keys. 
  71.         (unbind-apollo-function-key "GROW")
  72.         (unbind-apollo-function-key "F0")
  73.         (unbind-apollo-function-key "F1")
  74.         (unbind-apollo-function-key "F2")
  75.         (unbind-apollo-function-key "F3")
  76.         (unbind-apollo-function-key "F4")
  77.         (unbind-apollo-function-key "F5")
  78.         (unbind-apollo-function-key "F6")
  79.         )
  80.       )
  81.  
  82.   ;; EDT Keypad Keys
  83.   (edt-bind-function-key "KP1" 'edt-word-forward 'edt-change-case)
  84.   (edt-bind-function-key "KP3" 'edt-word-backward 'edt-copy)
  85.   (edt-bind-function-key "KP6" 'edt-cut-or-copy 'yank)
  86.   (edt-bind-function-key "KP8" 'edt-scroll-window 'fill-paragraph)
  87.   (edt-bind-function-key "KP9" 'open-line 'edt-eliminate-all-tabs)
  88.   (edt-bind-function-key "KPP" 
  89.              'edt-toggle-select 'edt-line-to-middle-of-window)
  90.   (edt-bind-function-key "KPE" 'edt-change-direction 'overwrite-mode)
  91.  
  92.   ;; EDT Function Keys
  93.   ;; 
  94.   ;; If you wish to retain the feature of emulating an ESC key with F11 on a
  95.   ;; terminal that has no ESC key, this file MUST contain a binding of F11 to
  96.   ;; edt-user-ESC-prefix.  So DON'T CHANGE OR DELETE THE REGULAR KEY BINDING
  97.   ;; OF F11 BELOW!  (However, you may change the GOLD-F11 binding, if you
  98.   ;; wish.)
  99.   (edt-bind-function-key "F11" 'edt-user-ESC-prefix 'edt-key-not-assigned) ;ESC
  100.  
  101.   ;; GOLD bindings for regular keys.
  102.   (edt-bind-gold-key "a" 'edt-append)
  103.   (edt-bind-gold-key "A" 'edt-append)
  104.   (edt-bind-gold-key "h" 'edt-electric-user-keypad-help)
  105.   (edt-bind-gold-key "H" 'edt-electric-user-keypad-help)
  106.  
  107.   ;; Control bindings for regular keys.
  108.   (edt-bind-standard-key "\C-a" 'beginning-of-line)
  109.   (edt-bind-standard-key "\C-b" 'switch-to-buffer)
  110.   ;;; Leave binding of C-c as original prefix key.
  111.   (edt-bind-standard-key "\C-d" 'delete-char)
  112.   (edt-bind-standard-key "\C-e" 'end-of-line)
  113.   (edt-bind-standard-key "\C-f" 'forward-char)
  114.   (edt-bind-standard-key "\C-h" 'ehelp-command)
  115.   (edt-bind-standard-key "\C-i" 'indent-for-tab-command)
  116.   (edt-bind-standard-key "\C-j" 'edt-duplicate-word)
  117.   (edt-bind-standard-key "\C-l" 'edt-learn)
  118.   ;;; Leave binding of C-m to newline.
  119.   (edt-bind-standard-key "\C-o" 'open-line)
  120.   (edt-bind-standard-key "\C-p" 'fill-paragraph)
  121.   (edt-bind-standard-key "\C-q" 'quoted-insert)
  122.   ;;; Leave binding of C-r to isearch-backward.
  123.   ;;; Leave binding of C-s to isearch-forward.
  124.   (edt-bind-standard-key "\C-u" 'universal-argument)
  125.   ;;; Leave binding of C-x as original prefix key.
  126. )
  127.  
  128. (if (or (string-equal "vt100" edt-term)
  129.         (string-equal "vt200" edt-term)
  130.         (string-equal "vt300" edt-term))
  131.  
  132. ;;;
  133. ;;; VT100/VT200/VT300 SERIES USER EDT KEYPAD HELP
  134. ;;;
  135.  
  136. (defun edt-user-keypad-help ()
  137.   "
  138.                                 USER EDT Keypad Active
  139.  
  140.                                   +----------+----------+----------+----------+
  141.    F7: Copy Rectangle             |Prev Line |Next Line |Bkwd Char |Frwd Char |
  142.    F8: Cut Rect Overstrike        |   (UP)   |  (DOWN)  |  (LEFT)  | (RIGHT)  |
  143.  G-F8: Paste Rect Overstrike      |Window Top|Window Bot|Bkwd Sent |Frwd Sent |
  144.    F9: Cut Rect Insert            +----------+----------+----------+----------+
  145.  G-F9: Paste Rect Insert         
  146.   F11: ESC                        +----------+----------+----------+----------+
  147.   F12: Begining of Line           |   GOLD   |Query Repl|  FNDNXT  |Del Ent L |
  148. G-F12: Delete Other Windows       |   (PF1)  |   (PF2)  |   (PF3)  |   (PF4)  |
  149.   F13: Delete to Begin of Word    |Mark Wisel|Other Wind|   FIND   |  UND L   |
  150.  HELP: Emacs Help                 +----------+----------+----------+----------+
  151.    DO: Execute extended command   |   PAGE   |Scroll Win|Open Line |  DEL W   |
  152.                                   |    (7)   |    (8)   |    (9)   |   (-)    |
  153.   C-a: Beginning of Line          |Ex Ext Cmd|Fill Parag|Elim Tabs |  UND W   |
  154.   C-b: Switch to Buffer           +----------+----------+----------+----------+
  155.   C-d: Delete Character           |  ADVANCE |  BACKUP  | CUT/COPY |  DEL C   |
  156.   C-e: End of Line                |    (4)   |    (5)   |    (6)   |   (,)    |
  157.   C-f: Forward Character          |   BOTTOM |    TOP   |   Yank   |  UND C   |
  158.   C-g: Keyboard Quit              +----------+----------+----------+----------+
  159. G-C-g: Keyboard Quit              | Fwd Word |    EOL   | Bwd Word |  Change  |
  160.   C-h: Electric Emacs Help        |    (1)   |    (2)   |    (3)   | Direction|
  161. G-C-h: Emacs Help                 | CHNGCASE |  DEL EOL |   COPY   |          |
  162.   C-i: Indent for Tab             +---------------------+----------+  (ENTER) |
  163.   C-j: Duplicate Word             |         LINE        |SELECT/RES|          |
  164.   C-k: Define Key                 |         (0)         |    (.)   |  Toggle  |
  165. G-C-k: Restore Key                |      Open Line      |Center Lin|Insrt/Over|
  166.   C-l: Learn                      +---------------------+----------+----------+
  167.   C-n: Set Screen Width 80       
  168.   C-o: Open Line                       +----------+----------+----------+
  169.   C-p: Fill Paragraph                  |  FNDNXT  |   Yank   |    CUT   |
  170.   C-q: Quoted Insert                   |  (FIND)) | (INSERT) | (REMOVE) |
  171.   C-r: Isearch Backward                |   FIND   |          |   COPY   |
  172.   C-s: Isearch Forward                 +----------+----------+----------+
  173.   C-t: Display the Time                |SELECT/RES|SECT BACKW|SECT FORWA|
  174.   C-u: Universal Argument              | (SELECT) |(PREVIOUS)|  (NEXT)  |
  175.   C-v: Redraw Display                  |          |          |          |
  176.   C-w: Set Screen Width 132            +----------+----------+----------+
  177.   C-z: Suspend Emacs
  178. G-C-\\: Split Window
  179.  
  180.   G-a: Append to Kill Buffer
  181.   G-b: Buffer Menu
  182.   G-c: Compile
  183.   G-d: Delete Window
  184.   G-e: Exit
  185.   G-f: Find File
  186.   G-g: Find File Other Window
  187.   G-h: Keypad Help
  188.   G-i: Insert File
  189.   G-k: Toggle Capitalization Word
  190.   G-l: Lowercase Word or Region
  191.   G-m: Save Some Buffers
  192.   G-n: Next Error
  193.   G-o: Switch Windows
  194.   G-q: Quit
  195.   G-r: Revert File
  196.   G-s: Save Buffer
  197.   G-u: Upcase Region
  198.   G-v: Find File Other Window
  199.   G-w: Write file
  200.   G-y: EDT Emulation OFF
  201.   G-z: Switch to Default EDT Key Bindings
  202.   G-1: Delete Other Windows
  203.   G-2: Split Window
  204.   G-%: Go to Percentage
  205.   G- : Undo  (GOLD Spacebar)
  206.   G-=: Go to Line
  207.   G-`: What line"
  208.  
  209.   (interactive)
  210.   (describe-function 'edt-user-keypad-help))
  211.  
  212. ;;;
  213. ;;; APOLLO USER EDT KEYPAD HELP
  214. ;;;
  215.  
  216. (defun edt-user-keypad-help ()
  217.   "
  218.                                 USER EDT Keypad Active
  219.  
  220.                                   +----------+----------+----------+----------+
  221.    F7: Copy Rectangle             |Prev Line |Next Line |Bkwd Char |Frwd Char |
  222.    F8: Cut Rect Overstrike        |   (UP)   |  (DOWN)  |  (LEFT)  | (RIGHT)  |
  223.  G-F8: Paste Rect Overstrike      |Window Top|Window Bot|Bkwd Sent |Frwd Sent |
  224.    F9: Cut Rect Insert            +----------+----------+----------+----------+
  225.  G-F9: Paste Rect Insert       
  226.   F11: ESC                            PF1        PF2        PF3        PF4
  227.                        +----------+----------+----------+----------+----------+
  228.                        |          |   GOLD   |Query Repl|  FNDNXT  |Del Ent L |
  229.                        |  (AGAIN) |  (READ)  |  (EDIT)  |  (EXIT)  |  (HOLD)  |
  230.                        |          |Mark Wisel|Other Wind|   FIND   |  UND L   |
  231.                        +----------+----------+----------+----------+----------+
  232.   F12: Begining of Line           +----------+----------+----------+----------+
  233. G-F12: Delete Other Windows       |   PAGE   |Scroll Win|Open Line |  DEL W   |
  234.   F13: Delete to Begin of Word    |    (7)   |    (8)   |    (9)   |   (+)    |
  235.  HELP: Emacs Help                 |Ex Ext Cmd|Fill Parag|Elim Tabs |  UND W   |
  236.    DO: Execute extended command   |----------+----------+----------+----------+
  237.                                   |  ADVANCE |  BACKUP  | CUT/COPY |  DEL C   |
  238.   C-a: Beginning of Line          |    (4)   |    (5)   |    (6)   |   (-)    |
  239.   C-b: Switch to Buffer           |   BOTTOM |    TOP   |   Yank   |  UND C   |
  240.   C-d: Delete Character           |----------+----------+----------+----------+
  241.   C-e: End of Line                | Fwd Word |    EOL   | Bwd Word |  Change  |
  242.   C-f: Forward Character          |    (1)   |    (2)   |    (3)   | Direction|
  243.   C-g: Keyboard Quit              | CHNGCASE |  DEL EOL |   COPY   |          |
  244. G-C-g: Keyboard Quit              |---------------------+----------+  (ENTER) |
  245.   C-h: Electric Emacs Help        |         LINE        |SELECT/RES|          |
  246. G-C-h: Emacs Help                 |         (0)         |    (.)   |  Toggle  |
  247.   C-i: Indent for Tab             |      Open Line      |Center Lin|Insrt/Over|
  248.   C-j: Duplicate Word             +---------------------+----------+----------+
  249.   C-k: Define Key
  250. G-C-k: Restore Key
  251.   C-l: Learn
  252.   C-n: Set Screen Width 80
  253.   C-o: Open Line
  254.   C-p: Fill Paragraph
  255.   C-q: Quoted Insert
  256.   C-r: Isearch Backward
  257.   C-s: Isearch Forward
  258.   C-t: Display the Time
  259.   C-u: Universal Argument
  260.   C-v: Redraw Display
  261.   C-w: Set Screen Width 132
  262.   C-z: Suspend Emacs
  263. G-C-\\: Split Window
  264.  
  265.   G-a: Append to Kill Buffer
  266.   G-b: Buffer Menu
  267.   G-c: Compile
  268.   G-d: Delete Window
  269.   G-e: Exit
  270.   G-f: Find File
  271.   G-g: Find File Other Window
  272.   G-h: Keypad Help
  273.   G-i: Insert File
  274.   G-k: Toggle Capitalization Word
  275.   G-l: Lowercase Word or Region
  276.   G-m: Save Some Buffers
  277.   G-n: Next Error
  278.   G-o: Switch Windows
  279.   G-q: Quit
  280.   G-r: Revert File
  281.   G-s: Save Buffer
  282.   G-u: Uppercase Word or Region
  283.   G-v: Find File Other Window
  284.   G-w: Write file
  285.   G-y: EDT Emulation OFF
  286.   G-z: Switch to Default EDT Key
  287.   G-1: Delete Other Windows
  288.   G-2: Split Window
  289.   G-%: Go to Percentage
  290.   G- : Undo  (GOLD Spacebar)
  291.   G-=: Go to Line
  292.   G-`: What line"
  293.  
  294.   (interactive)
  295.   (describe-function 'edt-user-keypad-help))
  296. )
  297.  
  298. (if (or (string-equal "apollo" edt-term)
  299.         (string-equal "apollo_1280_bw" edt-term))
  300. ;;;
  301. ;;; USER CUSTOMIZATION OF DEFAULT EMACS BINDINGS
  302. ;;;
  303.  
  304. ;; Use the Apollo mouse functions defined in edt-apollo.el.  (Since we have
  305. ;; NOT written an edt-bind-apollo-mouse-button function, user customization of
  306. ;; the mouse buttons to the edt-apollo.el functions can only be done here.)
  307.  
  308. (defun edt-user-customize-default-emacs-bindings ()
  309.   "Change some emacs defaults before EDT emulation initialization."
  310.   ;; Change the default Apollo mouse bindings
  311.   (bind-apollo-mouse-button "M1D" 'edt-apollo-mouse-mark)    ;MOUSE LEFT DOWN
  312.   (bind-apollo-mouse-button "M1U" 'edt-apollo-mouse-copy)    ;MOUSE LEFT UP
  313.   (bind-apollo-mouse-button "M2D" 'edt-apollo-mouse-mark)    ;MOUSE MIDDLE DOWN
  314.   (bind-apollo-mouse-button "M2U" 'edt-apollo-mouse-cut)     ;MOUSE MIDDLE UP
  315.   (bind-apollo-mouse-button "M3D" 'edt-apollo-mouse-mark)    ;MOUSE RIGHT DOWN
  316.   (bind-apollo-mouse-button "M3U" 'edt-apollo-mouse-paste)   ;MOUSE RIGHT UP
  317.   ;; I like to read man pages within Emacs.
  318.   (bind-apollo-function-key "R6S" 'manual-entry)             ;HELP
  319.   )
  320. )
  321.