在下面的示例中,是否有人可以向make-sparse-keymap
提供一些帮助,并在该新的键映射中创建至少一个示例条目。
我想创建子菜单以更好地组织并向这些子菜单添加其他条目。此示例借用于menu-bar-update-buffers
中的函数menu-bar.el
,我已对该函数进行了修改,以使用右键单击pop-up
上下文菜单。
(setq lawlist-context-menu-command-entries
(list
'(command-separator "--")
(list
'next-buffer
'menu-item
"Next Buffer"
'next-buffer
:help "Switch to the \"next\" buffer in a cyclic order")
(list
'previous-buffer
'menu-item
"Previous Buffer"
'previous-buffer
:help "Switch to the \"previous\" buffer in a cyclic order")
(list
'select-named-buffer
'menu-item
"Select Named Buffer..."
'switch-to-buffer
:help "Prompt for a buffer name, and select that buffer in the current window")
(list
'list-all-buffers
'menu-item
"List All Buffers"
'list-buffers
:help "Pop up a window listing all Emacs buffers") ))
编辑:问题已解决 - 我修改了创建Frames
菜单文件夹的示例,就像在menu-bar-update-buffers
menu-bar.el
内完成一样。见下面的答案。
答案 0 :(得分:0)
我修改了创建Frames
菜单文件夹的示例,就像在menu-bar-update-buffers
menu-bar.el
内完成一样。问题解决了。 <而是使用make-sparse-keymap
,而不是keymap
。
(setq lawlist-context-menu-command-entries `(
(test-one-separator "--")
(test-one-folder-heading menu-item "TEST" ,(cons 'keymap (list
(list
'next-buffer
'menu-item
"Next Buffer"
'next-buffer
:help "Switch to the \"next\" buffer in a cyclic order")
(list
'previous-buffer
'menu-item
"Previous Buffer"
'previous-buffer
:help "Switch to the \"previous\" buffer in a cyclic order")
'(test-two-separator "--")
(list
'select-named-buffer
'menu-item
"Select Named Buffer..."
'switch-to-buffer
:help "Prompt for a buffer name, and select that buffer in the current window")
(list
'list-all-buffers
'menu-item
"List All Buffers"
'list-buffers
:help "Pop up a window listing all Emacs buffers"))))))