在Emacs键映射值中显示键

在Emacs键映射值中显示键,emacs,elisp,Emacs,Elisp,当我查询keymap的当前值时,例如使用M-:(当前本地映射),它会显示以下内容: 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-w

当我查询keymap的当前值时,例如使用
M-:(当前本地映射)
,它会显示以下内容:

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
,而不是数字。我该怎么做

  • 您知道命令
    C-hm
    descripe mode
    )吗?该命令通常显示当前主要和次要模式的描述,通常带有它们的键图

  • (替换命令键“\\{foo-map}”)
    描述模式
    内部用于生成keymap
    foo-map
    的用户友好描述

  • 如果您希望更接近keymap结构,那么该API将在Emacs Lisp手册中的“事件分类”中进行说明。例如,
    (事件修饰符33554445)
    ==>
    (换档控制)

    (格式“%c”(事件基本类型33554445))
    ==>
    “m”


    • 这是一个穷人的实现,它描述了绑定(C-HB),但仅限于特定的键映射。格式不太好,但应该让您开始:

      (defun describe-keymap (keymap &optional prefix)
        (pop-to-buffer "Keymap description")
        (erase-buffer)
        (describe-keymap-impl keymap prefix))
      
      (defun describe-keymap-impl (keymap &optional prefix)
        "show a description of keymap"
        (let (keymaps-to-process)
          (mapc (lambda (partofkeymap)
                  (when prefix
                    (insert (concat prefix " ")))
                  (insert (key-description (list partofkeymap)))
                  (insert "                ")
                  (cond ((atom partofkeymap))
                        ((listp (cdr partofkeymap))
                         (insert "prefix-key")
                         (if (eq 'keymap (cadr partofkeymap))
                             (setq keymaps-to-process (cons partofkeymap keymaps-to-process))))
                        (t 
                         (insert (symbol-name (cdr partofkeymap)))))
                  (insert "\n"))
                (if (and (symbolp keymap) (boundp keymap))
                    (symbol-value keymap)
                  keymap))
          (while keymaps-to-process
            (insert "\n\n")
            (describe-keymap-impl (cddar keymaps-to-process) (concat prefix (key-description (list (caar keymaps-to-process)))))
            (setq keymaps-to-process (cdr keymaps-to-process))))
        nil)
      
      我通过评估以下两个方面进行了测试:

      (describe-keymap emacs-lisp-mode-map)
      (describe-keymap 'emacs-lisp-mode-map)
      

      这就是您需要的:库
      帮助fns+.el

      这为您提供了C-hm-k命令
      descripe keymap
      ,它为绑定到变量的任何keymap提供了一个可读的描述。例如:

      C-hm-k方向模映射

      方向模式图 -------------- 有关更多信息,请查看手册。 “dired模式”缓冲区的本地密钥映射。 密钥绑定 --- ------- Ef-dired查找文件 重新定向查找文件 C-o直接显示文件 C-t前缀命令 ESC前缀命令 下一行是什么 ! dired do shell命令 #dired标志自动保存文件 $dired隐藏子目录 %前缀命令 &dired do异步shell命令 *前缀命令 +直接创建目录 -否定论点 . 直接清除目录 0 .. 9位参数 :前缀命令 下一个方向 ? 直接摘要 直接搜索 直接执行字节编译 直接复制 直接删除 G-dired-do-chgrp 硬链接 我开车去装货 我是迪德·多奇莫德 O dired do chown 印刷品 Q dired do查询替换regexp R dired do重命名 S dired do符号链接 不可触摸 U指示取消标记所有标记 X dired do shell命令 Z方向压缩 ^导航目录 dired查找备用文件 d方向标志文件删除 还原缓冲区 h描述模式 我有可能插入子目录 j方向转到文件 k-dired-do杀伤线 我渴望重新发现 m方向标记 下一行 o直接查找其他窗口中的文件 上一行 q退出窗口 s方向排序切换或编辑 t方向拨动标记 u方向取消标记 v方向视图文件 将文件名直接复制为kill x方向do标记删除 y方向显示文件类型 杀死这个缓冲区 ~dired标志备份文件 德尔迪雷德向后取消标记 老鼠脸 拖动鼠标查找其他窗口中的文件 ?? C-t C-t图像定向切换标记的拇指 C-t。图像导向显示拇指 C-t a图像直接显示拇指附加 C-t C图像定向注释文件 C-t d图像直接显示拇指 C-t e图像直接编辑注释和标记 C-t f图像定向标记标记文件 C-t i图像定向显示图像 C-t j图像直接跳转缩略图缓冲区 C-t r图像直接删除标记 C-t图像定向标记文件 C-t x图像定向显示外部 C-M-d使树倒下 C-M-n指向下一个细分市场 C-M-p方向上一次细分 C-M-u方向树向上 M-$dired隐藏所有 M-=直接备份差异 M-s前缀命令 M-{dired prev-marked文件 M-}dired下一个标记的文件 M-DEL dired取消标记所有文件 M-s是一个前缀命令 M-sf前缀命令 %垃圾文件的dired标志(&D) %C dired do copy regexp %H dired do hardlink regexp %R dired do rename regexp %S dired do symlink regexp %d方向标志文件regexp %g包含regexp的dired标记文件 %我把箱子拖下来 %m dired标记文件regexp %r dired do rename regexp %u向上外壳 *C-n驱动下一个标记的文件 *C-p方向上标记的文件 * ! 清除所有标记 *%dired标记文件regexp **dired-mark可执行文件 */dired标记目录 * ? dired取消标记所有文件 *@dired-mark符号链接 *直接变更标志 *m方向标记 *s方向标记子目录文件 *t方向拨动标记 *u方向取消标记 *德尔迪雷德向后取消标记 :d epa指令进行解密 :e epa dired do encrypt :s epa指令do标志 :v epa指令进行验证 直接撤销 下一行 上一行 直接切换只读 直接撤销 M-s f C-s定向搜索文件名 M-s f ESC前缀命令 M-s a C-s直接搜索 M-s a ESC前缀命令 M-s f C-M-s目录isearch文件名regexp M-s a C-M-s dired do isearch regexp
      我只是根据Gilles的观点写了以下内容 dired-mode-map -------------- For more information check the manuals. Local keymap for `dired-mode' buffers. key binding --- ------- e .. f dired-find-file RET dired-find-file C-o dired-display-file C-t Prefix Command ESC Prefix Command SPC dired-next-line ! dired-do-shell-command # dired-flag-auto-save-files $ dired-hide-subdir % Prefix Command & dired-do-async-shell-command * Prefix Command + dired-create-directory - negative-argument . dired-clean-directory 0 .. 9 digit-argument : Prefix Command dired-next-dirline ? dired-summary A dired-do-search B dired-do-byte-compile C dired-do-copy D dired-do-delete G dired-do-chgrp H dired-do-hardlink L dired-do-load M dired-do-chmod O dired-do-chown P dired-do-print Q dired-do-query-replace-regexp R dired-do-rename S dired-do-symlink T dired-do-touch U dired-unmark-all-marks X dired-do-shell-command Z dired-do-compress ^ dired-up-directory a dired-find-alternate-file d dired-flag-file-deletion g revert-buffer h describe-mode i dired-maybe-insert-subdir j dired-goto-file k dired-do-kill-lines l dired-do-redisplay m dired-mark n dired-next-line o dired-find-file-other-window p dired-previous-line q quit-window s dired-sort-toggle-or-edit t dired-toggle-marks u dired-unmark v dired-view-file w dired-copy-filename-as-kill x dired-do-flagged-delete y dired-show-file-type z kill-this-buffer ~ dired-flag-backup-files DEL dired-unmark-backward mouse-face dired-mouse-find-file-other-window ?? C-t C-t image-dired-dired-toggle-marked-thumbs C-t . image-dired-display-thumb C-t a image-dired-display-thumbs-append C-t c image-dired-dired-comment-files C-t d image-dired-display-thumbs C-t e image-dired-dired-edit-comment-and-tags C-t f image-dired-mark-tagged-files C-t i image-dired-dired-display-image C-t j image-dired-jump-thumbnail-buffer C-t r image-dired-delete-tag C-t t image-dired-tag-files C-t x image-dired-dired-display-external C-M-d dired-tree-down C-M-n dired-next-subdir C-M-p dired-prev-subdir C-M-u dired-tree-up M-$ dired-hide-all M-= dired-backup-diff M-s Prefix Command M-{ dired-prev-marked-file M-} dired-next-marked-file M-DEL dired-unmark-all-files M-s a Prefix Command M-s f Prefix Command % & dired-flag-garbage-files % C dired-do-copy-regexp % H dired-do-hardlink-regexp % R dired-do-rename-regexp % S dired-do-symlink-regexp % d dired-flag-files-regexp % g dired-mark-files-containing-regexp % l dired-downcase % m dired-mark-files-regexp % r dired-do-rename-regexp % u dired-upcase * C-n dired-next-marked-file * C-p dired-prev-marked-file * ! dired-unmark-all-marks * % dired-mark-files-regexp * * dired-mark-executables * / dired-mark-directories * ? dired-unmark-all-files * @ dired-mark-symlinks * c dired-change-marks * m dired-mark * s dired-mark-subdir-files * t dired-toggle-marks * u dired-unmark * DEL dired-unmark-backward : d epa-dired-do-decrypt : e epa-dired-do-encrypt : s epa-dired-do-sign : v epa-dired-do-verify dired-undo dired-next-line dired-previous-line dired-toggle-read-only dired-undo M-s f C-s dired-isearch-filenames M-s f ESC Prefix Command M-s a C-s dired-do-isearch M-s a ESC Prefix Command M-s f C-M-s dired-isearch-filenames-regexp M-s a C-M-s dired-do-isearch-regexp