setq of case-sensitivity in .emacs has no effect

2019-06-22 05:52发布

I have a lot of custom stuff in my .emacs file: fonts, colors, window sizing, key bindings, etc. All of it works.

Then at the end, I just added a: (setq case-fold-search nil). It's a variable that when set to nil is supposed to make search case-sensitive in all emacs modes. It doesn't for me.

Setting case-fold-search to nil in an individual buffer works, but when I set it in .emacs, it doesn't work. Is there a reason why a setq declaration in a .emacs may not work sometimes? How should I try to debug the issue?

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-06-22 06:05

That's normal behavior for buffer-local variables. setq-default can be used to establish a default value for them.

You can determine that a variable is buffer local by checking out its documentation, using C-h v case-fold-search (or M-x describe-variable), which in this case reports (note 4th line):

case-fold-search is a variable defined in `buffer.c'.
Its value is t

  Automatically becomes buffer-local when set in any fashion.

Documentation:
*Non-nil if searches and matches should ignore case.

You can customize this variable.
查看更多
登录 后发表回答