Reputation: 331
I am a beginner at Emacs/Elisp. I want the following:
How is this possible to do this? I was searching the Emacs docs but I found just some crumbs of information. Please include example code if possible.
Upvotes: 3
Views: 841
Reputation: 9380
IMHO you can find pretty good information here. As starting point this is an example of a dropdown menu I adapted from that manual:
(require 'widget)
(require 'wid-edit)
(defun widget-example ()
"Create the widgets from the Widget manual."
(interactive)
(switch-to-buffer "*Example*")
(kill-all-local-variables)
(make-local-variable 'widget-example-repeat)
(let ((inhibit-read-only t))
(erase-buffer))
(remove-overlays)
(widget-create 'menu-choice
:value "Funny option"
:help-echo "Choose me, please!"
:notify (lambda (widget &rest ignore)
(message "%s is a good choice!"
(widget-value widget)))
'(choice-item "Example option")
'(choice-item "Funny option")
'(choice-item "Another Example option"))
(widget-insert "\n")
(use-local-map widget-keymap)
(widget-setup))
Upvotes: 4