Changeset 8738


Ignore:
Timestamp:
03/07/05 03:34:53 (16 years ago)
Author:
piso
Message:

Work in progress.

Location:
trunk/j/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/emacs.lisp

    r8733 r8738  
    22;;;
    33;;; Copyright (C) 2005 Peter Graves
    4 ;;; $Id: emacs.lisp,v 1.10 2005-03-06 21:28:19 piso Exp $
     4;;; $Id: emacs.lisp,v 1.11 2005-03-07 03:34:53 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    2020(in-package #:j)
    2121
    22 (export '(java-mode-map lisp-mode-map))
     22(export '(emacs-mode java-mode-map lisp-mode-map))
    2323
    2424(defpackage #:emacs
     
    3535    (define-key map (first mapping) (second mapping))))
    3636
    37 (defparameter *global-map* (make-keymap))
     37(defparameter *emacs-global-map* (make-keymap))
    3838(defparameter *esc-map* (make-keymap))
    3939(defparameter *control-x-map* (make-keymap))
     
    4141(defparameter *java-mode-map* (make-keymap))
    4242
    43 (define-key *global-map* "Escape" *esc-map*)
    44 (define-key *global-map* "Ctrl X" *control-x-map*)
    45 (define-key *global-map* "Ctrl H" *help-map*)
     43(define-key *emacs-global-map* "Escape" *esc-map*)
     44(define-key *emacs-global-map* "Ctrl X" *control-x-map*)
     45(define-key *emacs-global-map* "Ctrl H" *help-map*)
    4646
    4747;; // File menu.
     
    6161;; mapKey(KeyEvent.VK_P, ALT_MASK, "properties");
    6262;; mapKey(KeyEvent.VK_N, CTRL_MASK | SHIFT_MASK, "newFrame");
    63 (define-key *global-map* "Alt X" "executeCommand")
     63(define-key *emacs-global-map* "Alt X" "executeCommand")
    6464(define-key *esc-map* #\x "executecommand")
    6565;; mapKey(KeyEvent.VK_P, CTRL_MASK, "print");
     
    6767(define-key *control-x-map* "Ctrl C" "saveAllExit")
    6868
    69 (define-key *global-map* "Ctrl Space" #'set-mark-command)
    70 (define-key *global-map* "Ctrl Shift 2" #'set-mark-command) ; C-@
     69(define-key *emacs-global-map* "Ctrl Space" #'set-mark-command)
     70(define-key *emacs-global-map* "Ctrl Shift 2" #'set-mark-command) ; C-@
    7171
    7272;; // Edit menu.
    73 (define-keys *global-map*
     73(define-keys *emacs-global-map*
    7474  `(("Ctrl /"                   "undo")
    7575    ("Ctrl Shift 0x2d"          "undo") ; C-_
     
    9595;; mapKey(KeyEvent.VK_M, CTRL_MASK | SHIFT_MASK, "selectSyntax");
    9696
    97 (define-keys *global-map*
     97(define-keys *emacs-global-map*
    9898  '(("Ctrl Alt Up"              "findFirstOccurrence")
    9999    ("Ctrl Alt NumPad Up"       "findFirstOccurrence")
     
    105105;; mapKey(KeyEvent.VK_N, CTRL_MASK | ALT_MASK, "nextChange");
    106106;; mapKey(KeyEvent.VK_P, CTRL_MASK | ALT_MASK, "previousChange");
    107 (define-key *global-map* "F5" "pushPosition")
    108 (define-key *global-map* "Shift F5" "popPosition")
     107(define-key *emacs-global-map* "F5" "pushPosition")
     108(define-key *emacs-global-map* "Shift F5" "popPosition")
    109109
    110110;; // Search menu.
    111 (define-keys *global-map*
     111(define-keys *emacs-global-map*
    112112  '(("Ctrl S"                   "incrementalFind")
    113113    ("Alt F3"                   "find")
     
    123123;; Emacs uses Ctrl Alt L for reposition-window
    124124;; XEmacs uses Ctrl Alt L for switch-to-other-buffer
    125 (define-key *global-map* "Ctrl Alt L" "listOccurrencesOfPatternAtDot")
     125(define-key *emacs-global-map* "Ctrl Alt L" "listOccurrencesOfPatternAtDot")
    126126
    127127;; mapKey(KeyEvent.VK_K, CTRL_MASK, "killLine");
    128 (define-key *global-map* "Ctrl K" "killLine")
     128(define-key *emacs-global-map* "Ctrl K" "killLine")
    129129;; mapKey(KeyEvent.VK_DELETE, CTRL_MASK, "deleteWordRight");
    130 (define-key *global-map* "Ctrl Delete" "deleteWordRight")
    131 
    132 (define-keys *global-map*
     130(define-key *emacs-global-map* "Ctrl Delete" "deleteWordRight")
     131
     132(define-keys *emacs-global-map*
    133133  '(("Home"                     "home")
    134134    ("Ctrl A"                   "home")
     
    183183
    184184;; Emacs uses Ctrl Up for backward-paragraph, which j doesn't have.
    185 (define-keys *global-map*
     185(define-keys *emacs-global-map*
    186186  '(("Ctrl Up"                  "windowUp")
    187187    ("Ctrl NumPad Up"           "windowUp")))
    188188;; Emacs uses Ctrl Down for forward-paragraph, which j doesn't have.
    189 (define-keys *global-map*
     189(define-keys *emacs-global-map*
    190190  '(("Ctrl Down"                "windowDown")
    191191    ("Ctrl NumPad Down"         "windowDown")))
    192192
    193193;; Emacs uses Alt Left for backward-word, which is also on Alt B and Ctrl Left.
    194 (define-keys *global-map*
     194(define-keys *emacs-global-map*
    195195  '(("Alt Left"                 "prevBuffer")
    196196    ("Alt NumPad Left"          "prevBuffer")))
    197197;; Emacs uses Alt Right for forward-word, which is also on Alt F and Ctrl Right.
    198 (define-keys *global-map*
     198(define-keys *emacs-global-map*
    199199  '(("Alt Right"                "nextBuffer")
    200200    ("Alt NumPad Right"         "nextBuffer")))
     
    207207;; mapKey(KeyEvent.VK_PAGE_DOWN, CTRL_MASK, "bottom");
    208208;; mapKey(KeyEvent.VK_DELETE, 0, "delete");
    209 (define-keys *global-map*
     209(define-keys *emacs-global-map*
    210210  '(("Delete"                   "delete")
    211211    ("Ctrl D"                   "delete")
     
    218218
    219219;; keyboard-quit
    220 (define-key *global-map* "Ctrl G" "escape")
     220(define-key *emacs-global-map* "Ctrl G" "escape")
    221221
    222222;; mapKey(KeyEvent.VK_G, CTRL_MASK | SHIFT_MASK, "gotoFile");
     
    224224
    225225;; mapKey(KeyEvent.VK_D, CTRL_MASK, "dir");
     226(define-key *control-x-map* #\d "dir")
    226227
    227228;; mapKey(KeyEvent.VK_F2, SHIFT_MASK, "stamp");
     
    260261
    261262;; mapKey(KeyEvent.VK_F11, 0, "commentRegion");
    262 (define-key *global-map* "F11" "commentRegion")
     263(define-key *emacs-global-map* "F11" "commentRegion")
    263264;; mapKey(KeyEvent.VK_F11, SHIFT_MASK, "uncommentRegion");
    264 (define-key *global-map* "Shift F11" "uncommentRegion")
     265(define-key *emacs-global-map* "Shift F11" "uncommentRegion")
    265266
    266267;; // Duplicate mappings to support IBM 1.3 for Linux.
     
    269270
    270271;; mapKey(KeyEvent.VK_F12, 0, "wrapParagraph");
    271 (define-key *global-map* "F12" "wrapParagraph")
     272(define-key *emacs-global-map* "F12" "wrapParagraph")
    272273;; mapKey(KeyEvent.VK_F12, SHIFT_MASK, "unwrapParagraph");
    273 (define-key *global-map* "Shift F12" "unwrapParagraph")
     274(define-key *emacs-global-map* "Shift F12" "unwrapParagraph")
    274275;; mapKey(KeyEvent.VK_F12, CTRL_MASK, "toggleWrap");
    275 (define-key *global-map* "Ctrl F12" "toggleWrap")
     276(define-key *emacs-global-map* "Ctrl F12" "toggleWrap")
    276277
    277278;; // Duplicate mappings to support IBM 1.3 for Linux.
     
    283284
    284285;; mapKey(KeyEvent.VK_SLASH, ALT_MASK, "expand");
    285 (define-key *global-map* "Alt /" "expand")
     286(define-key *emacs-global-map* "Alt /" "expand")
    286287
    287288;; // On Windows, Alt Space drops down the window menu.
     
    294295
    295296;; mapKey(VK_MOUSE_1, 0, "mouseMoveDotToPoint");
    296 (define-key *global-map* "Mouse-1" "mouseMoveDotToPoint")
     297(define-key *emacs-global-map* "Mouse-1" "mouseMoveDotToPoint")
    297298;; mapKey(VK_MOUSE_1, SHIFT_MASK, "mouseSelect");
    298299;; mapKey(VK_MOUSE_1, CTRL_MASK | SHIFT_MASK, "mouseSelectColumn");
    299300;; mapKey(VK_DOUBLE_MOUSE_1, 0, "selectWord");
    300 (define-key *global-map* "Double Mouse-1" "selectWord")
     301(define-key *emacs-global-map* "Double Mouse-1" "selectWord")
    301302
    302303;; if (Platform.isPlatformUnix()) {
     
    329330;; mapKey(KeyEvent.VK_F4, 0, "nextError");
    330331(define-key *control-x-map* "`" "nextError")
    331 (define-key *global-map* "F4" "nextError")
     332(define-key *emacs-global-map* "F4" "nextError")
    332333;; mapKey(KeyEvent.VK_F4, SHIFT_MASK, "previousError");
    333 (define-key *global-map* "Shift F4" "previousError")
     334(define-key *emacs-global-map* "Shift F4" "previousError")
    334335;; mapKey(KeyEvent.VK_M, CTRL_MASK | ALT_MASK, "showMessage");
    335 (define-key *global-map* "Ctrl Alt M" "showMessage")
     336(define-key *emacs-global-map* "Ctrl Alt M" "showMessage")
    336337
    337338;; // Windows VM seems to need this mapping for the tab key to work properly.
     
    351352;; }
    352353
    353 (define-key *global-map* "Alt ." "findTagAtDot")
     354(define-key *emacs-global-map* "Alt ." "findTagAtDot")
    354355
    355356;; Help.
     
    419420
    420421
    421 (defun emacs ()
    422   (use-global-map *global-map*)
    423   ;; FIXME This is the right idea (so mappings like Alt F will be possible),
    424   ;; but it doesn't quite work.
    425   (set-global-property "useMenuMnemonics" "false")
    426   (j::%execute-command "reloadKeyMaps"))
     422(defun emacs-mode (&optional (arg t))
     423  (cond (arg
     424         ;; FIXME This is the right idea (so mappings like Alt F will be
     425         ;; possible), but it doesn't work.
     426         (set-global-property "useMenuMnemonics" "false")
     427         (set-global-property "emulation" "emacs")
     428         (use-global-map *emacs-global-map*)
     429         (j::%execute-command "reloadKeyMaps"))
     430        ((null arg)
     431         (set-global-property "useMenuMnemonics" "false")
     432         (set-global-property "emulation" nil)
     433         (j::%execute-command "defaultKeyMaps"))))
    427434
    428435(defun java-mode-map ()
  • trunk/j/src/org/armedbear/lisp/j.lisp

    r8688 r8738  
    22;;;
    33;;; Copyright (C) 2003-2005 Peter Graves
    4 ;;; $Id: j.lisp,v 1.42 2005-03-03 14:09:31 piso Exp $
     4;;; $Id: j.lisp,v 1.43 2005-03-07 03:34:05 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    4545          delete-region
    4646          editor-buffer
    47           emacs
     47          emacs-mode
    4848          end-of-line
    4949          execute-command
     
    8989          search-backward
    9090          search-forward
    91           set-global-property
    9291          set-mark
    9392          status
     
    102101          with-single-undo))
    103102
    104 (autoload 'emacs)
    105 
    106 (defun set-global-property (&rest args)
    107   (let ((count (length args)) key value)
    108     (cond ((oddp count)
    109            (error "odd number of arguments to SET-GLOBAL-PROPERTY"))
    110           ((= count 2)
    111            (%set-global-property (string (first args)) (second args)))
    112           (t
    113            (do ((args args (cddr args)))
    114                ((null args) (values))
    115              (%set-global-property (string (first args)) (second args)))))))
     103(autoload 'emacs-mode "emacs")
    116104
    117105(defun reset-display ()
Note: See TracChangeset for help on using the changeset viewer.