reddit / emacs

How to prevent overwriting my custom-set-faces

OutOfCharm · 2022-11-01 13:17
Every time I use package-install or package-delete some stuff, it erases my custom-set-faces setting in my .emacs file. How to prevent this happen and let the setting be permanent? Details are elaborated as follows, given that I have two relevant blocks: **custom-set-variables** and **custom-set-faces**, ``` (custom-set-variables ... '(package-selected-packages '(**placeholder** pdf-tools avy counsel swiper ivy use-package org-roam expand-region flycheck magit auctex doom-themes timu-spacegrey-theme kaolin-themes cyberpunk-theme which-key helm treemacs ess spacemacs-theme company auto-complete multiple-cursors ##)) ... ``` Each time when I package-install or package-delete, the **placeholder** is replaced by a new package's name or left as blank. Simultaneously, the other block automatically changes from ``` (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 (:inherit nil :extend nil :stipple nil :background "#292A30" :foreground "#FFFFFF" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight bold :height 128 :width normal :foundry "DAMA" :family "Ubuntu Mono"))))) ``` to ``` (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 (:background nil))))) ``` All of above happens in .emacs file (not in .emacs.d or init.el).
ovopax · 2022-11-01 16:54
Can you describe it a little more detailed? Is . emacs your only config file or is there something in ~/. emacs.d or ~/.config/emacs? Which packages?
MitchellMarquez42 · 2022-11-01 16:55
Set the variable `custom-file` and move Custom-set-faces, custom-set-variables etc to it. Then put `(load custom-file)` in your init file.
thetemp_ · 2022-11-01 18:00
That shouldn't be happening at all. Even a package providing themes wouldn't touch the `custom-set-faces` block in your `custom-file` (by default, the same file as your `user-init-file`). Can you recreate this with a clean configuration that has nothing but the `custom-set-faces` block that's being overwritten?
OutOfCharm · 2022-11-02 02:27
Please see my updated info.
[deleted] · 2022-11-02 11:02
[deleted]
[deleted] · 2022-11-02 11:12
[deleted]
[deleted] · 2022-11-02 11:13
[deleted]
[deleted] · 2022-11-02 11:14
[deleted]