In my Emacs init.el
I have only the line (setq subword-mode t)
. When I use Mf
and Mb
in a word like WriteToFile
it doesn't move point between subwords. When I do Mx subword-mode
it disables it, so it was on. When I re-enable it, it works.
尝试添加(global-subword-mode 1)
到你的emacs文件,它对我有用!
Your solution of calling (subword-mode 1)
instead of setting (setq subword-mode t)
is correct.
The problem was that when you run Mx subword-mode
it thinks it was on, because you had set the variable which is intended to hold this status. Therefore it runs the code to disable the mode, even though it wasn't enabled.
From the manual:
Ch i g (emacs) Minor Modes
RET
Most minor modes also have a "mode variable", with the same name as the mode command. Its value is non-
nil
if the mode is enabled, andnil
if it is disabled. In general, you should not try to enable or disable the mode by changing the value of the mode variable directly in Lisp; you should run the mode command instead. However, setting the mode variable through the Customize interface 1 will always properly enable or disable the mode, since Customize automatically runs the mode command for you.
1 see: (emacs) Easy Customization
Use this in the init file instead:
(add-hook 'c-mode-common-hook
(lambda () (subword-mode 1)))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.