Japanese translation of message catalog for Sawfish Window-Manager
Révision | 6dbc3f26ca215ade3246108bec5f00d973eabe60 (tree) |
---|---|
l'heure | 1999-08-16 00:05:09 |
Auteur | john <john> |
Commiter | john |
keymaps are now customizable
@@ -21,34 +21,59 @@ | ||
21 | 21 | |
22 | 22 | (provide 'keymaps) |
23 | 23 | |
24 | -(defvar global-keymap (make-sparse-keymap) | |
25 | - "Keymap containing bindings active anywhere.") | |
24 | +(put 'keymap 'custom-set 'custom-set-keymap) | |
25 | +(put 'keymap 'custom-get 'custom-get-keymap) | |
26 | +(put 'keymap 'custom-widget 'custom-keymap-widget) | |
26 | 27 | |
27 | -(defvar root-window-keymap (make-sparse-keymap) | |
28 | - "Keymap containing bindings active when the pointer is in the root window.") | |
28 | +(defgroup bindings "Bindings" | |
29 | + :widget custom-keymap-group-widget) | |
29 | 30 | |
30 | -(defvar title-keymap (make-sparse-keymap) | |
31 | - "Keymap containing bindings active when the pointer is in the title of | |
32 | -a window.") | |
33 | - | |
34 | -(defvar iconify-button-keymap (make-sparse-keymap) | |
35 | - "Keymap containing bindings active when the pointer is in the iconify | |
36 | -button of a window.") | |
31 | +(defcustom global-keymap (make-sparse-keymap) | |
32 | + "Keymap containing bindings active anywhere." | |
33 | + :group bindings | |
34 | + :type keymap | |
35 | + :before-set (lambda () | |
36 | + (ungrab-keymap global-keymap)) | |
37 | + :after-set (lambda () | |
38 | + (grab-keymap global-keymap))) | |
39 | + | |
40 | +(defcustom window-keymap (make-sparse-keymap) | |
41 | + "Keymap containing bindings active when a client window is focused." | |
42 | + :group bindings | |
43 | + :type keymap | |
44 | + :before-set (lambda () | |
45 | + (ungrab-keymap window-keymap)) | |
46 | + :after-set (lambda () | |
47 | + (grab-keymap window-keymap))) | |
48 | + | |
49 | +(defcustom root-window-keymap (make-sparse-keymap) | |
50 | + "Keymap containing bindings active when the pointer is in the root window." | |
51 | + :group bindings | |
52 | + :type keymap) | |
37 | 53 | |
38 | -(defvar maximize-button-keymap (make-sparse-keymap) | |
39 | - "Keymap containing bindings active when the pointer is in the maximize | |
40 | -button of a window.") | |
54 | +(defcustom title-keymap (make-sparse-keymap) | |
55 | + "Keymap containing bindings active when the pointer is in the title of | |
56 | +a window." | |
57 | + :group bindings | |
58 | + :type keymap) | |
41 | 59 | |
42 | -(defvar close-button-keymap (make-sparse-keymap) | |
60 | +(defcustom close-button-keymap (make-sparse-keymap) | |
43 | 61 | "Keymap containing bindings active when the pointer is in the close button |
44 | -of a window.") | |
62 | +of a window." | |
63 | + :group bindings | |
64 | + :type keymap) | |
45 | 65 | |
46 | -(defvar menu-button-keymap (make-sparse-keymap) | |
47 | - "Keymap containing bindings active when the pointer is in the menu button | |
48 | -of a window.") | |
66 | +(defcustom iconify-button-keymap (make-sparse-keymap) | |
67 | + "Keymap containing bindings active when the pointer is in the iconify | |
68 | +button of a window." | |
69 | + :group bindings | |
70 | + :type keymap) | |
49 | 71 | |
50 | -(defvar window-keymap (make-sparse-keymap) | |
51 | - "Keymap containing bindings active when a client window is focused.") | |
72 | +(defcustom menu-button-keymap (make-sparse-keymap) | |
73 | + "Keymap containing bindings active when the pointer is in the menu button | |
74 | +of a window." | |
75 | + :group bindings | |
76 | + :type keymap) | |
52 | 77 | |
53 | 78 | |
54 | 79 | ;; Arrange for window-keymap to be set in each window |
@@ -79,8 +104,7 @@ of a window.") | ||
79 | 104 | |
80 | 105 | (bind-keys global-keymap |
81 | 106 | "C-Left" 'previous-workspace |
82 | - "C-Right" 'next-workspace | |
83 | - "C-M-ESC" 'quit) | |
107 | + "C-Right" 'next-workspace) | |
84 | 108 | |
85 | 109 | (bind-keys root-window-keymap |
86 | 110 | "Button2-Click1" 'popup-root-menu |
@@ -99,10 +123,36 @@ of a window.") | ||
99 | 123 | "Button3-Off" 'delete-window) |
100 | 124 | |
101 | 125 | |
102 | -;; placeholder for customize | |
103 | - | |
104 | -(defcustom keymap-dummy nil | |
105 | - "" | |
106 | - :type none | |
107 | - :group bindings | |
108 | - :widget (lambda () '(label "Keybinding customization is unimplemented."))) | |
126 | +;; customize support | |
127 | + | |
128 | +(defun custom-get-keymap (symbol) | |
129 | + (cons 'keymap (mapcar #'(lambda (cell) | |
130 | + (cons (car cell) (event-name (cdr cell)))) | |
131 | + (cdr (symbol-value symbol))))) | |
132 | + | |
133 | +(defun custom-set-keymap (symbol value &rest args) | |
134 | + (when (eq (car value) 'keymap) | |
135 | + (apply 'custom-set-variable symbol | |
136 | + (cons 'keymap | |
137 | + (delq nil (mapcar #'(lambda (cell) | |
138 | + (let | |
139 | + ((ev (lookup-event (cdr cell)))) | |
140 | + (and ev (cons (car cell) ev)))) | |
141 | + (cdr value)))) args))) | |
142 | + | |
143 | +(defun custom-keymap-widget (symbol value doc) | |
144 | + `(keymap :variable ,symbol | |
145 | + :value ,value | |
146 | + :doc ,doc)) | |
147 | + | |
148 | +(defun custom-keymap-group-widget (group spec) | |
149 | + (let | |
150 | + ((names (mapcar 'symbol-name (cdr (assq 'bindings custom-groups))))) | |
151 | + `(keymap-shell ,(mapcar #'(lambda (elt) | |
152 | + (list (car (prog1 names | |
153 | + (setq names (cdr names)))) | |
154 | + elt)) spec) | |
155 | + :commands ,(sort (apropos "" 'commandp) | |
156 | + #'(lambda (x y) | |
157 | + (< (symbol-name x) | |
158 | + (symbol-name y))))))) |
@@ -21,34 +21,59 @@ | ||
21 | 21 | |
22 | 22 | (provide 'keymaps) |
23 | 23 | |
24 | -(defvar global-keymap (make-sparse-keymap) | |
25 | - "Keymap containing bindings active anywhere.") | |
24 | +(put 'keymap 'custom-set 'custom-set-keymap) | |
25 | +(put 'keymap 'custom-get 'custom-get-keymap) | |
26 | +(put 'keymap 'custom-widget 'custom-keymap-widget) | |
26 | 27 | |
27 | -(defvar root-window-keymap (make-sparse-keymap) | |
28 | - "Keymap containing bindings active when the pointer is in the root window.") | |
28 | +(defgroup bindings "Bindings" | |
29 | + :widget custom-keymap-group-widget) | |
29 | 30 | |
30 | -(defvar title-keymap (make-sparse-keymap) | |
31 | - "Keymap containing bindings active when the pointer is in the title of | |
32 | -a window.") | |
33 | - | |
34 | -(defvar iconify-button-keymap (make-sparse-keymap) | |
35 | - "Keymap containing bindings active when the pointer is in the iconify | |
36 | -button of a window.") | |
31 | +(defcustom global-keymap (make-sparse-keymap) | |
32 | + "Keymap containing bindings active anywhere." | |
33 | + :group bindings | |
34 | + :type keymap | |
35 | + :before-set (lambda () | |
36 | + (ungrab-keymap global-keymap)) | |
37 | + :after-set (lambda () | |
38 | + (grab-keymap global-keymap))) | |
39 | + | |
40 | +(defcustom window-keymap (make-sparse-keymap) | |
41 | + "Keymap containing bindings active when a client window is focused." | |
42 | + :group bindings | |
43 | + :type keymap | |
44 | + :before-set (lambda () | |
45 | + (ungrab-keymap window-keymap)) | |
46 | + :after-set (lambda () | |
47 | + (grab-keymap window-keymap))) | |
48 | + | |
49 | +(defcustom root-window-keymap (make-sparse-keymap) | |
50 | + "Keymap containing bindings active when the pointer is in the root window." | |
51 | + :group bindings | |
52 | + :type keymap) | |
37 | 53 | |
38 | -(defvar maximize-button-keymap (make-sparse-keymap) | |
39 | - "Keymap containing bindings active when the pointer is in the maximize | |
40 | -button of a window.") | |
54 | +(defcustom title-keymap (make-sparse-keymap) | |
55 | + "Keymap containing bindings active when the pointer is in the title of | |
56 | +a window." | |
57 | + :group bindings | |
58 | + :type keymap) | |
41 | 59 | |
42 | -(defvar close-button-keymap (make-sparse-keymap) | |
60 | +(defcustom close-button-keymap (make-sparse-keymap) | |
43 | 61 | "Keymap containing bindings active when the pointer is in the close button |
44 | -of a window.") | |
62 | +of a window." | |
63 | + :group bindings | |
64 | + :type keymap) | |
45 | 65 | |
46 | -(defvar menu-button-keymap (make-sparse-keymap) | |
47 | - "Keymap containing bindings active when the pointer is in the menu button | |
48 | -of a window.") | |
66 | +(defcustom iconify-button-keymap (make-sparse-keymap) | |
67 | + "Keymap containing bindings active when the pointer is in the iconify | |
68 | +button of a window." | |
69 | + :group bindings | |
70 | + :type keymap) | |
49 | 71 | |
50 | -(defvar window-keymap (make-sparse-keymap) | |
51 | - "Keymap containing bindings active when a client window is focused.") | |
72 | +(defcustom menu-button-keymap (make-sparse-keymap) | |
73 | + "Keymap containing bindings active when the pointer is in the menu button | |
74 | +of a window." | |
75 | + :group bindings | |
76 | + :type keymap) | |
52 | 77 | |
53 | 78 | |
54 | 79 | ;; Arrange for window-keymap to be set in each window |
@@ -79,8 +104,7 @@ of a window.") | ||
79 | 104 | |
80 | 105 | (bind-keys global-keymap |
81 | 106 | "C-Left" 'previous-workspace |
82 | - "C-Right" 'next-workspace | |
83 | - "C-M-ESC" 'quit) | |
107 | + "C-Right" 'next-workspace) | |
84 | 108 | |
85 | 109 | (bind-keys root-window-keymap |
86 | 110 | "Button2-Click1" 'popup-root-menu |
@@ -99,10 +123,36 @@ of a window.") | ||
99 | 123 | "Button3-Off" 'delete-window) |
100 | 124 | |
101 | 125 | |
102 | -;; placeholder for customize | |
103 | - | |
104 | -(defcustom keymap-dummy nil | |
105 | - "" | |
106 | - :type none | |
107 | - :group bindings | |
108 | - :widget (lambda () '(label "Keybinding customization is unimplemented."))) | |
126 | +;; customize support | |
127 | + | |
128 | +(defun custom-get-keymap (symbol) | |
129 | + (cons 'keymap (mapcar #'(lambda (cell) | |
130 | + (cons (car cell) (event-name (cdr cell)))) | |
131 | + (cdr (symbol-value symbol))))) | |
132 | + | |
133 | +(defun custom-set-keymap (symbol value &rest args) | |
134 | + (when (eq (car value) 'keymap) | |
135 | + (apply 'custom-set-variable symbol | |
136 | + (cons 'keymap | |
137 | + (delq nil (mapcar #'(lambda (cell) | |
138 | + (let | |
139 | + ((ev (lookup-event (cdr cell)))) | |
140 | + (and ev (cons (car cell) ev)))) | |
141 | + (cdr value)))) args))) | |
142 | + | |
143 | +(defun custom-keymap-widget (symbol value doc) | |
144 | + `(keymap :variable ,symbol | |
145 | + :value ,value | |
146 | + :doc ,doc)) | |
147 | + | |
148 | +(defun custom-keymap-group-widget (group spec) | |
149 | + (let | |
150 | + ((names (mapcar 'symbol-name (cdr (assq 'bindings custom-groups))))) | |
151 | + `(keymap-shell ,(mapcar #'(lambda (elt) | |
152 | + (list (car (prog1 names | |
153 | + (setq names (cdr names)))) | |
154 | + elt)) spec) | |
155 | + :commands ,(sort (apropos "" 'commandp) | |
156 | + #'(lambda (x y) | |
157 | + (< (symbol-name x) | |
158 | + (symbol-name y))))))) |