自定义.emacs文件打破了我的Meta键

时间:2012-02-13 13:04:18

标签: emacs

我已经自定义了我的.emacs文件,但只是打破了我的Meta键。像M-x这样的击键现在是未定义的。这是我的.emacs:

(setq default-major-mode 'text-mode)
(setq column-number-mode t)

;; haskell support
(load "/usr/local/lib/haskell-mode-2.8.0/haskell-site-file")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

;; key bindings
(global-set-key "\C-xl" 'goto-line)
(global-set-key "\C-xc" 'goto-char)
(global-set-key "\C-x?" 'help-command)
(global-set-key "\C-xp" 'previous-buffer)
(global-set-key "\C-xn" 'next-buffer)

(global-set-key "\C-h"  'backward-char)
(global-set-key "\C-l"  'forward-char)
(global-set-key "\C-k"  'previous-line)
(global-set-key "\C-j"  'next-line)
(global-set-key "\C-b"  'backward-word)
(global-set-key "\C-f"  'forward-word)
(global-set-key "\C-p"  'backward-sentence)
(global-set-key "\C-n"  'forward-sentence)
(global-set-key "\C-["  'beginning-of-defun)
(global-set-key "\C-]"  'end-of-defun)
(global-set-key "\C-[]" 'c-mark-function)

我在哪里做错了?

更新
我不知道为什么但是当我评论最后三行时,Meta键工作正常。

1 个答案:

答案 0 :(得分:6)

问题在于这一行:

(global-set-key "\C-["  'beginning-of-defun)

Control-[与按下转义键相同,转义键可用作元键(例如ESC xM-x相同),因此此键绑定会破坏元关键。