2013-09-25 176 views
4
(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 + <alphanumberic value>時,它就拒絕工作。
在上述文件中,除<s-d>之外的所有綁定都正常工作。
我使用emacs 24.3的Fedora 13emacs中的超級密鑰綁定

+0

您需要使用矢量符號('[(超級d)]'),如下安德烈亞斯例子。 – juanleon

回答

5

宏的​​如此方便的原因在於,您傳遞參數的參數與Emacs在詢問關鍵綁定時告訴您的參數完全相同。你是猜測在論據,但你永遠不需要這樣做。

當鍵入C-Hķ(或C-HÇ),然後所討論的鍵序列時,Emacs將顯示一個消息描述該綁定。在這種情況下,它會將超級鍵+ d描述爲s-d

因此,您可以使用(kbd "s-d")來引用它。

  • 請求Emacs描述鍵序列
  • 插件答案爲​​
+0

你的回答非常精確。謝謝 !!! – Kaunteya

1

一些選擇其作品在這裏:

(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) 
1

所有這些都是從. . . /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) 

這裏是CTRL +選擇+命令的示例+ s在美國蘋果有線迷你鍵盤上:

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