I see that minor modes defined via define-minor-mode have a variable that has the same name as the function and the following documentation:

Setting this variable directly does not take effect; either customize it (see the info node ‘Easy Customization’) or call the function ‘editorconfig-mode’.

However, customizing doesn't seem to work for me. The value of the variable ends up as nill, “CHANGED outside Customize”, and the minor mode is not enabled unless I additionally add the following to my .emacs:

(editorconfig-mode 1)

In this example I'm using editorconfig-mode, but I have the issue with other modes too.

What am I missing? Do I need to do something extra or in a different order to get these customized variable to take effect?

  • I think that changing the variable value using Customize does not work (do the right thing) for some minor modes. Does the doc for editorconfig-mode say anything about this? If not, and if you don't get a helpful answer here, consider letting the mode author know - its doc should make this clear, if it's intended.
    – Drew
    Commented Jan 27, 2020 at 16:05
  • 1
    FYI this facility is working for me for the example editorconfig-mode in Emacs 26.3. I suggest you try to reproduce the issue with a minimal config; something in your normal config may be interfering.
    – phils
    Commented Jan 27, 2020 at 23:19

2 Answers 2


(package-initialize) must appear before (custom-set-variables …) in the initialisation file.

The next major release of GNU Emacs, version 27, will initialise packages before loading the init file, so this will no-longer be an issue.


This is a feature of global minor modes.

define-minor-mode declares a default custom1 :set value for the mode variable like so:

(unless set (setq set '(:set #'custom-set-minor-mode)))

That function is:

(defun custom-set-minor-mode (variable value)
  ":set function for minor mode variables.
Normally, this sets the default value of VARIABLE to nil if VALUE
is nil and to t otherwise,
but if `custom-local-buffer' is non-nil,
this sets the local binding in that buffer instead."
  (if custom-local-buffer
      (with-current-buffer custom-local-buffer
        (funcall variable (if value 1 0)))
    (funcall variable (if value 1 0))))

So this facility ought to be working generally, unless the mode in question has clobbered that default without replicating the behaviour.

1 The variable is only defined with defcustom if the mode is global, so this has no effect for buffer-local minor modes.

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.