【发布时间】:2012-05-26 19:51:56
【问题描述】:
我试图将下划线视为forward/backward-word 函数的一部分,如here 和here 所述。我特别想让它在nxhtml 模式下工作,但我真的希望它在所有模式下都能像这样工作。
我已通过多种不同方式修改了我的site-start.el 文件,但均无济于事。但是如果我在缓冲区中手动执行命令M-x modify-syntax-table,它就可以正常工作。我只是无法将其作为默认行为。
这是我尝试放入 site-start.el 文件的内容:
;; 1
;; thought this would apply it to all modes - no error, but did not work
(modify-syntax-entry ?_ "w")
;; 2
;; thought this would automatically set it on a mode change - no error, but did not work
(defun change-major-mode-hook ()
(modify-syntax-entry ?_ "w"))
;; 3
;; thought this would apply it to all modes - no error, but did not work
(modify-syntax-entry ?_ "w")
;; 4
;; this produced a symbol's value as variable is void error
(modify-syntax-entry ?_ "w" nxhtml-mode-syntax-table)
我错过了什么?
【问题讨论】:
-
modify-syntax-entry的文档字符串说“仅针对表 SYNTAX-TABLE 更改了语法,默认为当前缓冲区的语法表”。没有什么建议您可以通过省略该参数来全局更改所有语法表。