3

In my Emacs init.el I have only the line (setq subword-mode t). When I use M-f and M-b in a word like WriteToFile it doesn't move point between subwords. When I do M-x subword-mode it disables it, so it was on. When I re-enable it, it works.

0

3 Answers 3

5

Try adding (global-subword-mode 1) to your emacs file, it worked for me!

1

Your solution of calling (subword-mode 1) instead of setting (setq subword-mode t) is correct.

The problem was that when you run M-x 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:

C-hig (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, and nil 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 interface1 will always properly enable or disable the mode, since Customize automatically runs the mode command for you.

1 see: (emacs) Easy Customization

0

Use this in the init file instead:

(add-hook 'c-mode-common-hook
               (lambda () (subword-mode 1)))
1
  • This post is being automatically flagged as low quality because it is so short. Would you mind expanding it by adding some text to explain how it solves the problem? Commented Jun 15, 2014 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.