2012-01-02 33 views
1

我想我的問題很明顯,但是我不知道Lisp,並且弄不清楚。每次我嘗試在python文件中寫入大寫「M」時,它都不起作用(它似乎認爲這是快捷方式的開始)。我的猜測是,它在某個模塊或我的.emacs文件中,它試圖將某些東西綁定到Alt +。但是,它將它與大寫M綁定。這是我的.emacs文件(其中我複製其中大部分來自網上):不能寫大寫M

; load-path setting is only needed if the directory you put 
; weblogger.el in isn't already in your load-path 
(add-to-list 'load-path "~/.emacs.d/") 

; Remap Ctrl-tab to M-Tab 
(define-key function-key-map [(control tab)] [?\M-\t]) 

(require 'ipython) 
(define-key py-mode-map (kbd "M-") 'anything-ipython-complete) 
(define-key py-shell-map (kbd "M-") 'anything-ipython-complete) 
(define-key py-mode-map (kbd "C-c M") 'anything-ipython-import-modules-from-buffer) 

(require 'python-mode) 
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode)) 

(require 'python-pep8) 
(require 'python-pylint) 

(require 'lambda-mode) 
(add-hook 'python-mode-hook #'lambda-mode 1) 

(require 'comint) 
(define-key comint-mode-map (kbd "M-") 'comint-next-input) 
(define-key comint-mode-map (kbd "M-") 'comint-previous-input) 
(define-key comint-mode-map [down] 'comint-next-matching-input-from-input) 
(define-key comint-mode-map [up] 'comint-previous-matching-input-from-input) 

(autoload 'pylookup-lookup "pylookup") 
(autoload 'pylookup-update "pylookup") 
(setq pylookup-program "~/.emacs.d/pylookup/pylookup.py") 
(setq pylookup-db-file "~/.emacs.d/pylookup/pylookup.db") 
(global-set-key "\C-ch" 'pylookup-lookup) 

(autoload 'autopair-global-mode "autopair" nil t) 
(autopair-global-mode) 
(add-hook 'lisp-mode-hook 
      #'(lambda() (setq autopair-dont-activate t))) 

(add-hook 'python-mode-hook 
      #'(lambda() 
       (push '(?' . ?') 
        (getf autopair-extra-pairs :code)) 
       (setq autopair-handle-action-fns 
        (list #'autopair-default-handle-action 
          #'autopair-python-triple-quote-action)))) 

(require 'python-pep8) 
(require 'python-pylint) 

(add-hook 'before-save-hook 'delete-trailing-whitespace) 

(autoload 'pylookup-lookup "pylookup") 
(autoload 'pylookup-update "pylookup") 
(setq pylookup-program "~/.emacs.d/pylookup/pylookup.py") 
(setq pylookup-db-file "~/.emacs.d/pylookup/pylookup.db") 
(global-set-key "\C-ch" 'pylookup-lookup) 

;; Initialize Rope 
(pymacs-load "ropemacs" "rope-") 
(setq ropemacs-enable-autoimport t) 

(require 'auto-complete) 
(global-auto-complete-mode t) 

;(when (require 'auto-complete nil t) 
; (require 'auto-complete-yasnippet) 
; (require 'auto-complete-python) 
; (require 'auto-complete-css) 
; (require 'auto-complete-cpp) 
; (require 'auto-complete-emacs-lisp) 
; (require 'auto-complete-semantic) 
; (require 'auto-complete-gtags)) 

; (global-auto-complete-mode t) 
; (setq ac-auto-start 3) 
; (setq ac-dwim t) 
; (set-default 'ac-sources '(ac-source-yasnippet ac-source-abbrev ac-source-words-in-buffer ac-source-files-in-current-dir ac-source-symbols)) 

; (load-library "init_python") 

任何想法,我應該開始尋找這個問題?一個簡單的搜索或任何其他方式來調試.emacs目錄中的文件?

回答

5

這看起來我錯了:

(define-key py-mode-map (kbd "M-") 'anything-ipython-complete) 
(define-key py-shell-map (kbd "M-") 'anything-ipython-complete) 
(define-key comint-mode-map (kbd "M-") 'comint-next-input) 
(define-key comint-mode-map (kbd "M-") 'comint-previous-input) 

​​期待一個完全的結合,但是你要M- 綁定到某些功能。我懷疑有一封信失蹤了。

(define-key py-mode-map (kbd "M-TAB") 'anything-ipython-complete) 

這裏,中號代表META其通常結合至​​ 或ESC

順便說一句,你可以做XÇ - ^h看到 次要模式的綁定開始X

+1

將字符串'C-h'(以及類似字符)寫成兩個kbd標籤是令人困惑的:它絕對讀爲按'C'鍵和'h'鍵,這完全不符合你想說的。你應該使用一個單獨的kbd標籤,或者明確地說明修飾鍵的名字,並且寫下'Ctrl'和'Meta'而不是'C'和'M'。 – phils 2012-01-02 23:23:16

+0

好的。 thnx,我看看它下班後(並可能接受答案):) – 2012-01-03 08:04:59

+0

工作就像一個魅力:) Thnx! – 2012-01-03 13:45:55