1 line
1.9 KiB
Plaintext
1 line
1.9 KiB
Plaintext
<!-- SC_OFF --><div class="md"><p>I'm using Emacs 27, and I'm using packages to load packages and customize to configure. How do I set up init.el so that Emacs will load a theme that is needed first, but then configure properly afterward?</p> <p>My example: Starting from scratch, I want to load monokai-theme from melpa and set it:</p> <pre><code>(require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (custom-set-variables '(custom-enabled-themes '(monokai)) '(custom-safe-themes '("d9646b131c4aa37f01f909fbdd5a9099389518eb68f25277ed19ba99adeb7279" default)) '(package-selected-packages '(monokai-theme))) (custom-set-faces ) </code></pre> <p>If monokai-theme is already downloaded, this works fine. But I want to have emacs download the package automatically if not already present. I use the following block:</p> <pre><code>(when (not package-archive-contents) (package-refresh-contents) (package-install-selected-packages) ) </code></pre> <p>If I add this below the customize variables, it installs monokai-theme but doesn't load it. I need to restart emacs. If I add this above the customize variables, it doesn't work because <code>package-selected-packages</code> is not loaded yet.</p> <p>There's a catch-22 here since each piece needs the other to run first.</p> <p>I want to see if I can configure most things in customize, but maybe customize is not right for this job? Should I be using customize at all?</p> </div><!-- SC_ON -->   submitted by   <a href="https://www.reddit.com/user/Ill_Report9350"> /u/Ill_Report9350 </a> <br/> <span><a href="https://www.reddit.com/r/emacs/comments/rubx6z/how_to_use_packages_and_customize_together/">[link]</a></span>   <span><a href="https://www.reddit.com/r/emacs/comments/rubx6z/how_to_use_packages_and_customize_together/">[comments]</a></span> |