編輯我的問題與snippet語法一直有關......下面的配置完全起作用。org-mode和yasnippet之間的衝突
我試圖用組織模式和yasnippet在一起,它甚至沒有與一些workarounds的組織模式常見問題的工作。每當我點擊代碼縮寫詞TAB時,這個詞就會被刪除。 TAB可以正常工作,如果我不是在一個片段字,所以有一些事情...
我使用Org-mode version 7.7
,yasnippet (version 0.7.0)
和GNU Emacs 23.4.1
。
這裏是我的設置:
(setq load-path
(append (list nil
"~/.emacs.d/site-lisp/yasnippet"
"~/.emacs.d/site-lisp/org-7.7/lisp")
load-path))
;; set up yasnippet
(require 'yasnippet)
(yas/initialize)
(setq yas/snippet-dirs '("~/.emacs.d/mysnippets"
"~/.emacs.d/site-lisp/yasnippet/snippets"))
(mapc 'yas/load-directory yas/snippet-dirs)
;; set up org mode
(require 'org-install)
;; fix some org-mode + yasnippet conflicts:
(defun yas/org-very-safe-expand()
(let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
(add-hook 'org-mode-hook
(lambda()
(make-variable-buffer-local 'yas/trigger-key)
(setq yas/trigger-key [tab])
(add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
(define-key yas/keymap [tab] 'yas/next-field)))
而且我敢肯定鉤運行按預期的章v ORG-製表第一鉤的在組織緩衝以下的輸出:
org-tab-first-hook is a variable defined in `org.el'.
Its value is
(yas/org-very-safe-expand org-hide-block-toggle-maybe org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe)
而這裏的章ķTAB在組織緩衝:
<tab> runs the command org-cycle, which is an interactive Lisp
function in `org.el'.
編輯
我yas/org-very-safe-expand
功能做一個edebug-defun
後,我看到下面的消息
Result: "[yas] elisp error! Symbol's value as variable is void: err"
所以亞斯某處error'ing了...我edebug
foo是沒有達到標準,但如果我有一些時間,我會嘗試單步執行,看看錯誤在哪裏。我的完整emacs配置在github here上。
仍然沒有運氣......我增加了一些我的問題更多信息。 – mgalgs 2012-03-02 17:25:28
原來我是個白癡。我的問題是snippet語法。祝你有個快樂的時光。 – mgalgs 2012-03-03 22:10:16