我是Emacs / Elisp的初学者。 我想要以下内容:
这怎么可能这样做?我正在搜索Emacs文档,但我发现了一些信息碎屑。如果可能,请包含示例代码。
答案 0 :(得分:2)
恕我直言,您可以找到相当不错的信息here。作为起点,这是我从该手册改编的下拉菜单示例:
(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))