summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-06-14 01:00:51 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-06-14 01:00:51 +0200
commitcaae0709112c75d7cac72b5e2249b01cbea3d46c (patch)
tree6f49eb70e3c2f79a60183092efd59c69ea9cdcf9 /elisp
parente55009c09f5bcfd24fb00a31a2f9570f5c191689 (diff)
downloadgeiser-chez-caae0709112c75d7cac72b5e2249b01cbea3d46c.tar.gz
geiser-chez-caae0709112c75d7cac72b5e2249b01cbea3d46c.tar.bz2
Support for minor mode toggling in menus.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-menu.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/elisp/geiser-menu.el b/elisp/geiser-menu.el
index 25c4630..b279de2 100644
--- a/elisp/geiser-menu.el
+++ b/elisp/geiser-menu.el
@@ -98,6 +98,11 @@
((,title nil (lambda () (interactive) (customize-group ',group))))
,visible))
+(defmacro geiser-menu--mode-toggle (title bindings mode keymap visible)
+ `(geiser-menu--add-items ,keymap
+ ((,title ,bindings ,mode :button (:toggle . (and (boundp ',mode) ,mode))))
+ ,visible))
+
(defmacro geiser-menu--defmenu (keymap visible &rest keys)
(let ((fs))
(dolist (kd keys)
@@ -114,6 +119,12 @@
,(nth 2 kd)
,keymap
,visible))
+ ((eq 'mode (car kd))
+ `(geiser-menu--mode-toggle ,(nth 1 kd)
+ ,(nth 2 kd)
+ ,(nth 3 kd)
+ ,keymap
+ ,visible))
(t (error "Bad form: %s" kd)))
fs)))
`(progn ,@fs)))