我有一个关于Emacs Lisp的问题.setq和setq-default有什么区别?我很困惑.
教程说setq在本地缓冲区生效,而setq-default影响所有缓冲区.
例如,如果我在init.el中写了(setq a-var a-vars-value),我发现在启动Emacs并打开一个新缓冲区之后,a-var也在那里,它的值是a-vars-value.我以为不应该在那里.似乎setq和setq-default之间没有区别.
我的理解有问题吗?
非常感谢你.
例如:
1)我在init.el文件中写了(setq hello 123),我在shell中运行emacs abuffer,然后我输入"hello Cx Ce",它显示"123".当我在所有新缓冲区中运行它时,会发生同样的情况.
2)我在init.el文件中写了(setq tab-width 4).当我运行tab-width Cx Ce时,它显示"8"(当前模式为'Text').但是,当我使用(setq-default tab-width 4)时,它显示"4".我无法解释这种现象.
我认为多行评论理想情况应该是这样的:
/* this is a mult-line comment, which wraps lines at some reasonable length,
* usually approximately 80 characters. this way, comments are easy to read
* and, with any half way capable text editor, easy to edit without having
* to manually reshuffle lines, line breaks, and the comment leader. */
// this is a mult-line comment, which wraps lines at some reasonable length,
// usually approximately 80 characters. this way, comments are easy to read
// and, with …Run Code Online (Sandbox Code Playgroud)