0

I just edited the variable org-M-RET-may-split-line with easy costumize, saved and applied. I checked my dotfile right afterwards and noticed that (custom-set-faces '(default ((t (:foreground "#DCDCCC" :background "#3F3F3F"))))) was added to my dotfile. This already happened a few times to me when using easy customize. Any idea how to prevent this?

EDIT: I'm able to reproduce the issue:

  • start spacemacs with emacs
  • open dotfile with SPC f e d
  • SPC f1 python-shell-interpreter
  • change value to python3
  • apply and save
  • bottom of dotfile, this is what was added:
;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(fci-rule-color "#383838" t)
 '(nrepl-message-colors
   (quote
    ("#CC9393" "#DFAF8F" "#F0DFAF" "#7F9F7F" "#BFEBBF" "#93E0E3" "#94BFF3" "#DC8CC3")))
 '(org-M-RET-may-split-line (quote ((default))))
 '(pdf-view-midnight-colors (quote ("#DCDCCC" . "#383838")))
 '(python-shell-interpreter "python3")
 '(vc-annotate-background "#2B2B2B")
 '(vc-annotate-color-map
   (quote
    ((20 . "#BC8383")
     (40 . "#CC9393")
     (60 . "#DFAF8F")
     (80 . "#D0BF8F")
     (100 . "#E0CF9F")
     (120 . "#F0DFAF")
     (140 . "#5F7F5F")
     (160 . "#7F9F7F")
     (180 . "#8FB28F")
     (200 . "#9FC59F")
     (220 . "#AFD8AF")
     (240 . "#BFEBBF")
     (260 . "#93E0E3")
     (280 . "#6CA0A3")
     (300 . "#7CB8BB")
     (320 . "#8CD0D3")
     (340 . "#94BFF3")
     (360 . "#DC8CC3"))))
 '(vc-annotate-very-old-color "#DC8CC3"))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "Office Code Pro" :foundry "NATH" :slant normal :weight normal :height 120 :width normal)))))
  • Can you provide a step-by-step recipe to reproduce what you reported, starting with emacs -Q (no init file)? That will likely help you get an answer. If you cannot, then try to bisect your init file to find out what seems to cause the behavior. – Drew Jun 9 '17 at 4:11
  • @Drew added and example – user430 Jun 9 '17 at 11:07
  • 1
    Thx. Can you simplify the recipe - is all of it necessary? For example, is using Spacemacs necessary to get the behavior? Please try to provide a minimal example - just what is needed. – Drew Jun 9 '17 at 13:39
  • @user430 I tried using spacemacs and was not able to replicate your problem. If you do not want this customized value for the default face, then I suggest that you use M-x customize-face RET default RET and select the "Revert..." button and choose the "Erase Customizations" option (to both remove it from the init file and -- importantly -- ensure that the current Emacs session will not add it back). – phils Nov 7 '17 at 5:50
  • If it comes back after that, then something elsewhere in your config is customizing that face. – phils Nov 7 '17 at 5:55
0

Do not touch the entries which customize inserts, thats all.

But you can also split the stuff which customize writes into another file with:

(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)

in your init.el. Then customize will write only to that file.

  • 2
    Two pieces of good advice. But this does not answer the question, I think. The question seems to be how does it happen that customizing a variable ends up (also?) customizing a face. – Drew Jun 9 '17 at 4:09
0

I don't have Spacemacs, but I looked for the function that saves customize buffers and found custom-save-all. It calls both custom-save-variables and custom-save-faces. So any time you save all customizations, both get called.

Looking at custom-save-faces, it doesn't check to see if you've changed any faces before it inserts custom-set-faces into your init or custom file - it only deletes the one that's there and replaces it with a newly constructed sexp. What seems strange to me is that you have a default face set there, while I do not; I don't know if that's a difference in Emacs (I'm on 24.5.1) or if it's something added by Spacemacs.

In any event, the hacky solution would be to redefine custom-save-faces to just return nil. That should work, but you'd lose the ability to customize faces. I haven't tested this, though. A proper solution would be much more involved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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