【发布时间】:2013-01-31 18:46:49
【问题描述】:
我知道 TAB 想在 Emacs 中变得聪明。然而,它对我的口味还不够聪明。而且因为它“智能”,所以扩展起来似乎很复杂。
我希望 Clojure 模式下的 TAB 完全按照它的行为行事,例外当我在位于第 0 列的 defn, defmacro 等的第一个括号中时。
当它在那里时,我希望它改为从 hs-minor-mode 调用 hs-toggle-hiding。
但是我越来越疯狂地试图让它工作。
我首先尝试修改分配给 TAB 的快捷方式,以便仅在 Clojure 模式下时,它会首先调用我的函数,然后调用 indent-for-tab-command 但更改 TAB快捷方式似乎非常复杂。而且由于 Emacs 已经计划好模式可以在 lisp-indent-function 中注册其 TAB 函数的情况,我希望修改 clojure-indent-function,它说:
(defun clojure-indent-function (indent-point state)
"This function is the normal value of the variable `lisp-indent-function'.
然而,这个函数显然只有在光标位于函数内部时才被调用。不是当光标位于第一个 '(' 上时,比如 "(defn ...")。
在 Clojure 模式下并在括号中指向第 0 列时,如何让 TAB 调用 hs-toggle-hiding?
我不希望这影响 org-mode 或任何其他模式。只是 Clojure 模式。
【问题讨论】:
-
TAB在M-x describe-mode中绑定到什么?