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

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

Slime.

File size: 20.1 KB
Line 
1;;; emacs.lisp
2;;;
3;;; Copyright (C) 2005 Peter Graves
4;;; $Id: emacs.lisp,v 1.13 2005-03-08 02:22:52 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 '(emacs-mode
23          java-mode-map
24          lisp-mode-map
25          lisp-shell-mode-map
26          directory-mode-map))
27
28(defpackage #:emacs
29  (:use #:cl #:ext #:j))
30
31(in-package #:emacs)
32
33(defun set-mark-command ()
34  (setf (buffer-mark (current-buffer)) (current-point))
35  (status "Mark set"))
36
37(defun define-keys (map mappings)
38  (dolist (mapping mappings)
39    (define-key map (first mapping) (second mapping))))
40
41(defparameter *emacs-global-map* (make-keymap))
42(defparameter *esc-map* (make-keymap))
43(defparameter *control-x-map* (make-keymap))
44(defparameter *help-map* (make-keymap))
45(defparameter *java-mode-map* (make-keymap))
46
47(define-key *emacs-global-map* "Escape" *esc-map*)
48(define-key *emacs-global-map* "Ctrl X" *control-x-map*)
49(define-key *emacs-global-map* "Ctrl H" *help-map*)
50
51;; // File menu.
52(define-key *control-x-map* "Ctrl F" "openFile")
53;; mapKey(KeyEvent.VK_O, CTRL_MASK | ALT_MASK, "openFileInOtherWindow");
54;; mapKey(KeyEvent.VK_O, CTRL_MASK | SHIFT_MASK, "openFileInOtherFrame");
55;; mapKey(KeyEvent.VK_N, CTRL_MASK, "newBuffer");
56;; mapKey(KeyEvent.VK_R, ALT_MASK, "recentFiles");
57(define-key *control-x-map* "Ctrl S" "save")
58;; mapKey(KeyEvent.VK_S, CTRL_MASK | SHIFT_MASK, "saveAs");
59;; mapKey(KeyEvent.VK_S, CTRL_MASK | ALT_MASK, "saveCopy");
60;; mapKey(KeyEvent.VK_F2, 0, "saveAll");
61
62;; j's killBuffer is really kill-this-buffer
63(define-key *control-x-map* "k" "killBuffer")
64
65;; mapKey(KeyEvent.VK_P, ALT_MASK, "properties");
66;; mapKey(KeyEvent.VK_N, CTRL_MASK | SHIFT_MASK, "newFrame");
67(define-key *emacs-global-map* "Alt X" "executeCommand")
68(define-key *esc-map* #\x "executecommand")
69;; mapKey(KeyEvent.VK_P, CTRL_MASK, "print");
70;; mapKey(KeyEvent.VK_Q, CTRL_MASK | SHIFT_MASK, "saveAllExit");
71(define-key *control-x-map* "Ctrl C" "saveAllExit")
72
73(define-key *emacs-global-map* "Ctrl Space" #'set-mark-command)
74(define-key *emacs-global-map* "Ctrl Shift 2" #'set-mark-command) ; C-@
75
76;; // Edit menu.
77(define-keys *emacs-global-map*
78  `(("Ctrl /"                   "undo")
79    ("Ctrl Shift 0x2d"          "undo") ; C-_
80    ("Shift Alt 0x2d"           "redo") ; M-_
81    ("Ctrl W"                   "killRegion")
82    ("Shift Delete"             "killRegion")
83    ("Alt W"                    "copyRegion")
84    ("Ctrl NumPad Insert"       "copyRegion")
85    ("Ctrl Y"                   "paste")
86    ("Shift NumPad Insert"      "paste")
87    ("Alt Y"                    "cyclePaste")))
88
89(define-key *control-x-map* "u" "undo")
90(define-key *esc-map* #\y "cyclePaste")
91;; mapKey(KeyEvent.VK_X, CTRL_MASK | SHIFT_MASK, "killAppend");
92;; mapKey(KeyEvent.VK_C, CTRL_MASK | SHIFT_MASK, "copyAppend");
93;; mapKey(KeyEvent.VK_T, ALT_MASK, "cycleTabWidth");
94
95;; // Goto menu.
96;; mapKey(KeyEvent.VK_J, CTRL_MASK, "jumpToLine");
97(define-key *emacs-global-map* "Alt G" "jumpToLine")
98(define-key *esc-map* #\g "jumpToLine")
99;; mapKey(KeyEvent.VK_J, CTRL_MASK | SHIFT_MASK, "jumpToColumn");
100;; mapKey(KeyEvent.VK_M, CTRL_MASK, "findMatchingChar");
101;; mapKey(KeyEvent.VK_M, CTRL_MASK | SHIFT_MASK, "selectSyntax");
102
103(define-keys *emacs-global-map*
104  '(("Ctrl Alt Up"              "findFirstOccurrence")
105    ("Ctrl Alt NumPad Up"       "findFirstOccurrence")
106    ("Alt Up"                   "findPrevWord")
107    ("Alt NumPad Up"            "findPrevWord")
108    ("Alt Down"                 "findNextWord")
109    ("Alt NumPad Down"          "findNextWord")))
110
111;; mapKey(KeyEvent.VK_N, CTRL_MASK | ALT_MASK, "nextChange");
112;; mapKey(KeyEvent.VK_P, CTRL_MASK | ALT_MASK, "previousChange");
113(define-key *emacs-global-map* "F5" "pushPosition")
114(define-key *emacs-global-map* "Shift F5" "popPosition")
115
116;; // Search menu.
117(define-keys *emacs-global-map*
118  '(("Ctrl S"                   "incrementalFind")
119    ("Alt F3"                   "find")
120    ("F3"                       "findNext")
121    ("Shift F3"                 "findPrev")
122    ("F6"                       "findInFiles")
123    ("Ctrl Shift F"             "findInFiles")
124    ("Ctrl F3"                  "listOccurrences")
125    ("Ctrl Shift L"             "listFiles")
126    ("Shift Alt 5"              "replace") ; M-%
127    ("Ctrl Shift R"             "replaceInFiles")))
128
129;; Emacs uses Ctrl Alt L for reposition-window
130;; XEmacs uses Ctrl Alt L for switch-to-other-buffer
131(define-key *emacs-global-map* "Ctrl Alt L" "listOccurrencesOfPatternAtDot")
132
133;; mapKey(KeyEvent.VK_K, CTRL_MASK, "killLine");
134(define-key *emacs-global-map* "Ctrl K" "killLine")
135;; mapKey(KeyEvent.VK_DELETE, CTRL_MASK, "deleteWordRight");
136(define-key *emacs-global-map* "Ctrl Delete" "deleteWordRight")
137
138(define-keys *emacs-global-map*
139  '(("Home"                     "home")
140    ("Ctrl A"                   "home")
141    ("End"                      "end");
142    ("Ctrl E"                   "end");
143    ("Shift Home"               "selectHome")
144    ("Shift End"                "selectEnd")
145    ("Ctrl Home"                "bob")
146    ("Ctrl Shift Home"          "selectBob")
147    ("Ctrl End"                 "eob")
148    ("Ctrl Shift End"           "selectEob")
149    ("Ctrl P"                   "up")
150    ("Up"                       "up")
151    ("NumPad Up"                "up")
152    ("Ctrl N"                   "down")
153    ("Down"                     "down")
154    ("NumPad Down"              "down")
155    ("Shift Up"                 "selectUp")
156    ("Shift NumPad Up"          "selectUp")
157    ("Shift Down"               "selectDown")
158    ("Shift NumPad Down"        "selectDown")
159    ("Ctrl B"                   "left")
160    ("Left"                     "left")
161    ("NumPad Left"              "left")
162    ("Ctrl F"                   "right")
163    ("Right"                    "right")
164    ("NumPad Right"             "right")
165    ("Shift Left"               "selectLeft")
166    ("Shift NumPad Left"        "selectLeft")
167    ("Shift Right"              "selectRight")
168    ("Shift NumPad Right"       "selectRight")
169    ("Alt B"                    "wordLeft")
170    ("Ctrl Left"                "wordLeft")
171    ("Ctrl NumPad Left"         "wordLeft")
172    ("Ctrl Right"               "wordRight")
173    ("Ctrl NumPad Right"        "wordRight")
174    ("Ctrl Shift Left"          "selectWordLeft")
175    ("Ctrl Shift NumPad Left"   "selectWordLeft")
176    ("Ctrl Shift Right"         "selectWordRight")
177    ("Ctrl Shift NumPad Right"  "selectWordRight")
178    ("Alt V"                    "pageUp")
179    ("Page Up"                  "pageUp")
180    ("Ctrl V"                   "pageDown")
181    ("Page Down"                "pageDown")))
182
183(define-keys *esc-map*
184  '((#\<                        "bob")
185    (#\>                        "eob")
186    (#\.                        "findTagAtDot")
187    (#\,                        "listMatchingTagsAtDot")
188    (#\%                        "replace")
189    ))
190
191;; Emacs uses Ctrl Up for backward-paragraph, which j doesn't have.
192(define-keys *emacs-global-map*
193  '(("Ctrl Up"                  "windowUp")
194    ("Ctrl NumPad Up"           "windowUp")))
195;; Emacs uses Ctrl Down for forward-paragraph, which j doesn't have.
196(define-keys *emacs-global-map*
197  '(("Ctrl Down"                "windowDown")
198    ("Ctrl NumPad Down"         "windowDown")))
199
200;; Emacs uses Alt Left for backward-word, which is also on Alt B and Ctrl Left.
201(define-keys *emacs-global-map*
202  '(("Alt Left"                 "prevBuffer")
203    ("Alt NumPad Left"          "prevBuffer")))
204;; Emacs uses Alt Right for forward-word, which is also on Alt F and Ctrl Right.
205(define-keys *emacs-global-map*
206  '(("Alt Right"                "nextBuffer")
207    ("Alt NumPad Right"         "nextBuffer")))
208
209;; mapKey(KeyEvent.VK_PAGE_UP, ALT_MASK, "pageUpOtherWindow");
210;; mapKey(KeyEvent.VK_PAGE_UP, SHIFT_MASK, "selectPageUp");
211;; mapKey(KeyEvent.VK_PAGE_DOWN, ALT_MASK, "pageDownOtherWindow");
212;; mapKey(KeyEvent.VK_PAGE_DOWN, SHIFT_MASK, "selectPageDown");
213;; mapKey(KeyEvent.VK_PAGE_UP, CTRL_MASK, "top");
214;; mapKey(KeyEvent.VK_PAGE_DOWN, CTRL_MASK, "bottom");
215;; mapKey(KeyEvent.VK_DELETE, 0, "delete");
216(define-keys *emacs-global-map*
217  '(("Delete"                   "delete")
218    ("Ctrl D"                   "delete")
219    ("Backspace"                "backspace")
220    ("Shift Backspace"          "backspace")
221    ("Ctrl Backspace"           "deleteWordLeft")
222    ("Enter"                    "newline")
223    ("Ctrl M"                   "newline")
224    ("Ctrl J"                   "newlineAndIndent")))
225
226(define-key *emacs-global-map* "Shift Alt 9" "insertParentheses")
227(define-key *emacs-global-map* "Shift Alt 0" "movePastCloseAndReindent")
228
229(define-key *emacs-global-map* "Ctrl G" "escape") ; keyboard-quit
230
231(define-key *emacs-global-map* "Ctrl Shift G" "gotoFile")
232(define-key *emacs-global-map* "Ctrl Shift B" "browsefileatdot")
233
234(define-key *control-x-map* #\d "dir")
235
236;; mapKey(KeyEvent.VK_F2, SHIFT_MASK, "stamp");
237
238;; mapKey(KeyEvent.VK_A, CTRL_MASK, "selectAll");
239
240;; mapKey(KeyEvent.VK_OPEN_BRACKET, ALT_MASK, "slideOut");
241;; mapKey(KeyEvent.VK_CLOSE_BRACKET, ALT_MASK, "slideIn");
242
243;; // Bookmarks MUST be mapped like this!
244;; mapKey(KeyEvent.VK_0, ALT_MASK, "dropBookmark");
245;; mapKey(KeyEvent.VK_1, ALT_MASK, "dropBookmark");
246;; mapKey(KeyEvent.VK_2, ALT_MASK, "dropBookmark");
247;; mapKey(KeyEvent.VK_3, ALT_MASK, "dropBookmark");
248;; mapKey(KeyEvent.VK_4, ALT_MASK, "dropBookmark");
249;; mapKey(KeyEvent.VK_5, ALT_MASK, "dropBookmark");
250;; mapKey(KeyEvent.VK_6, ALT_MASK, "dropBookmark");
251;; mapKey(KeyEvent.VK_7, ALT_MASK, "dropBookmark");
252;; mapKey(KeyEvent.VK_8, ALT_MASK, "dropBookmark");
253;; mapKey(KeyEvent.VK_9, ALT_MASK, "dropBookmark");
254;; mapKey(KeyEvent.VK_0, CTRL_MASK, "gotoBookmark");
255;; mapKey(KeyEvent.VK_1, CTRL_MASK, "gotoBookmark");
256;; mapKey(KeyEvent.VK_2, CTRL_MASK, "gotoBookmark");
257;; mapKey(KeyEvent.VK_3, CTRL_MASK, "gotoBookmark");
258;; mapKey(KeyEvent.VK_4, CTRL_MASK, "gotoBookmark");
259;; mapKey(KeyEvent.VK_5, CTRL_MASK, "gotoBookmark");
260;; mapKey(KeyEvent.VK_6, CTRL_MASK, "gotoBookmark");
261;; mapKey(KeyEvent.VK_7, CTRL_MASK, "gotoBookmark");
262;; mapKey(KeyEvent.VK_8, CTRL_MASK, "gotoBookmark");
263;; mapKey(KeyEvent.VK_9, CTRL_MASK, "gotoBookmark");
264
265;; // Temporary marker commands.
266;; mapKey(KeyEvent.VK_BACK_SLASH, ALT_MASK, "dropTemporaryMarker");
267;; mapKey(KeyEvent.VK_BACK_SLASH, CTRL_MASK, "gotoTemporaryMarker");
268;; mapKey(KeyEvent.VK_BACK_SLASH, CTRL_MASK | SHIFT_MASK, "selectToTemporaryMarker");
269
270;; mapKey(KeyEvent.VK_F11, 0, "commentRegion");
271(define-key *emacs-global-map* "F11" "commentRegion")
272;; mapKey(KeyEvent.VK_F11, SHIFT_MASK, "uncommentRegion");
273(define-key *emacs-global-map* "Shift F11" "uncommentRegion")
274
275;; // Duplicate mappings to support IBM 1.3 for Linux.
276;; mapKey(0xffc8, 0, "commentRegion");
277;; mapKey(0xffc8, SHIFT_MASK, "uncommentRegion");
278
279;; mapKey(KeyEvent.VK_F12, 0, "wrapParagraph");
280(define-key *emacs-global-map* "F12" "wrapParagraph")
281;; mapKey(KeyEvent.VK_F12, SHIFT_MASK, "unwrapParagraph");
282(define-key *emacs-global-map* "Shift F12" "unwrapParagraph")
283;; mapKey(KeyEvent.VK_F12, CTRL_MASK, "toggleWrap");
284(define-key *emacs-global-map* "Ctrl F12" "toggleWrap")
285
286;; // Duplicate mappings to support IBM 1.3 for Linux.
287;; mapKey(0xffc9, 0, "wrapParagraph"); // F12
288;; mapKey(0xffc9, SHIFT_MASK, "unwrapParagraph"); // Shift F12
289;; mapKey(0xffc9, CTRL_MASK, "toggleWrap"); // Ctrl F12
290
291;; mapKey(KeyEvent.VK_T, CTRL_MASK | ALT_MASK, "visibleTabs");
292
293;; mapKey(KeyEvent.VK_SLASH, ALT_MASK, "expand");
294(define-key *emacs-global-map* "Alt /" "expand")
295
296;; // On Windows, Alt Space drops down the window menu.
297;; if (!Platform.isPlatformWindows())
298;; mapKey(KeyEvent.VK_SPACE, ALT_MASK, "expand");
299
300;; mapKey(KeyEvent.VK_N, ALT_MASK, "nextFrame");
301
302;; mapKey(KeyEvent.VK_W, ALT_MASK, "selectWord");
303
304;; FIXME These are j's normal mouse bindings. We don't have the required
305;; functionality in the right form to support the emacs mouse bindings.
306(define-keys *emacs-global-map*
307  '(("Mouse-1"                  "mouseMoveDotToPoint")
308    ("Shift Mouse-1"            "mouseSelect")
309    ("Ctrl Shift Mouse-1"       "mouseSelectColumn")
310    ("Double Mouse-1"           "selectWord")
311    ("Mouse-3"                  "mouseShowContextMenu")))
312
313(when (featurep :unix)
314  (define-key *emacs-global-map* "Mouse-2" "pastePrimarySelection"))
315
316(define-keys *control-x-map*
317  '((#\(                        "startMacro")
318    (#\)                        "endMacro")
319    (#\e                        "playbackMacro")))
320
321;; mapKey(KeyEvent.VK_W, CTRL_MASK | SHIFT_MASK, "killFrame");
322
323;; // Sidebar.
324;; mapKey(KeyEvent.VK_EQUALS, ALT_MASK, "toggleSidebar");
325;; mapKey(KeyEvent.VK_B, ALT_MASK, "sidebarListBuffers");
326;; mapKey(KeyEvent.VK_T, CTRL_MASK | SHIFT_MASK, "sidebarListTags");
327
328(define-keys *control-x-map*
329  '(("2"                        "splitWindow")
330    ("1"                        "unsplitwindow")
331    ("0"                        "killWindow")
332    ("o"                        "otherwindow")))
333
334(when (variable-value 'enable-experimental-features)
335  (define-key *emacs-global-map* "Alt F9" "shell"))
336
337(define-key *control-x-map* "`" "nextError")
338(define-key *emacs-global-map* "F4" "nextError")
339(define-key *emacs-global-map* "Shift F4" "previousError")
340(define-key *emacs-global-map* "Ctrl Alt M" "showMessage")
341
342;; FIXME We need a binding for findTag.
343(define-key *emacs-global-map* "Alt ." "findTagAtDot")
344(define-key *emacs-global-map* "Alt ," "listMatchingTagsAtDot")
345
346;;; Help.
347
348(define-keys *help-map*
349  '(("a"                        "apropos")
350    ("b"                        "describeBindings")
351    ("c"                        "describeKey") ; describe-key-briefly
352    ("i"                        "help")
353    ("k"                        "describeKey")))
354
355;;; Java mode.
356
357(define-keys *java-mode-map*
358  '(("{"                        "electricOpenBrace")
359    ("}"                        "electricCloseBrace")
360    ("Tab"                      "tab")
361    ("Ctrl Tab"                 "insertTab")
362    ("';'"                      "electricSemi")
363    (#\:                        "electricColon")
364    (#\*                        "electricStar")
365    (#\)                        "closeParen")
366    ("Ctrl Shift ["             "insertBraces")
367    ("F12"                      "wrapComment")
368    ("F9"                       "compile")
369    ("Ctrl F9"                  "recompile")
370    ("Alt F1"                   "jdkHelp")
371    ("Ctrl F1"                  "source")))
372
373(defun java-mode-map ()
374  *java-mode-map*)
375
376;;; Lisp mode
377
378(defparameter *lisp-mode-map* (make-keymap))
379(defparameter *lisp-mode-control-c-map* (make-keymap))
380(defparameter *lisp-mode-control-x-map* (make-keymap))
381(define-key *lisp-mode-map* "Ctrl C" *lisp-mode-control-c-map*)
382(define-key *lisp-mode-map* "Ctrl X" *lisp-mode-control-x-map*)
383
384(define-keys *lisp-mode-map*
385  '(("Tab"                      "tab")
386    ("Ctrl Tab"                 "insertTab")
387    ("F12"                      "wrapComment")
388    (#\)                        "closeParen")
389    ("Alt F1"                   "hyperspec")
390    ("Ctrl Alt F"               "forwardSexp")
391    ("Ctrl Alt B"               "backwardSexp")
392    ("Ctrl Alt Space"           "markSexp")
393    ("Ctrl Alt D"               "downList")
394    ("Ctrl Alt U"               "backwardUpList")
395    ("Ctrl Alt X"               "evalDefunLisp")))
396
397(define-keys *lisp-mode-control-c-map*
398  '(("Ctrl C"                   "compileDefunLisp")
399    ("Ctrl R"                   "evalRegionLisp")))
400
401(defun lisp-mode-map ()
402  *lisp-mode-map*)
403
404;;; Lisp shell mode
405
406(defparameter *lisp-shell-mode-map* (make-keymap))
407(defparameter *lisp-shell-mode-esc-map* (make-keymap))
408(defparameter *lisp-shell-mode-control-c-map* (make-keymap))
409(define-key *lisp-shell-mode-map* "Escape" *lisp-shell-mode-esc-map*)
410(define-key *lisp-shell-mode-map* "Ctrl C" *lisp-shell-mode-control-c-map*)
411
412(define-keys *lisp-shell-mode-map*
413  '(("Home"                     "shellHome")
414    ("Ctrl A"                   "shellHome")
415    ("Backspace"                "shellbackspace")
416    ("Alt P"                    "shellPreviousInput")
417    ("Alt N"                    "shellNextInput")
418    ("Enter"                    "LispShellMode.enter")
419    ("Alt Enter"                "newlineandindent")
420    ("Ctrl R"                   "resetLisp")
421    ("Tab"                      "indentLineOrRegion")
422    ("Alt F1"                   "hyperspec")))
423
424(define-keys *lisp-shell-mode-esc-map*
425  '((#\p                        "shellPreviousInput")
426    (#\n                        "shellNextInput")))
427
428(define-keys *lisp-shell-mode-control-c-map*
429  '(("Ctrl C"                   "shellInterrupt")
430    ("Ctrl P"                   "shellPreviousPrompt")
431    ("Ctrl N"                   "shellNextPrompt")))
432
433(defun lisp-shell-mode-map ()
434  *lisp-shell-mode-map*)
435
436;;; Slime
437
438(defun define-keys-for-slime ()
439  (define-keys *lisp-mode-map*
440    '(("Space"                  "(slime:slime-space)")
441      ("Alt ."                  "(slime:slime-edit-definition)")
442      ("Ctrl Alt I"             "(slime:slime-complete-symbol)")
443      ("Ctrl Alt X"             "(slime:slime-eval-defun)")))
444  (define-keys *lisp-mode-control-c-map*
445    '(("Tab"                    "(slime:slime-complete-symbol)")
446      ("Ctrl C"                 "(slime:slime-compile-defun)")
447      ("Ctrl I"                 "(slime:slime-complete-symbol)")
448      ("Ctrl K"                 "(slime:slime-compile-and-load-file)")
449      ("Ctrl R"                 "(slime:slime-eval-region)")))
450  (define-keys *lisp-mode-control-x-map*
451    '(("Ctrl E"                 "(slime:slime-eval-last-expression)")))
452  (define-keys *lisp-shell-mode-map*
453    '(("Tab"                    "(slime:slime-complete-symbol)")
454      ("Space"                  "(slime:slime-space)")
455      ("Alt ."                  "(slime:slime-edit-definition)")
456      ("Ctrl Alt I"             "(slime:slime-complete-symbol)")))
457  (define-keys *lisp-shell-mode-esc-map*
458    '(("Tab"                    "(slime:slime-complete-symbol)")))
459  (define-keys *lisp-shell-mode-control-c-map*
460    '(("Tab"                    "(slime:slime-complete-symbol)"))))
461
462;;; Directory mode
463
464(defparameter *directory-mode-map* (make-keymap))
465
466;; These are basically j's normal directory mode bindings. J's directory mode
467;; doesn't really work like dired in emacs.
468(define-keys *directory-mode-map*
469  '(("Enter"                    "dirOpenFile")
470    ("Ctrl Shift G"             "diropenfile")
471    ("Double Mouse-1"           "dirOpenFile")
472    ("Mouse-2"                  "dirOpenFile")
473    ("Ctrl Enter"               "diropenfileandkilldirectory")
474    ("Ctrl Shift B"             "dirBrowseFile")
475    ("Backspace"                "dirUpDir")
476    (#\u                        "dirUpDir")
477    (#\l                        "dirLimit")
478    (#\L                        "dirUnlimit")
479    (#\s                        "dirCycleSortBy")
480    (#\r                        "dirRescan")
481    ("Delete"                   "dirDeleteFiles")
482    (#\c                        "dirCopyFile")
483    (#\g                        "dirGetFile")
484    (#\m                        "dirMoveFile")
485    (#\t                        "dirTagFile")
486    (#\!                        "dirDoShellCommand")
487    ("Home"                     "dirHome")
488    (#\b                        "dirBack")
489    (#\f                        "dirForward")))
490
491(defun directory-mode-map ()
492  *directory-mode-map*)
493
494(defun emacs-mode (&optional (arg t))
495  (cond (arg
496         ;; FIXME This is the right idea (so mappings like Alt F will be
497         ;; possible), but it doesn't work.
498         (set-global-property "useMenuMnemonics" "false")
499         (set-global-property "emulation" "emacs")
500         (use-global-map *emacs-global-map*)
501         (j::%execute-command "reloadKeyMaps"))
502        ((null arg)
503         (set-global-property "useMenuMnemonics" "true")
504         (set-global-property "emulation" nil)
505         (j::%execute-command "defaultKeyMaps"))))
Note: See TracBrowser for help on using the repository browser.