1

How do you create options with radio boxes or check boxes in the menu bar? I can't find any examples.

1

See standard library menu-bar.el and C-h f menu-bar-make-toggle. Here are some examples from standard Emacs libraries.

For a checkbox (from menu-bar.el:

(define-key menu-bar-options-menu [case-fold-search]
  (menu-bar-make-toggle
    toggle-case-fold-search case-fold-search
    "Ignore Case for Search"
    "Case-Insensitive Search %s"
    "Ignore letter-case in search commands"))

For a radio button (from bubbles.el):

(define-key bubbles-game-theme-menu [bubbles-set-game-hard]
  (list 'menu-item "Hard" 'bubbles-set-game-hard
        :button '(:radio . (eq bubbles-game-theme 'hard))))

See also the Elisp manual, node Extended Menu Items.

  • Thanks, Drew. Radio buttons are so complicated! I will find another way to select options. – Elena Jun 27 '15 at 19:47
  • 1
    I updated the answer with a simpler :radio example. Just grep the Lisp source code for :radio to find more. – Drew Jun 27 '15 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.