当我查询快捷键映射的当前值时,例如使用M-: (current-local-map)
,它会显示以下内容:
Value:
(keymap
(S-mouse-2 . muse-follow-name-at-mouse-other-window)
(mouse-2 . muse-follow-name-at-mouse)
(33554445 . muse-follow-name-at-point-other-window)
(S-return . muse-follow-name-at-point-other-window)
(13 . muse-follow-name-at-point)
(return . muse-follow-name-at-point)
keymap
(67108924 . muse-decrease-list-item-indentation)
(67108926 . muse-increase-list-item-indentation)
(M-return . muse-insert-list-item)
(33554441 . muse-previous-reference)
(S-iso-lefttab . muse-previous-reference)
(S-tab . muse-previous-reference)
(S-mouse-2 . muse-follow-name-at-mouse-other-window)
(mouse-2 . muse-follow-name-at-mouse)
(33554445 . muse-follow-name-at-point-other-window)
(9 . muse-next-reference)
(tab . muse-next-reference)
(3 keymap
(19 . muse-search)
(2 . muse-find-backlinks)
(tab . muse-insert-thing)
(9 . muse-insert-thing)
(16 . muse-project-publish)
(6 . muse-project-find-file)
(61 . muse-what-changed)
(22 . muse-browse-result)
(27 keymap
(20 . muse-publish-this-file))
(33554452 . muse-publish-this-file)
(20 . muse-project-publish-this-file)
(12 . font-lock-mode)
(5 . muse-edit-link-at-point)
(1 . muse-index))
keymap
(27 keymap
(9 . ispell-complete-word)))
我希望看到的不是数字,而是更有意义的东西,比如(control ?c) return
。我该怎么做呢?
发布于 2010-08-14 05:18:45
API你知道命令API( keymaps?
(substitute-command-keys "\\{foo-map}")
),它通常显示当前的主要和次要模式的描述,通常与它们的foo-map
.
C-h m
被记录在“分类事件”中的Emacs Lisp手册。例如,(event-modifiers 33554445)
==> (shift control)
(format "%c" (event-basic-type 33554445))
==> "m"
发布于 2016-05-03 10:10:39
我只是根据Gilles的回答写了下面的内容,所以我想我应该把它贴出来。
我看到Drew的describe-keymap
有一个非常相似的基础,但也涵盖了其他各种用例,所以我倾向于建议使用它作为更完整的解决方案;但是FWIW:
(defun my-describe-keymap (keymap)
"Describe a keymap using `substitute-command-keys'."
(interactive
(list (completing-read
"Keymap: " (let (maps)
(mapatoms (lambda (sym)
(and (boundp sym)
(keymapp (symbol-value sym))
(push sym maps))))
maps)
nil t)))
(with-output-to-temp-buffer (format "*keymap: %s*" keymap)
(princ (format "%s\n\n" keymap))
(princ (substitute-command-keys (format "\\{%s}" keymap)))
(with-current-buffer standard-output ;; temp buffer
(setq help-xref-stack-item (list #'my-describe-keymap keymap)))))
发布于 2019-09-17 18:21:16
要使用更现代的方法,请使用which-key包中的which-key-show-full-keymap
命令。它将要求您提供一个键映射,然后显示来自该键映射的所有绑定,就像您按下前缀键一样(如果启用了which-key-mode
)。也就是说,在minibuffer中,很好而且干净。
从文档中:
which-key-show-full-keymap
是一个交互式的自动加载的编译Lisp函数,位于‘-key.el’中。
( which-key - Show -full-keymap KEYMAP)使用which-key显示KEYMAP中的所有绑定。键映射是从所有可用的键映射中以交互方式选择的。
https://stackoverflow.com/questions/3480173
复制相似问题