Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 363 lines (320 sloc) 13.038 kb
ee84d43 Phil Jackson Require assoc.
philjackson authored
1 (require 'assoc)
2
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
3 (defvar magit-key-mode-key-maps '()
4 "This will be filled lazily with proper `define-key' built
5 keymaps as they're reqeusted.")
4e7c192 Phil Jackson Moved the menu/key definitions into another file.
philjackson authored
6
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
7 (defvar magit-key-mode-buf-name "*magit-key*"
8 "Name of the buffer.")
9
2af8e2e Phil Jackson Fixed compile warnings by adding missing defvars.
philjackson authored
10 (defvar magit-key-mode-current-args '()
11 "Will contain the arguments to be passed to git.")
12
13 (defvar magit-key-mode-current-options '()
14 "Will contain the arguments to be passed to git.")
15
16 (defvar magit-log-mode-window-conf nil
17 "Will hold the pre-menu configuration of magit.")
18
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
19 (defvar magit-key-mode-groups
20 '((logging
21 (actions
a3f38d4 Phil Jackson Docs.
philjackson authored
22 ("l" "Short" magit-log)
23 ("L" "Long" magit-log-long)
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
24 ("h" "Reflog" magit-reflog)
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
25 ("H" "Reflog on head" magit-reflog-head))
26 (switches
bad6cc9 Phil Jackson Added merge commit switch.
philjackson authored
27 ("-m" "Only merge commits" "--merges")
cba1be0 Phil Jackson Put '-' in front of switch keys.
philjackson authored
28 ("-f" "First parent" "--first-parent")
ee332fd Phil Jackson Allow for case insensitivity in patterns.
philjackson authored
29 ("-i" "Case insesnitive patterns" "-i")
7058e07 Phil Jackson Added Pickaxe options.
philjackson authored
30 ("-p" "Pickaxe regex" "--pickaxe-regex")
0604574 Phil Jackson Basic argument display in place.
philjackson authored
31 ("-a" "All" "--all"))
32 (arguments
7058e07 Phil Jackson Added Pickaxe options.
philjackson authored
33 ("=b" "Branches" "--branches=" read-from-minibuffer)
34 ("=s" "Pickaxe search" "-S" read-from-minibuffer)
35 ("=a" "Author" "--author=" read-from-minibuffer)
36 ("=g" "Grep" "--grep=" read-from-minibuffer)))
e882f3c Phil Jackson Put rebasing commands in menu.
philjackson authored
37
0282351 Phil Jackson Added commands for running stuff.
philjackson authored
38 (running
39 (actions
40 ("!" "Command from root" magit-shell-command)
41 (":" "Git command" magit-git-command)))
42
b9ad565 Phil Jackson Slimmed right down the log-edit stuff.
philjackson authored
43 (committing
44 (actions
45 ("c" "Commit" magit-log-edit-commit))
46 (switches
47 ("-s" "Signoff" "--signoff")
48 ("-am" "Amend" "--amend")
49 ("-al" "All" "--all"))
08181fd Phil Jackson A couple more options for committing.
philjackson authored
50 ("-e" "Allow empty" "--allow-empty")
b9ad565 Phil Jackson Slimmed right down the log-edit stuff.
philjackson authored
51 (arguments
7058e07 Phil Jackson Added Pickaxe options.
philjackson authored
52 ("=au" "Author" "--author=" read-from-minibuffer)))
b9ad565 Phil Jackson Slimmed right down the log-edit stuff.
philjackson authored
53
548b2e5 Phil Jackson Separation of fetch and remote update.
philjackson authored
54 (fetching
55 (actions
56 ("f" "Fetch" magit-fetch)
57 ("r" "Remote update" magit-remote-update)))
58
c02fffb Phil Jackson Added push/pull menus.
philjackson authored
59 (pushing
60 (actions
78a3d70 Phil Jackson Added -n to push menu. Added magit-custom-options to push command.
philjackson authored
61 ("p" "Push" magit-push))
62 (switches
63 ("-d" "Dry run" "-n")))
c02fffb Phil Jackson Added push/pull menus.
philjackson authored
64
65 (pulling
66 (actions
67 ("p" "Pull" magit-pull))
68 (switches
69 ("-r" "Rebase" "--rebase")))
70
ceb77d5 Phil Jackson Added a branch menu.
philjackson authored
71 (branching
72 (actions
70ee1c5 Phil Jackson Added a branching menu.
philjackson authored
73 ("V" "Branch manager" magit-show-branches)
74 ("B" "Create" magit-create-branch)
75 ("m" "Move" magit-move-branch)
76 ("d" "Delete" magit-delete-branch)
ceb77d5 Phil Jackson Added a branch menu.
philjackson authored
77 ("c" "Checkout" magit-checkout)))
78
e91decf Phil Jackson Added a tagging menu.
philjackson authored
79 (tagging
80 (actions
81 ("t" "Lightweight" magit-tag)
82 ("T" "Annotated" magit-annotated-tag))
83 (switches
84 ("-f" "Force" "-f")))
85
2733adb Phil Jackson Added a stash menu.
philjackson authored
86 (stashing
87 (actions
88 ("s" "Save" magit-stash)
89 ("S" "Snapshot" magit-stash-snapshot))
90 (switches
91 ("-k" "Keep index" "--keep-index")))
92
653cc89 Phil Jackson Added a merge menu.
philjackson authored
93 (merging
94 (actions
bdebdfc Phil Jackson Merged the different type of... merges.
philjackson authored
95 ("m" "Merge" magit-merge))
653cc89 Phil Jackson Added a merge menu.
philjackson authored
96 (switches
bdebdfc Phil Jackson Merged the different type of... merges.
philjackson authored
97 ("-nf" "No fast-forward" "--no-ff")
98 ("-nc" "No commit" "--no-commit")
3dd1ef3 Robin Green Fix typo
greenrd authored
99 ("-sq" "Squash" "--squash"))
653cc89 Phil Jackson Added a merge menu.
philjackson authored
100 (arguments
101 ("-st" "Strategy" "--strategy" read-from-minibuffer)))
102
e882f3c Phil Jackson Put rebasing commands in menu.
philjackson authored
103 (rewriting
104 (actions
105 ("b" "Begin" magit-rewrite-start)
106 ("s" "Stop" magit-rewrite-stop)
107 ("a" "Abort" magit-rewrite-abort)
108 ("f" "Finish" magit-rewrite-finish)
109 ("*" "Set unused" magit-rewrite-set-unused)
110 ("." "Set used" magit-rewrite-set-used))))
955adde Phil Jackson Actions just about ready, keymap-wise.
philjackson authored
111 "Holds the key, help, function mapping for the log-mode. If you
112 modify this make sure you reset `magit-key-mode-key-maps' to
113 nil.")
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
114
70c3b4d Phil Jackson Func to add a new key group.
philjackson authored
115 (defun magit-key-mode-add-group (name)
116 "Add a new group to `magit-key-mode-key-maps'."
4b34f17 Phil Jackson Fix up the group helper functions to handle a case where there are no cu...
philjackson authored
117 (unless (assoc name magit-key-mode-groups)
118 (push (list name '(actions)) magit-key-mode-groups)))
70c3b4d Phil Jackson Func to add a new key group.
philjackson authored
119
8448f8a Phil Jackson Dedupe the magit-key-mode-insert-* functions.
philjackson authored
120 (defun magit-key-mode-update-group (for-group thing &rest args)
121 "Abstraction for setting values in `magit-key-mode-key-maps'."
122 (let* ((options (magit-key-mode-options-for-group for-group))
4b34f17 Phil Jackson Fix up the group helper functions to handle a case where there are no cu...
philjackson authored
123 (things (assoc thing options)))
124 (if (cdr things)
125 (setcdr (cdr things) (cons args (cddr things)))
126 (setcdr things (list args)))
127 (setq magit-key-mode-key-maps nil)
128 things))
8448f8a Phil Jackson Dedupe the magit-key-mode-insert-* functions.
philjackson authored
129
1f36bfb Phil Jackson Functions for plugins to add to the key groups.
philjackson authored
130 (defun magit-key-mode-insert-argument (for-group key desc arg read-func)
131 "Add a new binding (KEY) in FOR-GROUP which will use READ-FUNC
132 to receive input to apply to argument ARG git is run. DESC should
133 be a brief description of the binding."
8448f8a Phil Jackson Dedupe the magit-key-mode-insert-* functions.
philjackson authored
134 (magit-key-mode-update-group for-group 'arguments key desc arg read-func))
1f36bfb Phil Jackson Functions for plugins to add to the key groups.
philjackson authored
135
136 (defun magit-key-mode-insert-switch (for-group key desc switch)
137 "Add a new binding (KEY) in FOR-GROUP which will add SWITCH to git's
138 commandline when it runs. DESC should be a brief description of
139 the binding."
8448f8a Phil Jackson Dedupe the magit-key-mode-insert-* functions.
philjackson authored
140 (magit-key-mode-update-group for-group 'switches key desc switch))
1f36bfb Phil Jackson Functions for plugins to add to the key groups.
philjackson authored
141
142 (defun magit-key-mode-insert-action (for-group key desc func)
143 "Add a new binding (KEY) in FOR-GROUP which will run command
144 FUNC. DESC should be a brief description of the binding."
8448f8a Phil Jackson Dedupe the magit-key-mode-insert-* functions.
philjackson authored
145 (magit-key-mode-update-group for-group 'actions key desc func))
1f36bfb Phil Jackson Functions for plugins to add to the key groups.
philjackson authored
146
f6e921d Phil Jackson Simple pass at drawing actions.
philjackson authored
147 (defun magit-key-mode-options-for-group (for-group)
c9a33c6 Phil Jackson Docs.
philjackson authored
148 "Retrieve the options (switches, commands and arguments) for
149 the group FOR-GROUP."
f6e921d Phil Jackson Simple pass at drawing actions.
philjackson authored
150 (or (cdr (assoc for-group magit-key-mode-groups))
151 (error "Unknown group '%s'" for-group)))
152
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
153 (defun magit-key-mode-build-keymap (for-group)
154 "Construct a normal looking keymap for the key mode to use and
155 put it in magit-key-mode-key-maps for fast lookup."
f6e921d Phil Jackson Simple pass at drawing actions.
philjackson authored
156 (let* ((options (magit-key-mode-options-for-group for-group))
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
157 (actions (cdr (assoc 'actions options)))
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
158 (switches (cdr (assoc 'switches options)))
0604574 Phil Jackson Basic argument display in place.
philjackson authored
159 (arguments (cdr (assoc 'arguments options))))
b5ad1b1 Phil Jackson Keymap installs for mode.
philjackson authored
160 (let ((map (make-sparse-keymap)))
f6e921d Phil Jackson Simple pass at drawing actions.
philjackson authored
161 ;; all maps should 'quit' with C-g
e04f27d Phil Jackson Window config stored and reapplied on quit.
philjackson authored
162 (define-key map (kbd "C-g") (lambda ()
163 (interactive)
c0324a5 Phil Jackson Fixed quit.
philjackson authored
164 (magit-key-mode-command nil)))
b5ad1b1 Phil Jackson Keymap installs for mode.
philjackson authored
165 (when actions
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
166 (dolist (k actions)
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
167 (define-key map (car k) `(lambda ()
168 (interactive)
fc2fe2b Phil Jackson Arguments now being passed through.
philjackson authored
169 (magit-key-mode-command ',(nth 2 k))))))
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
170 (when switches
171 (dolist (k switches)
172 (define-key map (car k) `(lambda ()
cba1be0 Phil Jackson Put '-' in front of switch keys.
philjackson authored
173 (interactive)
174 (magit-key-mode-add-option
175 ',for-group
176 ,(nth 2 k))))))
0604574 Phil Jackson Basic argument display in place.
philjackson authored
177 (when arguments
178 (dolist (k arguments)
179 (define-key map (car k) `(lambda ()
180 (interactive)
181 (magit-key-mode-add-argument
182 ',for-group
217febc Phil Jackson Args being remembered.
philjackson authored
183 ,(nth 2 k)
184 ',(nth 3 k))))))
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
185 (aput 'magit-key-mode-key-maps for-group map)
b5ad1b1 Phil Jackson Keymap installs for mode.
philjackson authored
186 map)))
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
187
fc2fe2b Phil Jackson Arguments now being passed through.
philjackson authored
188 (defun magit-key-mode-command (func)
189 (let ((args '()))
190 ;; why can't maphash return a list?!
191 (maphash (lambda (k v)
7058e07 Phil Jackson Added Pickaxe options.
philjackson authored
192 (push (concat k (shell-quote-argument v)) args))
fc2fe2b Phil Jackson Arguments now being passed through.
philjackson authored
193 magit-key-mode-current-args)
194 (let ((magit-custom-options (append args magit-key-mode-current-options)))
195 (set-window-configuration magit-log-mode-window-conf)
c0324a5 Phil Jackson Fixed quit.
philjackson authored
196 (when func
e882f3c Phil Jackson Put rebasing commands in menu.
philjackson authored
197 (call-interactively func))
fc2fe2b Phil Jackson Arguments now being passed through.
philjackson authored
198 (magit-key-mode-kill-buffer))))
5be31a3 Phil Jackson Some font-locking.
philjackson authored
199
217febc Phil Jackson Args being remembered.
philjackson authored
200 (defvar magit-key-mode-current-args nil
201 "A hash-table of current argument set (which will eventually
202 make it to the git command-line).")
203
204 (defun debug-args ()
205 (interactive)
206 (maphash (lambda (k v) (print (format "%s: %s" k v))) magit-key-mode-current-args))
207
208 (defun magit-key-mode-add-argument (for-group arg-name input-func)
209 (let ((input (funcall input-func (concat arg-name ": "))))
210 (puthash arg-name input magit-key-mode-current-args)
fc2fe2b Phil Jackson Arguments now being passed through.
philjackson authored
211 (magit-key-mode-redraw for-group)))
217febc Phil Jackson Args being remembered.
philjackson authored
212
213 (defvar magit-key-mode-current-options '()
214 "Current option set (which will eventually make it to the git
215 command-line).")
0604574 Phil Jackson Basic argument display in place.
philjackson authored
216
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
217 (defun magit-key-mode-add-option (for-group option-name)
218 "Toggles the appearance of OPTION-NAME in
219 `magit-key-mode-current-options'."
220 (if (not (member option-name magit-key-mode-current-options))
221 (add-to-list 'magit-key-mode-current-options option-name)
222 (setq magit-key-mode-current-options
223 (delete option-name magit-key-mode-current-options)))
224 (magit-key-mode-redraw for-group))
5be31a3 Phil Jackson Some font-locking.
philjackson authored
225
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
226 (defun magit-key-mode-kill-buffer ()
c351215 Phil Jackson C-g kills buffer.
philjackson authored
227 (interactive)
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
228 (kill-buffer magit-key-mode-buf-name))
229
e04f27d Phil Jackson Window config stored and reapplied on quit.
philjackson authored
230 (defvar magit-log-mode-window-conf nil
231 "Pre-popup window configuration.")
232
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
233 (defun magit-key-mode (for-group &optional original-opts)
b335871 Phil Jackson Options var now buffer local.
philjackson authored
234 "Mode for magit key selection."
0a2965c Phil Jackson Experiment with a new style for the mappings.
philjackson authored
235 (interactive)
09ab17d Phil Jackson Doc.
philjackson authored
236 ;; save the window config to restore it as was (no need to make this
237 ;; buffer local)
e04f27d Phil Jackson Window config stored and reapplied on quit.
philjackson authored
238 (setq magit-log-mode-window-conf
239 (current-window-configuration))
240 ;; setup the mode, draw the buffer
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
241 (let ((buf (get-buffer-create magit-key-mode-buf-name)))
c3971bb Phil Jackson Revert (again) to the split-window method of display.
philjackson authored
242 (delete-other-windows)
243 (split-window-vertically)
b03829c Phil Jackson Make sure the menu turns up at the bottom of the window.
philjackson authored
244 (other-window 1)
c3971bb Phil Jackson Revert (again) to the split-window method of display.
philjackson authored
245 (switch-to-buffer buf)
e04f27d Phil Jackson Window config stored and reapplied on quit.
philjackson authored
246 (kill-all-local-variables)
55f0a9c Phil Jackson make-variable-buffer-local -> make-local-variable.
philjackson authored
247 (set (make-local-variable
e04f27d Phil Jackson Window config stored and reapplied on quit.
philjackson authored
248 'magit-key-mode-current-options)
249 original-opts)
55f0a9c Phil Jackson make-variable-buffer-local -> make-local-variable.
philjackson authored
250 (set (make-local-variable
217febc Phil Jackson Args being remembered.
philjackson authored
251 'magit-key-mode-current-args)
252 (make-hash-table))
fe2cbfc Phil Jackson Message to hint at what to do when presented with key menu.
philjackson authored
253 (magit-key-mode-redraw for-group))
254 (message "Type bindings prefixing option to action them."))
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
255
256 (defun magit-key-mode-redraw (for-group)
b335871 Phil Jackson Options var now buffer local.
philjackson authored
257 "(re)draw the magit key buffer."
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
258 (let ((buffer-read-only nil))
259 (erase-buffer)
260 (make-local-variable 'font-lock-defaults)
261 (use-local-map
262 (or (cdr (assoc for-group magit-key-mode-key-maps))
263 (magit-key-mode-build-keymap for-group)))
264 (magit-key-mode-draw for-group)
4211822 Phil Jackson Clear whitespace from key buffer.
philjackson authored
265 (delete-trailing-whitespace)
ec4cf70 Phil Jackson Fix buffer not being read-only.
philjackson authored
266 (setq mode-name "magit-key-mode" major-mode 'magit-key-mode))
e04f27d Phil Jackson Window config stored and reapplied on quit.
philjackson authored
267 (setq buffer-read-only t)
eba6873 Phil Jackson Move cursor to beginning of menu buffer.
philjackson authored
268 (goto-char (point-min))
e04f27d Phil Jackson Window config stored and reapplied on quit.
philjackson authored
269 (fit-window-to-buffer))
4e7c192 Phil Jackson Moved the menu/key definitions into another file.
philjackson authored
270
4ab9bab Phil Jackson Start of on-the-fly font-locking.
philjackson authored
271 (defun magit-key-mode-draw-header (header)
2cf4192 Phil Jackson Docs.
philjackson authored
272 "Draw a header with the correct face."
4ab9bab Phil Jackson Start of on-the-fly font-locking.
philjackson authored
273 (insert (propertize header 'face 'font-lock-keyword-face)))
274
ab566aa Phil Jackson draw-args function.
philjackson authored
275 (defun magit-key-mode-draw-args (args)
2cf4192 Phil Jackson Docs.
philjackson authored
276 "Draw the args part of the menu."
ab566aa Phil Jackson draw-args function.
philjackson authored
277 (when args
278 (magit-key-mode-draw-header "Args\n")
279 (dolist (argument args)
280 (insert
281 (format " %s: (%s) %s %s\n"
1440328 Phil Jackson All args fontified.
philjackson authored
282 (propertize
ab566aa Phil Jackson draw-args function.
philjackson authored
283 (car argument)
1440328 Phil Jackson All args fontified.
philjackson authored
284 'face 'font-lock-builtin-face)
ab566aa Phil Jackson draw-args function.
philjackson authored
285 (nth 1 argument)
286 (nth 2 argument)
287 (propertize
288 (gethash (nth 2 argument) magit-key-mode-current-args "")
1440328 Phil Jackson All args fontified.
philjackson authored
289 'face 'widget-field))))))
ab566aa Phil Jackson draw-args function.
philjackson authored
290
b67b255 Phil Jackson draw-switches function.
philjackson authored
291 (defun magit-key-mode-draw-switches (switches)
2cf4192 Phil Jackson Docs.
philjackson authored
292 "Draw the switches part of the menu."
b67b255 Phil Jackson draw-switches function.
philjackson authored
293 (when switches
e19f302 Phil Jackson Columify switches too.
philjackson authored
294 (let ((switch-strs (mapcar
295 (lambda (s)
296 (let ((option (nth 2 s)))
297 (format " %s: %s (%s)"
298 (propertize (car s)
299 'face 'font-lock-builtin-face)
300 (nth 1 s)
301 (if (member option magit-key-mode-current-options)
302 (propertize
303 option
304 'face 'font-lock-warning-face)
305 option))))
306 switches)))
307 (magit-key-mode-draw-header "Switches\n")
308 (magit-key-mode-draw-in-cols switch-strs))))
309
02600a8 Phil Jackson Pretty layout of actions.
philjackson authored
310 (defun magit-key-mode-draw-actions (actions)
2cf4192 Phil Jackson Docs.
philjackson authored
311 "Draw the actions part of the menu."
02600a8 Phil Jackson Pretty layout of actions.
philjackson authored
312 (when actions
e19f302 Phil Jackson Columify switches too.
philjackson authored
313 (let ((action-strs (mapcar
314 (lambda (a)
315 (format
316 " %s: %s"
317 (propertize (car a)
318 'face 'font-lock-builtin-face)
319 (nth 1 a)))
320 actions)))
4ab9bab Phil Jackson Start of on-the-fly font-locking.
philjackson authored
321 (magit-key-mode-draw-header "Actions\n")
e19f302 Phil Jackson Columify switches too.
philjackson authored
322 (magit-key-mode-draw-in-cols action-strs))))
323
fd23002 Phil Jackson Don't add a newline if a menu item is the last.
philjackson authored
324 (defun magit-key-mode-draw-in-cols (strings)
325 "Given a list of strings, print in columns (using `insert')."
564726a Phil Jackson Use `window-width' to wrap menu items.
philjackson authored
326 (let ((longest-act (apply 'max (mapcar 'length strings))))
fd23002 Phil Jackson Don't add a newline if a menu item is the last.
philjackson authored
327 (while strings
328 (let ((str (car strings)))
70ee1c5 Phil Jackson Added a branching menu.
philjackson authored
329 (let ((padding (make-string (- (+ longest-act 3) (length str)) ? )))
fd23002 Phil Jackson Don't add a newline if a menu item is the last.
philjackson authored
330 (insert str)
564726a Phil Jackson Use `window-width' to wrap menu items.
philjackson authored
331 (if (and (> (+ (current-column) longest-act) (window-width))
fd23002 Phil Jackson Don't add a newline if a menu item is the last.
philjackson authored
332 (cdr strings))
333 (insert "\n")
334 (insert padding))))
335 (setq strings (cdr strings))))
336 (insert "\n"))
02600a8 Phil Jackson Pretty layout of actions.
philjackson authored
337
f6e921d Phil Jackson Simple pass at drawing actions.
philjackson authored
338 (defun magit-key-mode-draw (for-group)
5be31a3 Phil Jackson Some font-locking.
philjackson authored
339 "Function used to draw actions, switches and parameters."
f6e921d Phil Jackson Simple pass at drawing actions.
philjackson authored
340 (let* ((options (magit-key-mode-options-for-group for-group))
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
341 (switches (cdr (assoc 'switches options)))
0604574 Phil Jackson Basic argument display in place.
philjackson authored
342 (arguments (cdr (assoc 'arguments options)))
f6e921d Phil Jackson Simple pass at drawing actions.
philjackson authored
343 (actions (cdr (assoc 'actions options))))
b67b255 Phil Jackson draw-switches function.
philjackson authored
344 (magit-key-mode-draw-switches switches)
bc47f3f Phil Jackson Put actions at the bottom of the group buffer to indicate flow.
philjackson authored
345 (magit-key-mode-draw-args arguments)
346 (magit-key-mode-draw-actions actions)))
f6e921d Phil Jackson Simple pass at drawing actions.
philjackson authored
347
527cc7a Phil Jackson Generate interactive popup functions (thanks Rémi).
philjackson authored
348 (defun magit-key-mode-generate (sym)
349 "Generate the key-group menu for SYM"
350 (let ((opts (magit-key-mode-options-for-group sym)))
351 (eval
352 `(defun ,(intern (concat "magit-key-mode-popup-" (symbol-name sym))) nil
353 ,(concat "Key menu for " (symbol-name sym))
354 (interactive)
355 (magit-key-mode (quote ,sym))))))
356
357 ;; create the interactive functions for the key mode popups
358 (mapc (lambda (g)
359 (magit-key-mode-generate (car g)))
360 magit-key-mode-groups)
361
5570e6a Phil Jackson Renamed key file, added kill-buffer.
philjackson authored
362 (provide 'magit-key-mode)
Something went wrong with that request. Please try again.