emacs/var/elfeed/db/data/3b/3be420908de5d0987a5a46292bdaa820a76d42a3
2022-01-03 12:49:32 -06:00

1 line
1.9 KiB
Plaintext

<!-- SC_OFF --><div class="md"><p>I&#39;m using Emacs 27, and I&#39;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 &#39;package) (add-to-list &#39;package-archives &#39;(&quot;melpa&quot; . &quot;https://melpa.org/packages/&quot;) t) (custom-set-variables &#39;(custom-enabled-themes &#39;(monokai)) &#39;(custom-safe-themes &#39;(&quot;d9646b131c4aa37f01f909fbdd5a9099389518eb68f25277ed19ba99adeb7279&quot; default)) &#39;(package-selected-packages &#39;(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&#39;t load it. I need to restart emacs. If I add this above the customize variables, it doesn&#39;t work because <code>package-selected-packages</code> is not loaded yet.</p> <p>There&#39;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 --> &#32; submitted by &#32; <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> &#32; <span><a href="https://www.reddit.com/r/emacs/comments/rubx6z/how_to_use_packages_and_customize_together/">[comments]</a></span>