【问题标题】:Super key binding in emacsEmacs 中的超级键绑定
【发布时间】:2013-09-30 13:49:51
【问题描述】:
(global-set-key (kbd "<s-d>") 'duplicate-line)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECB MODE;;;;;;;;;;;;;;;;;;;;;
(global-set-key (kbd "<s-left>") 'ecb-goto-window-methods)
(global-set-key (kbd "<s-right>") 'ecb-goto-window-edit1)
(global-set-key (kbd "<s-down>") 'ecb-goto-window-history)
(global-set-key (kbd "<s-up>") 'ecb-goto-window-sources)
(global-set-key (kbd "<s-home>") 'ecb-goto-window-directories)

这是我的 .emacs 文件的一部分。我在绑定包含super 键的组合键时遇到了一个奇怪的问题。每当我将函数绑定到 super-key + &lt;alphanumberic value&gt; 时,它都会拒绝工作。
在上述文件中,除&lt;s-d&gt; 之外的所有绑定都可以正常工作。
我在 fedora 13 上使用 emacs 24.3

【问题讨论】:

  • 您需要使用矢量符号 ([(super d)]) 作为下面的 Andreas 示例。

标签: emacs key-bindings emacs24


【解决方案1】:

kbd 宏之所以如此方便,是因为您传递给它的参数与 Emacs 在询问键绑定时告诉您的完全一样。你在争论中猜测,但你永远不需要那样做。

当您键入 Chk(或 Chc)然后键入相关的键序列时,Emacs将显示一条描述该绑定的消息。在这种情况下,它将把 super-key + d 描述为s-d

因此你可以使用(kbd "s-d")来引用它。

  • 让 Emacs 描述一个键序列
  • 将答案插入kbd

【讨论】:

    【解决方案2】:

    一些在这里有效的选择:

    (global-set-key [(super ?\ö)] 'ar-beginning-of-comment-atpt)
    
    (global-set-key [(super ?\Ö)] 'ar-end-of-comment-atpt)
    
    (global-set-key [(super p)] 'View-sroll-line-backward)
    
    (global-set-key [(super s)] 'hs-hide-all)
    
    (global-set-key [(super tab)] 'scroll-up)
    
    (global-set-key [(super \{)] 'ar-brace-region-atpt)
    
    (global-set-key [(super space)] 'ar-whitespace-to-minus)
    
    (global-set-key [(super kp-4)] 'missing-py-variable-name-face-lp-1215791-test)
    

    【讨论】:

      【解决方案3】:

      所有这些都来自. . . /lisp/term/ns-win.el

      (define-key global-map [?\s-,] 'customize)
      (define-key global-map [?\s-'] 'next-multiframe-window)
      (define-key global-map [?\s-`] 'other-frame)
      (define-key global-map [?\s-~] 'ns-prev-frame)
      (define-key global-map [?\s--] 'center-line)
      (define-key global-map [?\s-:] 'ispell)
      (define-key global-map [?\s-?] 'info)
      (define-key global-map [?\s-^] 'kill-some-buffers)
      (define-key global-map [?\s-&] 'kill-this-buffer)
      (define-key global-map [?\s-C] 'ns-popup-color-panel)
      (define-key global-map [?\s-D] 'dired)
      (define-key global-map [?\s-E] 'edit-abbrevs)
      (define-key global-map [?\s-L] 'shell-command)
      (define-key global-map [?\s-M] 'manual-entry)
      (define-key global-map [?\s-S] 'ns-write-file-using-panel)
      (define-key global-map [?\s-a] 'mark-whole-buffer)
      (define-key global-map [?\s-c] 'ns-copy-including-secondary)
      (define-key global-map [?\s-d] 'isearch-repeat-backward)
      (define-key global-map [?\s-e] 'isearch-yank-kill)
      (define-key global-map [?\s-f] 'isearch-forward)
      (define-key global-map [?\s-g] 'isearch-repeat-forward)
      (define-key global-map [?\s-h] 'ns-do-hide-emacs)
      (define-key global-map [?\s-H] 'ns-do-hide-others)
      (define-key global-map [?\s-j] 'exchange-point-and-mark)
      (define-key global-map [?\s-k] 'kill-this-buffer)
      (define-key global-map [?\s-l] 'goto-line)
      (define-key global-map [?\s-m] 'iconify-frame)
      (define-key global-map [?\s-n] 'make-frame)
      (define-key global-map [?\s-o] 'ns-open-file-using-panel)
      (define-key global-map [?\s-p] 'ns-print-buffer)
      (define-key global-map [?\s-q] 'save-buffers-kill-emacs)
      (define-key global-map [?\s-s] 'save-buffer)
      (define-key global-map [?\s-t] 'ns-popup-font-panel)
      (define-key global-map [?\s-u] 'revert-buffer)
      (define-key global-map [?\s-v] 'yank)
      (define-key global-map [?\s-w] 'delete-frame)
      (define-key global-map [?\s-x] 'kill-region)
      (define-key global-map [?\s-y] 'ns-paste-secondary)
      (define-key global-map [?\s-z] 'undo)
      (define-key global-map [?\s-|] 'shell-command-on-region)
      (define-key global-map [s-kp-bar] 'shell-command-on-region)
      ;; (as in Terminal.app)
      (define-key global-map [s-right] 'ns-next-frame)
      (define-key global-map [s-left] 'ns-prev-frame)
      

      以下是美国 Apple 有线迷你键盘上 ctrl+opt+command+s 的示例:

      (define-key global-map (kbd "<M-C-s-268632083>") 'help-for-help)
      

      【讨论】:

        猜你喜欢
        • 2014-09-01
        • 1970-01-01
        • 2014-10-31
        • 1970-01-01
        • 2016-12-15
        • 1970-01-01
        • 1970-01-01
        • 2011-02-20
        相关资源
        最近更新 更多