pprevos/emacs-writing-studio

missing theme file

buhtz opened this issue · 3 comments

buhtz commented

This is about the first part of your configure emacs tutorial.
https://lucidmanager.org/productivity/configure-emacs/

If I understood you correct use-package would download and install every package automaticly if it is not present. Right?

I am not sure if this is a "bug" or if I missunderstood it.

This is the config you described there.

;; Some tips from https://lucidmanager.org/productivity/configure-emacs/

;; === Package setup ===
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Initializes the package infrastructure
(package-initialize)

;; === use-package ==
;; use-package to simplify the config file
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)
  (setq use-package-always-ensure 't)

;; === Theme ===
(use-package material-theme
  :init (load-theme 'material-theme t))

But when I start my emacs (27.1 from Debian bullseye) I got the message
Error (use-package): material-theme/:init: Unable to find theme file for ‘material-theme’

Why is the material theme not installed by use-package.
And by the way the theme is still present on the hard drive (~/.emacs.d/elpa/material-theme-20201224.916) because it was used with another inti.el configuration.

Hi, the line (setq use-package-always-ensure 't) sets use-package to install packages that are not already present. The package is installed, but the load-theme parameter is wrong. Try this:

(use-package material-theme
  :init (load-theme 'material-theme t))
buhtz commented

Hi, the line (setq use-package-always-ensure 't) sets use-package to install packages that are not already present. The package is installed, but the load-theme parameter is wrong. Try this:

(use-package material-theme
  :init (load-theme 'material-theme t))

Please blame me if I am wrong. But I do not see a difference between mine and your parameter. Is there a typo in mine?

Oops, I accidentally copied your example :( It should be:

(use-package material-theme
  :config (load-theme 'material))

This is a confusing bit about themes. The package repository name includes the word theme, but not when invoking it. I changed it to :config to ensure the function is called after the package is installed.