SystemCrafters / crafted-emacs

A sensible base Emacs configuration.
MIT License
739 stars 117 forks source link

[craftedv2beta] "Cannot open load file" "No such file or directory" "elisp-demos" #297

Closed greylegboas closed 1 year ago

greylegboas commented 1 year ago

Hi,

Apparently, elisp-demos is required by crafted-ui-config, but Emacs doesn't seem to install it. I've checked the offending package and it's on MELPA (https://github.com/xuchunyang/elisp-demos) – which doesn't seem to be enabled by default? I've enabled MELPA in my init.el; however, I had to install it manually (M-x package-list-packages).

Do I take it up with the package maintainer or perhaps it's not an intended behaviour (or is it?) andcrafted-ui-config needs reviewing?

Error (before enabling MELPA and installing elisp-demos):

Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "elisp-demos")
  require(elisp-demos)
  load-with-code-conversion("/home/ory/.config/crafted-emacs/modules/crafted-ui..." "/home/ory/.config/crafted-emacs/modules/crafted-ui..." nil t)
  require(crafted-ui-config)
  (progn (require 'crafted-ui-config))
  (setq elisp--eval-defun-result (progn (require 'crafted-ui-config)))
  elisp--eval-defun()
  eval-defun(nil)
  funcall-interactively(eval-defun nil)
  command-execute(eval-defun record)
  execute-extended-command(nil "eval-defun" "def")
  funcall-interactively(execute-extended-command nil "eval-defun" "def")
  command-execute(execute-extended-command)

Init.el:

;;; init.el --- Emacs Init configuration         -*- lexical-binding: t; -*-

;;; Commentary:

;;

;;; Code:

;; Enable MELPA
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))

;; Crafted-Emacs stuff
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (and custom-file
           (file-exists-p custom-file))
    (load custom-file nil :nomessage))

(load "~/.config/crafted-emacs/modules/crafted-init-config")

(require 'crafted-defaults-config)
(require 'crafted-init-config)
(require 'crafted-ui-config)
(require 'crafted-ui-packages)

Specs: Emacs version: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0) of 2023-05-14, modified by Debian Distro: Debian Linux 12 (Bookworm) Kernel: 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 GNU/Linux

Thanks, Ory

greylegboas commented 1 year ago

I've found crafted-early-init-config actually configures MELPA, so crafted-ui-config can pull in elisp-demos; but then it means crafted-ui-config is not a fully independent module – it relies on loading crafted-early-init-config or the user to configure MELPA manually.

Is this an intended behaviour?

jvdydev commented 1 year ago

Hi, thank you for opening an issue.

crafted-early-init-config (for early-init.el) and crafted-init-config (for init.el) are required modules. They configure the system to where crafted-emacs can be utilized (you can think of it as bootstrapping crafted-emacs).

So yes, crafted- modules may or may not be dependent on these modules (e.g. you can't require any crafted-emacs module without crafted-init-config as it adds the path to the modules to loadpath).

Regarding your original question, the error seems to be in requiring the -packages part of crafted-ui after package-install-selected-packages (missing from your init completely) and pulling in the crafted-ui-config.

The section of the init.el should probably look more something like:

;; Select packages
(require 'crafted-ui-packages)

;; Install selected packages
(package-install-selected-packages :noconfirm)

;; Load configurations
(require 'crafted-ui-config)

You also want to add the following to your early-init.el (or create one and add it):

;; Path adapted from what your init.el used
(load "~/.config/crafted-emacs/modules/crafted-early-init-config")

Hope that helped to solve your issue. You can also look at the documentation, notably (place in the info buffer in parens):

I did notice the absence of explaining the early-init.el configuration in Starting from an existing configuration. I think in general, the documentation around that is sparse/incomplete in explanations of how it works (yet) and of course there is still work to do on documenting the separate modules.

greylegboas commented 1 year ago

I understand it now. Thanks for the thorough explanation, @jvdydev!

jeffbowman commented 1 year ago

I did notice the absence of explaining the early-init.el configuration in Starting from an existing configuration. I think in general, the documentation around that is sparse/incomplete in explanations of how it works (yet)

Perhaps open an issue so we can track this?