我想为init.el文件设置大纲次要模式,并在以;开头的行上按下TAB键时。应调用函数outline-toggle-children以折叠和展开子标题。
下面是钩子的代码。但它并不像预期的那样对“TAB”键绑定起作用。
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(if (equal (buffer-name) "init.el")
(progn
(outline-regexp "^;+")
(outline-minor-mode 1)
(local-set-key (kbd "TAB") ; this does not work
(lambda ()
(if (string-match outline-regexp (thing-at-point 'line))
(outline-toggle-children))))))))