我正在尝试在所有打开的缓冲区和 yasnippet 中完成制表符以使用制表符键。目前我可以有一个或另一个。以下代码是我处理 yasnippet 扩展的方式,但由于我不是 lisp 程序员,我在这里看不到错误。
如果它无法扩展片段,我希望它尝试从缓冲区扩展。
;; Auto complete settings / tab settings
;; http://emacsblog.org/2007/03/12/tab-completion-everywhere/ <-- in the comments
(global-set-key [(tab)] 'smart-tab)
(defun smart-tab ()
"This smart tab is minibuffer compliant: it acts as usual in
the minibuffer. Else, if mark is active, indents region. Else if
point is at the end of a symbol, expands it. Else indents the
current line."
(interactive)
(if (minibufferp)
(unless (minibuffer-complete)
(dabbrev-expand nil))
(if mark-active
(indent-region (region-beginning)
(region-end))
(if (looking-at "\\_>")
(unless (yas/expand)
(dabbrev-expand nil))
(indent-for-tab-command)))))