source: trunk/j/src/org/armedbear/lisp/emacs.lisp @ 8718

Last change on this file since 8718 was 8718, checked in by piso, 16 years ago

Work in progress.

File size: 20.1 KB
Line 
1;;; emacs.lisp
2;;;
3;;; Copyright (C) 2005 Peter Graves
4;;; $Id: emacs.lisp,v 1.8 2005-03-06 04:38:25 piso Exp $
5;;;
6;;; This program is free software; you can redistribute it and/or
7;;; modify it under the terms of the GNU General Public License
8;;; as published by the Free Software Foundation; either version 2
9;;; of the License, or (at your option) any later version.
10;;;
11;;; This program is distributed in the hope that it will be useful,
12;;; but 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 this program; if not, write to the Free Software
18;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20(in-package #:j)
21
22(export '(java-mode-map lisp-mode-map))
23
24(defpackage #:emacs
25  (:use #:cl #:ext #:j))
26
27(in-package #:emacs)
28
29(defun set-mark-command ()
30  (setf (buffer-mark (current-buffer)) (current-point))
31  (status "Mark set"))
32
33(defun define-keys (map mappings)
34  (dolist (mapping mappings)
35    (define-key map (first mapping) (second mapping))))
36
37(defparameter *global-map* (make-keymap))
38(defparameter *esc-map* (make-keymap))
39(defparameter *control-x-map* (make-keymap))
40(defparameter *help-map* (make-keymap))
41(defparameter *java-mode-map* (make-keymap))
42(defparameter *lisp-mode-map* (make-keymap))
43
44(define-key *global-map* "Escape" *esc-map*)
45(define-key *global-map* "Ctrl X" *control-x-map*)
46(define-key *global-map* "Ctrl H" *help-map*)
47
48;; // File menu.
49;; mapKey(KeyEvent.VK_O, CTRL_MASK, "openFile");
50(define-key *control-x-map* "Ctrl F" "openFile")
51;; mapKey(KeyEvent.VK_O, CTRL_MASK | ALT_MASK, "openFileInOtherWindow");
52;; mapKey(KeyEvent.VK_O, CTRL_MASK | SHIFT_MASK, "openFileInOtherFrame");
53;; mapKey(KeyEvent.VK_N, CTRL_MASK, "newBuffer");
54;; mapKey(KeyEvent.VK_R, ALT_MASK, "recentFiles");
55;; mapKey(KeyEvent.VK_S, CTRL_MASK, "save");
56(define-key *control-x-map* "Ctrl S" "save")
57;; mapKey(KeyEvent.VK_S, CTRL_MASK | SHIFT_MASK, "saveAs");
58;; mapKey(KeyEvent.VK_S, CTRL_MASK | ALT_MASK, "saveCopy");
59;; mapKey(KeyEvent.VK_F2, 0, "saveAll");
60;; mapKey(KeyEvent.VK_F4, CTRL_MASK, "killBuffer");
61;; mapKey(KeyEvent.VK_W, CTRL_MASK, "killBuffer");
62(define-key *control-x-map* "k" "killBuffer")
63;; mapKey(KeyEvent.VK_P, ALT_MASK, "properties");
64;; mapKey(KeyEvent.VK_N, CTRL_MASK | SHIFT_MASK, "newFrame");
65;; mapKey(KeyEvent.VK_X, ALT_MASK, "executeCommand");
66(define-key *global-map* "Alt X" "executeCommand")
67(define-key *esc-map* #\x "executecommand")
68;; mapKey(KeyEvent.VK_P, CTRL_MASK, "print");
69;; mapKey(KeyEvent.VK_Q, CTRL_MASK | SHIFT_MASK, "saveAllExit");
70(define-key *control-x-map* "Ctrl C" "saveAllExit")
71;; mapKey(KeyEvent.VK_Q, CTRL_MASK, "quit");
72
73;; // Edit menu.
74(define-key *global-map* "Ctrl Space" #'set-mark-command)
75;; mapKey(KeyEvent.VK_BACK_SPACE, ALT_MASK, "undo");
76;; mapKey(KeyEvent.VK_Z, CTRL_MASK, "undo");
77(define-key *control-x-map* "u" "undo")
78;; mapKey(KeyEvent.VK_Y, CTRL_MASK, "redo");
79;; mapKey(KeyEvent.VK_DELETE, SHIFT_MASK, "killRegion");
80;; mapKey(KeyEvent.VK_X, CTRL_MASK, "killRegion");
81(define-key *global-map* "Ctrl W" "killRegion")
82;; mapKey(KeyEvent.VK_X, CTRL_MASK | SHIFT_MASK, "killAppend");
83;; mapKey(KeyEvent.VK_C, CTRL_MASK, "copyRegion");
84(define-key *global-map* "Alt W" "copyRegion")
85;; mapKey(KeyEvent.VK_C, CTRL_MASK | SHIFT_MASK, "copyAppend");
86;; mapKey(KeyEvent.VK_V, CTRL_MASK, "paste");
87(define-key *global-map* "Ctrl Y" "paste")
88;; mapKey(KeyEvent.VK_V, CTRL_MASK | SHIFT_MASK, "cyclePaste");
89(define-key *global-map* "Alt Y" "cyclePaste")
90(define-key *esc-map* #\y "cyclePaste")
91;; mapKey(KeyEvent.VK_T, ALT_MASK, "cycleTabWidth");
92
93;; // Goto menu.
94;; mapKey(KeyEvent.VK_J, CTRL_MASK, "jumpToLine");
95;; mapKey(KeyEvent.VK_J, CTRL_MASK | SHIFT_MASK, "jumpToColumn");
96;; mapKey(KeyEvent.VK_M, CTRL_MASK, "findMatchingChar");
97;; mapKey(KeyEvent.VK_M, CTRL_MASK | SHIFT_MASK, "selectSyntax");
98;; mapKey(KeyEvent.VK_UP, CTRL_MASK | ALT_MASK, "findFirstOccurrence");
99(define-key *global-map* "Ctrl Alt Up" "findFirstOccurrence")
100;; mapKey(KeyEvent.VK_KP_UP, CTRL_MASK | ALT_MASK, "findFirstOccurrence");
101(define-key *global-map* "Ctrl Alt NumPad Up" "findFirstOccurrence")
102;; mapKey(KeyEvent.VK_UP, ALT_MASK, "findPrevWord");
103(define-key *global-map* "Alt Up" "findPrevWord")
104;; mapKey(KeyEvent.VK_KP_UP, ALT_MASK, "findPrevWord");
105(define-key *global-map* "Alt NumPad Up" "findPrevWord")
106;; mapKey(KeyEvent.VK_DOWN, ALT_MASK, "findNextWord");
107(define-key *global-map* "Alt Down" "findNextWord")
108;; mapKey(KeyEvent.VK_KP_DOWN, ALT_MASK, "findNextWord");
109(define-key *global-map* "Alt NumPad Down" "findNextWord")
110;; mapKey(KeyEvent.VK_N, CTRL_MASK | ALT_MASK, "nextChange");
111;; mapKey(KeyEvent.VK_P, CTRL_MASK | ALT_MASK, "previousChange");
112;; mapKey(KeyEvent.VK_F5, 0, "pushPosition");
113(define-key *global-map* "F5" "pushPosition")
114;; mapKey(KeyEvent.VK_F5, SHIFT_MASK, "popPosition");
115(define-key *global-map* "Shift F5" "popPosition")
116
117;; // Search menu.
118;; if (Editor.preferences().getBooleanProperty(Property.USE_INCREMENTAL_FIND))
119;; mapKey(KeyEvent.VK_F, CTRL_MASK, "incrementalFind");
120(define-key *global-map* "Ctrl S" "incrementalFind")
121;; else
122;; mapKey(KeyEvent.VK_F, CTRL_MASK, "find");
123(define-key *global-map* "Alt F3" "find")
124
125;; Emacs uses Ctrl Alt L for reposition-window
126;; XEmacs uses Ctrl Alt L for switch-to-other-buffer
127(define-key *global-map* "Ctrl Alt L" "listOccurrencesOfPatternAtDot")
128
129(define-key *global-map* "F3" "findNext")
130(define-key *global-map* "Shift F3" "findPrev")
131(define-key *global-map* "F6" "findInFiles")
132(define-key *global-map* "Ctrl Shift F" "findInFiles")
133(define-key *global-map* "Ctrl F3" "listOccurrences")
134(define-key *global-map* "Ctrl Shift L" "listFiles")
135(define-key *global-map* "Shift Alt 5" "replace") ; M-%
136(define-key *global-map* "Ctrl Shift R" "replaceInFiles")
137
138;; mapKey(KeyEvent.VK_K, CTRL_MASK, "killLine");
139(define-key *global-map* "Ctrl K" "killLine")
140;; mapKey(KeyEvent.VK_DELETE, CTRL_MASK, "deleteWordRight");
141(define-key *global-map* "Ctrl Delete" "deleteWordRight")
142
143(define-keys *global-map*
144  '(("Home"                     "home")
145    ("Ctrl A"                   "home")
146    ("End"                      "end");
147    ("Ctrl E"                   "end");
148    ("Shift Home"               "selectHome")
149    ("Shift End"                "selectEnd")
150    ("Ctrl Home"                "bob")
151    ("Ctrl Shift Home"          "selectBob")
152    ("Ctrl End"                 "eob")
153    ("Ctrl Shift End"           "selectEob")
154    ("Ctrl P"                   "up")
155    ("Up"                       "up")
156    ("NumPad Up"                "up")
157    ("Ctrl N"                   "down")
158    ("Down"                     "down")
159    ("NumPad Down"              "down")
160    ("Shift Up"                 "selectUp")
161    ("Shift NumPad Up"          "selectUp")
162    ("Shift Down"               "selectDown")
163    ("Shift NumPad Down"        "selectDown")
164    ("Ctrl B"                   "left")
165    ("Left"                     "left")
166    ("NumPad Left"              "left")
167    ("Ctrl F"                   "right")
168    ("Right"                    "right")
169    ("NumPad Right"             "right")
170    ("Shift Left"               "selectLeft")
171    ("Shift NumPad Left"        "selectLeft")
172    ("Shift Right"              "selectRight")
173    ("Shift NumPad Right"       "selectRight")
174    ("Alt B"                    "wordLeft")
175    ("Ctrl Left"                "wordLeft")
176    ("Ctrl NumPad Left"         "wordLeft")
177    ("Ctrl Right"               "wordRight")
178    ("Ctrl NumPad Right"        "wordRight")
179    ("Ctrl Shift Left"          "selectWordLeft")
180    ("Ctrl Shift NumPad Left"   "selectWordLeft")
181    ("Ctrl Shift Right"         "selectWordRight")
182    ("Ctrl Shift NumPad Right"  "selectWordRight")
183    ("Alt V"                    "pageUp")
184    ("Page Up"                  "pageUp")
185    ("Ctrl V"                   "pageDown")
186    ("Page Down"                "pageDown")))
187
188(define-keys *esc-map*
189  '((#\< "bob")
190    (#\> "eob")
191    (#\. "findTagAtDot")
192    (#\% "replace")
193    ))
194
195;; Emacs uses Ctrl Up for backward-paragraph, which j doesn't have.
196(define-keys *global-map*
197  '(("Ctrl Up"          "windowUp")
198    ("Ctrl NumPad Up"   "windowUp")))
199;; Emacs uses Ctrl Down for forward-paragraph, which j doesn't have.
200(define-keys *global-map*
201  '(("Ctrl Down"        "windowDown")
202    ("Ctrl NumPad Down" "windowDown")))
203
204;; Emacs uses Alt Left for backward-word, which is also on Alt B and Ctrl Left.
205(define-keys *global-map*
206  '(("Alt Left" "prevBuffer")
207    ("Alt NumPad Left" "prevBuffer")))
208;; Emacs uses Alt Right for forward-word, which is also on Alt F and Ctrl Right.
209(define-keys *global-map*
210  '(("Alt Right" "nextBuffer")
211    ("Alt NumPad Right" "nextBuffer")))
212
213;; mapKey(KeyEvent.VK_PAGE_UP, ALT_MASK, "pageUpOtherWindow");
214;; mapKey(KeyEvent.VK_PAGE_UP, SHIFT_MASK, "selectPageUp");
215;; mapKey(KeyEvent.VK_PAGE_DOWN, ALT_MASK, "pageDownOtherWindow");
216;; mapKey(KeyEvent.VK_PAGE_DOWN, SHIFT_MASK, "selectPageDown");
217;; mapKey(KeyEvent.VK_PAGE_UP, CTRL_MASK, "top");
218;; mapKey(KeyEvent.VK_PAGE_DOWN, CTRL_MASK, "bottom");
219;; mapKey(KeyEvent.VK_DELETE, 0, "delete");
220(define-key *global-map* "Delete" "delete")
221(define-key *global-map* "Ctrl D" "delete")
222;; mapKey(KeyEvent.VK_BACK_SPACE, 0, "backspace");
223(define-key *global-map* "Backspace" "backspace")
224;; mapKey(KeyEvent.VK_BACK_SPACE, SHIFT_MASK, "backspace");
225(define-key *global-map* "Shift Backspace" "backspace")
226;; mapKey(KeyEvent.VK_BACK_SPACE, CTRL_MASK, "deleteWordLeft");
227(define-key *global-map* "Ctrl Backspace" "deleteWordLeft")
228;; mapKey(KeyEvent.VK_ENTER, 0, "newline");
229(define-key *global-map* "Enter" "newline")
230(define-key *global-map* "Ctrl M" "newline")
231(define-key *global-map* "Ctrl J" "newlineAndIndent")
232
233;; mapKey(KeyEvent.VK_ESCAPE, 0, "escape");
234(define-key *global-map* "Ctrl G" "escape")
235
236;; mapKey(KeyEvent.VK_G, CTRL_MASK | SHIFT_MASK, "gotoFile");
237;; mapKey(KeyEvent.VK_B, CTRL_MASK | SHIFT_MASK, "browseFileAtDot");
238
239;; mapKey(KeyEvent.VK_D, CTRL_MASK, "dir");
240
241;; mapKey(KeyEvent.VK_F2, SHIFT_MASK, "stamp");
242
243;; mapKey(KeyEvent.VK_A, CTRL_MASK, "selectAll");
244
245;; mapKey(KeyEvent.VK_OPEN_BRACKET, ALT_MASK, "slideOut");
246;; mapKey(KeyEvent.VK_CLOSE_BRACKET, ALT_MASK, "slideIn");
247
248;; // Bookmarks MUST be mapped like this!
249;; mapKey(KeyEvent.VK_0, ALT_MASK, "dropBookmark");
250;; mapKey(KeyEvent.VK_1, ALT_MASK, "dropBookmark");
251;; mapKey(KeyEvent.VK_2, ALT_MASK, "dropBookmark");
252;; mapKey(KeyEvent.VK_3, ALT_MASK, "dropBookmark");
253;; mapKey(KeyEvent.VK_4, ALT_MASK, "dropBookmark");
254;; mapKey(KeyEvent.VK_5, ALT_MASK, "dropBookmark");
255;; mapKey(KeyEvent.VK_6, ALT_MASK, "dropBookmark");
256;; mapKey(KeyEvent.VK_7, ALT_MASK, "dropBookmark");
257;; mapKey(KeyEvent.VK_8, ALT_MASK, "dropBookmark");
258;; mapKey(KeyEvent.VK_9, ALT_MASK, "dropBookmark");
259;; mapKey(KeyEvent.VK_0, CTRL_MASK, "gotoBookmark");
260;; mapKey(KeyEvent.VK_1, CTRL_MASK, "gotoBookmark");
261;; mapKey(KeyEvent.VK_2, CTRL_MASK, "gotoBookmark");
262;; mapKey(KeyEvent.VK_3, CTRL_MASK, "gotoBookmark");
263;; mapKey(KeyEvent.VK_4, CTRL_MASK, "gotoBookmark");
264;; mapKey(KeyEvent.VK_5, CTRL_MASK, "gotoBookmark");
265;; mapKey(KeyEvent.VK_6, CTRL_MASK, "gotoBookmark");
266;; mapKey(KeyEvent.VK_7, CTRL_MASK, "gotoBookmark");
267;; mapKey(KeyEvent.VK_8, CTRL_MASK, "gotoBookmark");
268;; mapKey(KeyEvent.VK_9, CTRL_MASK, "gotoBookmark");
269
270;; // Temporary marker commands.
271;; mapKey(KeyEvent.VK_BACK_SLASH, ALT_MASK, "dropTemporaryMarker");
272;; mapKey(KeyEvent.VK_BACK_SLASH, CTRL_MASK, "gotoTemporaryMarker");
273;; mapKey(KeyEvent.VK_BACK_SLASH, CTRL_MASK | SHIFT_MASK, "selectToTemporaryMarker");
274
275;; mapKey(KeyEvent.VK_F11, 0, "commentRegion");
276(define-key *global-map* "F11" "commentRegion")
277;; mapKey(KeyEvent.VK_F11, SHIFT_MASK, "uncommentRegion");
278(define-key *global-map* "Shift F11" "uncommentRegion")
279
280;; // Duplicate mappings to support IBM 1.3 for Linux.
281;; mapKey(0xffc8, 0, "commentRegion");
282;; mapKey(0xffc8, SHIFT_MASK, "uncommentRegion");
283
284;; mapKey(KeyEvent.VK_F12, 0, "wrapParagraph");
285(define-key *global-map* "F12" "wrapParagraph")
286;; mapKey(KeyEvent.VK_F12, SHIFT_MASK, "unwrapParagraph");
287(define-key *global-map* "Shift F12" "unwrapParagraph")
288;; mapKey(KeyEvent.VK_F12, CTRL_MASK, "toggleWrap");
289(define-key *global-map* "Ctrl F12" "toggleWrap")
290
291;; // Duplicate mappings to support IBM 1.3 for Linux.
292;; mapKey(0xffc9, 0, "wrapParagraph"); // F12
293;; mapKey(0xffc9, SHIFT_MASK, "unwrapParagraph"); // Shift F12
294;; mapKey(0xffc9, CTRL_MASK, "toggleWrap"); // Ctrl F12
295
296;; mapKey(KeyEvent.VK_T, CTRL_MASK | ALT_MASK, "visibleTabs");
297
298;; mapKey(KeyEvent.VK_SLASH, ALT_MASK, "expand");
299(define-key *global-map* "Alt /" "expand")
300
301;; // On Windows, Alt Space drops down the window menu.
302;; if (!Platform.isPlatformWindows())
303;; mapKey(KeyEvent.VK_SPACE, ALT_MASK, "expand");
304
305;; mapKey(KeyEvent.VK_N, ALT_MASK, "nextFrame");
306
307;; mapKey(KeyEvent.VK_W, ALT_MASK, "selectWord");
308
309;; mapKey(VK_MOUSE_1, 0, "mouseMoveDotToPoint");
310(define-key *global-map* "Mouse-1" "mouseMoveDotToPoint")
311;; mapKey(VK_MOUSE_1, SHIFT_MASK, "mouseSelect");
312;; mapKey(VK_MOUSE_1, CTRL_MASK | SHIFT_MASK, "mouseSelectColumn");
313;; mapKey(VK_DOUBLE_MOUSE_1, 0, "selectWord");
314(define-key *global-map* "Double Mouse-1" "selectWord")
315
316;; if (Platform.isPlatformUnix()) {
317;; mapKey(VK_MOUSE_2, 0, "pastePrimarySelection");
318;; mapKey(KeyEvent.VK_INSERT, SHIFT_MASK, "pastePrimarySelection");
319;; }
320
321;; mapKey(VK_MOUSE_3, 0, "mouseShowContextMenu");
322
323;; mapKey(KeyEvent.VK_F7, 0, "recordMacro");
324;; mapKey(KeyEvent.VK_F8, 0, "playbackMacro");
325
326;; mapKey(KeyEvent.VK_W, CTRL_MASK | SHIFT_MASK, "killFrame");
327
328;; // Sidebar.
329;; mapKey(KeyEvent.VK_EQUALS, ALT_MASK, "toggleSidebar");
330;; mapKey(KeyEvent.VK_B, ALT_MASK, "sidebarListBuffers");
331;; mapKey(KeyEvent.VK_T, CTRL_MASK | SHIFT_MASK, "sidebarListTags");
332
333;; mapKey(KeyEvent.VK_F10, 0, "splitWindow");
334(define-key *control-x-map* "2" "splitWindow")
335;; mapKey(KeyEvent.VK_F10, SHIFT_MASK, "unsplitWindow");
336(define-key *control-x-map*  "1" "unsplitwindow")
337;; mapKey(KeyEvent.VK_F10, CTRL_MASK | SHIFT_MASK, "killWindow");
338(define-key *control-x-map* "0" "killWindow")
339;; mapKey(KeyEvent.VK_O, ALT_MASK, "otherWindow");
340(define-key *control-x-map*  "o" "otherwindow")
341
342;; if (Editor.preferences().getBooleanProperty(Property.ENABLE_EXPERIMENTAL_FEATURES))
343;; mapKey(KeyEvent.VK_F9, ALT_MASK, "shell");
344
345;; // Map these globally so they're available in the compilation buffer too.
346;; mapKey(KeyEvent.VK_F4, 0, "nextError");
347(define-key *control-x-map* "`" "nextError")
348(define-key *global-map* "F4" "nextError")
349;; mapKey(KeyEvent.VK_F4, SHIFT_MASK, "previousError");
350(define-key *global-map* "Shift F4" "previousError")
351;; mapKey(KeyEvent.VK_M, CTRL_MASK | ALT_MASK, "showMessage");
352(define-key *global-map* "Ctrl Alt M" "showMessage")
353
354;; // Windows VM seems to need this mapping for the tab key to work properly.
355;; // There's also code in Dispatcher.dispatchKeyTyped to handle the tab key.
356;; mapKey(KeyEvent.VK_TAB, 0, "insertTab");
357
358;; if (Platform.isPlatformLinux()) {
359;; // These mappings work with Blackdown 1.2.2 (and 1.2 pre-release v2).
360;; mapKey(0x2d, CTRL_MASK, "toCenter"); // Ctrl -
361;; mapKey(0x5f, CTRL_MASK | SHIFT_MASK, "toTop"); // Ctrl Shift -
362
363;; // IBM 1.3, Sun 1.4.0 beta 2.
364;; mapKey(0x2d, CTRL_MASK | SHIFT_MASK, "toTop"); // Ctrl Shift -
365;; } else if (Platform.isPlatformWindows()) {
366;; mapKey(0x2d, CTRL_MASK, "toCenter"); // Ctrl -
367;; mapKey(0x2d, CTRL_MASK | SHIFT_MASK, "toTop"); // Ctrl Shift -
368;; }
369
370(define-key *global-map* "Alt ." "findTagAtDot")
371
372;; Help.
373(define-keys *help-map*
374  '(("a"                        "apropos")
375    ("b"                        "listBindings")
376    ("i"                        "help")
377    ("k"                        "describeKey")))
378
379;; Java mode.
380(define-key *java-mode-map* "{" "electricOpenBrace")
381(define-key *java-mode-map* "}" "electricCloseBrace")
382(define-key *java-mode-map* "Tab" "tab")
383(define-key *java-mode-map* "Ctrl Tab" "insertTab")
384(define-key *java-mode-map* "';'" "electricSemi")
385;;                km.mapKey(':', "electricColon");
386(define-key *java-mode-map* #\: "electricColon")
387;;                km.mapKey('*', "electricStar");
388;;                km.mapKey(KeyEvent.VK_T, CTRL_MASK, "findTag");
389;;                km.mapKey(KeyEvent.VK_PERIOD, ALT_MASK, "findTagAtDot");
390;;                km.mapKey(KeyEvent.VK_COMMA, ALT_MASK, "listMatchingTagsAtDot");
391;;                km.mapKey(KeyEvent.VK_PERIOD, CTRL_MASK | ALT_MASK, "findTagAtDotOtherWindow");
392;;                km.mapKey(')', "closeParen");
393;; km.mapKey(KeyEvent.VK_I, ALT_MASK, "cycleIndentSize");
394
395;; km.mapKey(KeyEvent.VK_9, CTRL_MASK | SHIFT_MASK, "insertParentheses");
396;; km.mapKey(KeyEvent.VK_0, CTRL_MASK | SHIFT_MASK, "movePastCloseAndReindent");
397
398;; km.mapKey(KeyEvent.VK_OPEN_BRACKET, CTRL_MASK | SHIFT_MASK, "insertBraces");
399(define-key *java-mode-map* "Ctrl Shift [" "insertBraces")
400;; // Duplicate mapping for 1.4.
401;; km.mapKey(KeyEvent.VK_BRACELEFT, CTRL_MASK | SHIFT_MASK, "insertBraces");
402
403;; km.mapKey(KeyEvent.VK_F12, 0, "wrapComment");
404
405;; // Duplicate mapping to support IBM 1.3 for Linux.
406;; km.mapKey(0xffc9, 0, "wrapComment"); // F12
407
408;; km.mapKey(KeyEvent.VK_OPEN_BRACKET, CTRL_MASK, "fold");
409;; km.mapKey(KeyEvent.VK_CLOSE_BRACKET, CTRL_MASK, "unfold");
410
411;; km.mapKey(KeyEvent.VK_F9, 0, "compile");
412(define-key *java-mode-map* "F9" "compile")
413;; km.mapKey(KeyEvent.VK_F9, CTRL_MASK, "recompile");
414(define-key *java-mode-map* "Ctrl F9" "recompile")
415;; km.mapKey(KeyEvent.VK_F1, ALT_MASK, "jdkHelp");
416;; km.mapKey(KeyEvent.VK_F1, CTRL_MASK, "source");
417
418;; // This is the "normal" mapping.
419;; km.mapKey(KeyEvent.VK_COMMA,  CTRL_MASK | SHIFT_MASK, "htmlInsertTag");
420;; // The "normal" mapping doesn't work for Linux, but this does.
421;; km.mapKey(0x7c, CTRL_MASK | SHIFT_MASK, "htmlInsertTag");
422
423;; if (Editor.checkExperimental()) {
424;; km.mapKey(KeyEvent.VK_SEMICOLON, ALT_MASK, "JavaMode.insertComment");
425;; km.mapKey(KeyEvent.VK_ENTER, ALT_MASK, "JavaMode.newlineAndIndentForComment");
426;; }
427
428;; if (Platform.isPlatformLinux()) {
429;; // Blackdown 1.1.7v3, 1.2pre2, IBM 1.1.8.
430;; // Duplicate mappings needed for VK_9, VK_0 and VK_OPEN_BRACKET.
431;; km.mapKey(0x68, CTRL_MASK | SHIFT_MASK, "insertParentheses");
432;; km.mapKey(0x69, CTRL_MASK | SHIFT_MASK, "movePastCloseAndReindent");
433;; km.mapKey(0xbb, CTRL_MASK | SHIFT_MASK, "insertBraces");
434;; }
435
436
437(defun emacs ()
438  (use-global-map *global-map*)
439  ;; FIXME This is the right idea (so mappings like Alt F will be possible),
440  ;; but it doesn't quite work.
441  (set-global-property "useMenuMnemonics" "false")
442  (j::%execute-command "reloadKeyMaps"))
443
444(defun java-mode-map ()
445  *java-mode-map*)
446
447;; km.mapKey(KeyEvent.VK_TAB, 0, "tab");
448(define-key *lisp-mode-map* "Tab" "tab")
449;; km.mapKey(KeyEvent.VK_TAB, CTRL_MASK, "insertTab");
450(define-key *lisp-mode-map* "Ctrl Tab" "insertTab")
451;; km.mapKey(KeyEvent.VK_F12, 0, "wrapComment");
452(define-key *lisp-mode-map* "F12" "wrapComment")
453;; km.mapKey(KeyEvent.VK_T, CTRL_MASK, "findTag");
454;; km.mapKey(KeyEvent.VK_COMMA, ALT_MASK, "listMatchingTagsAtDot");
455;; km.mapKey(KeyEvent.VK_PERIOD, CTRL_MASK | ALT_MASK, "findTagAtDotOtherWindow");
456(define-key *lisp-mode-map* #\) "closeParen")
457;; km.mapKey(KeyEvent.VK_F1, ALT_MASK, "hyperspec");
458(define-key *lisp-mode-map* "Alt F1" "hyperspec")
459;; km.mapKey(KeyEvent.VK_F, CTRL_MASK | ALT_MASK, "forwardSexp");
460(define-key *lisp-mode-map* "Ctrl Alt F" "forwardSexp")
461;; km.mapKey(KeyEvent.VK_B, CTRL_MASK | ALT_MASK, "backwardSexp");
462(define-key *lisp-mode-map* "Ctrl Alt B" "backwardSexp")
463(define-key *lisp-mode-map* "Ctrl Alt Space" "markSexp")
464;; km.mapKey(KeyEvent.VK_D, CTRL_MASK | ALT_MASK, "downList");
465(define-key *lisp-mode-map* "Ctrl Alt D" "downList")
466;; km.mapKey(KeyEvent.VK_U, CTRL_MASK | ALT_MASK, "backwardUpList");
467(define-key *lisp-mode-map* "Ctrl Alt U" "backwardUpList")
468;; km.mapKey(KeyEvent.VK_X, CTRL_MASK | ALT_MASK, "evalDefunLisp");
469;; km.mapKey(KeyEvent.VK_C, CTRL_MASK | ALT_MASK, "compileDefunLisp");
470;; km.mapKey(KeyEvent.VK_R, CTRL_MASK | ALT_MASK, "evalRegionLisp");
471;; km.mapKey(KeyEvent.VK_M, CTRL_MASK, "lispFindMatchingChar");
472;; km.mapKey(KeyEvent.VK_M, CTRL_MASK | SHIFT_MASK, "lispSelectSyntax");
473;; km.mapKey(KeyEvent.VK_9, CTRL_MASK | SHIFT_MASK, "insertParentheses");
474;; km.mapKey(KeyEvent.VK_0, CTRL_MASK | SHIFT_MASK, "movePastCloseAndReindent");
475
476(defun lisp-mode-map ()
477  (format t "lisp-mode-map called~%")
478  *lisp-mode-map*)
479
480(provide 'emacs)
Note: See TracBrowser for help on using the repository browser.