home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / may94 / util / edit / jade.lha / Jade / lisp / loadkeys.jl < prev    next >
Lisp/Scheme  |  1994-04-16  |  8KB  |  177 lines

  1. ;;;; loadkeys.jl -- Set up standard keybindings
  2. ;;;  Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
  3.  
  4. ;;; This file is part of Jade.
  5.  
  6. ;;; Jade is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 2, or (at your option)
  9. ;;; any later version.
  10.  
  11. ;;; Jade is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;;; GNU General Public License for more details.
  15.  
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with Jade; see the file COPYING.  If not, write to
  18. ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. (setq
  21.   global-keymap (make-keytab)
  22.   ctrl-x-keymap (make-keytab)
  23.   ctrl-x-4-keymap (make-keylist)
  24.   esc-keymap (make-keytab)
  25.   ctrl-c-keymap nil
  26.   unbound-key-hook nil
  27.   keymap-path (cons global-keymap nil)
  28.   close-gadget-hook (cons 'close-window nil))
  29.  
  30. (set-buffer-variable 'keymap-path)
  31. (set-buffer-variable 'buffer-keymap)
  32. (set-buffer-variable 'ctrl-c-keymap)
  33. (set-buffer-variable 'unbound-key-hook)
  34.  
  35. (setq
  36.   mark-1 (make-mark)
  37.   mark-2 (make-mark)
  38.   mark-3 (make-mark))
  39.  
  40. (bind-keys global-keymap
  41.   "up"                'goto-prev-line
  42.   "down"              'goto-next-line
  43.   "left"              'goto-left-char
  44.   "right"             'goto-right-char
  45.   "shift-up"          '(progn (set-auto-mark) (goto (pos nil 1)))
  46.   "shift-down"        '(progn (set-auto-mark) (goto (pos nil (file-length))))
  47.   "shift-left"        'goto-line-start
  48.   "shift-right"       'goto-line-end
  49.   "ctrl-up"           'prev-screen
  50.   "ctrl-down"         'next-screen
  51.   "ctrl-left"         '(goto (left-char 40))
  52.   "ctrl-right"        '(goto (right-char 40))
  53.   "meta-left"         '(goto (backward-word))
  54.   "meta-right"        '(goto (forward-word))
  55.   "meta-up"           '(goto (prev-paragraph))
  56.   "meta-down"         '(goto (next-paragraph))
  57.   "ctrl-tab"          '(insert "\t")
  58.   "shift-tab"         'goto-prev-tab
  59.   "tab"               'goto-next-tab
  60.   "return"            'split-line
  61.   "backspace"         '(delete-area (prev-char) (cursor-pos))
  62.   "del"               '(delete-area (cursor-pos) (next-char))
  63.   "shift-backspace"   '(write-clip 0 (cut-area (line-start) (cursor-pos)))
  64.   "shift-del"         '(write-clip 0 (cut-area (cursor-pos) (line-end)))
  65.   "ctrl-del"          '(write-clip 0 (cut-area (line-start) (line-start (next-line))))
  66.   "ctrl-@"            'set-auto-mark
  67.   "ctrl-a"            'goto-line-start
  68.   "ctrl-b"            'goto-prev-char
  69.   "ctrl-c"            '(setq next-keymap-path '(ctrl-c-keymap))
  70.   "ctrl-d"            '(delete-area (cursor-pos) (next-char))
  71.   "ctrl-e"            'goto-line-end
  72.   "ctrl-f"            'goto-next-char
  73.   "ctrl-h"            'help
  74.   "ctrl-i"            'insert-block
  75.   "ctrl-j"            'goto-line
  76.   "ctrl-k"            'kill-line
  77.   "ctrl-m"            'block-toggle
  78.   "ctrl-M"            'toggle-rect-blocks
  79.   "meta-m"            '(block-start (cursor-pos))
  80.   "meta-M"            '(block-end (cursor-pos))
  81.   "ctrl-n"            'goto-next-line
  82.   "ctrl-o"            '(progn (split-line) (goto (prev-char)))
  83.   "ctrl-p"            'goto-prev-line
  84.   "ctrl-r"            '(search-backward nil)
  85.   "ctrl-R"            '(search-backward t)
  86.   "ctrl-s"            '(search-forward nil)
  87.   "ctrl-S"            '(search-forward t)
  88.   "ctrl-u"            'add-command-arg
  89.   "ctrl-U"            'clear-command-args
  90.   "ctrl-v"            'next-screen
  91.   "ctrl-w"            '(write-clip 0 (cut-block))
  92.   "ctrl-x"            '(setq next-keymap-path '(ctrl-x-keymap))
  93.   "ctrl-y"            '(insert (read-clip 0))
  94.   "ctrl-Y"            '(insert-rect (read-clip 0))
  95.   "ctrl-z"            'delete-block
  96.   "ctrl-."            'rotate-buffers-forward
  97.   "ctrl-,"            'rotate-buffers-backward
  98.   "ctrl-space"        'mark-region
  99.   "ctrl-]"            'abort-recursive-edit
  100.   "escape"            '(setq next-keymap-path '(esc-keymap))
  101.   "help"              'help
  102.   "F1"                '(goto-mark mark-1)
  103.   "F2"                '(goto-mark mark-2)
  104.   "F3"                '(goto-mark mark-3)
  105.   "shift-F1"          '(set-mark mark-1 (cursor-pos) (current-buffer))
  106.   "shift-F2"          '(set-mark mark-2 (cursor-pos) (current-buffer))
  107.   "shift-F3"          '(set-mark mark-3 (cursor-pos) (current-buffer))
  108.   "lmb-click1"        '(goto (mouse-pos))
  109.   "lmb-click2"        'block-toggle
  110.   "lmb-move"          '(goto (mouse-pos))
  111.   "rmb-click1"        '(if (window-asleep-p) (unsleep-window) (sleep-window))
  112.   "shift-lmb-click1"  'block-kill
  113. )
  114. (bind-keys ctrl-x-keymap
  115.   "ctrl-c"            'save-and-quit
  116.   "ctrl-f"            'find-file
  117.   "ctrl-l"            'downcase-block
  118.   "ctrl-r"            'find-file-read-only
  119.   "ctrl-s"            'save-file
  120.   "ctrl-u"            'upcase-block
  121.   "ctrl-v"            'find-alternate-file
  122.   "ctrl-w"            'save-file-as
  123.   "ctrl-x"            'swap-cursor-and-auto-mark
  124.   "0"                 'close-window
  125.   "1"                 'close-other-windows
  126.   "2"                 'open-window
  127.   "4"                 '(setq next-keymap-path '(ctrl-x-4-keymap))
  128.   "5"                 'open-window
  129.   "b"                 'switch-to-buffer
  130.   "h"                 '(progn (block-kill) (block-start (file-start)) (block-end (file-end)))
  131.   "i"                 'insert-file
  132.   "k"                 'kill-buffer
  133.   "o"                 '(set-current-window (next-window) t)
  134.   "q"                 '(set-buffer-read-only nil (not (buffer-read-only-p)))
  135.   "s"                 'save-some-buffers
  136.   "`"                 'next-error
  137. )
  138. (bind-keys ctrl-x-4-keymap
  139.   "ctrl-f"            '(in-other-window (find-file))
  140.   "a"                 '(in-other-window (add-change-log-entry))
  141.   "b"                 '(in-other-window (switch-to-buffer))
  142.   "f"                 '(in-other-window (find-file))
  143.   "h"                 '(in-other-window (help) (help-help))
  144.   "i"                 '(in-other-window (info))
  145.   "`"                 '(in-other-window (next-error))
  146. )
  147. (bind-keys esc-keymap
  148.   "escape"            '(prin1 (eval (read (cons 0 (prompt "Eval: ")))) t)
  149.   "ctrl-c"            '(throw 'exit nil)
  150.   "!"                 '(system (prompt "System: "))
  151.   "<"                 '(progn (set-auto-mark) (goto-file-start))
  152.   ">"                 '(progn (set-auto-mark) (goto-file-end))
  153.   "@"                 'mark-word
  154.   "a"                 'add-change-log-entry
  155.   "b"                 '(goto (backward-word))
  156.   "d"                 '(write-clip 0 (cut-area (cursor-pos) (forward-word)))
  157.   "f"                 '(goto (forward-word))
  158.   "h"                 'mark-paragraph
  159.   "i"                 '(insert "\t")
  160.   "l"                 'downcase-word
  161.   "m"                 '(goto (indent-pos))
  162.   "n"                 '(progn (set-auto-mark) (goto (match-brackets)))
  163.   "p"                 '(simple-replace nil)
  164.   "P"                 '(simple-replace t)
  165.   "u"                 'upcase-word
  166.   "v"                 'prev-screen
  167.   "w"                 '(write-clip 0 (copy-block))
  168.   "x"                 'command-prompt
  169.   "["                 '(goto (prev-paragraph))
  170.   "]"                 '(goto (next-paragraph))
  171.   "~"                 '(set-buffer-modified nil nil)
  172.   "tab"               'goto-next-tab
  173.   "delete"            '(write-clip 0 (cut-area (cursor-pos) (forward-word)))
  174.   "backspace"         '(write-clip 0 (cut-area (backward-word) (cursor-pos)))
  175.   "help"              '(if (window-asleep-p) (unsleep-window) (sleep-window))
  176. )
  177.