-
I'm trying to use Elpaca with minimal-emacs.d but after putting the code in My pre-early-init.el:;;; pre-early-init.el --- code that run before early-init.el -*- no-byte-compile: t; lexical-binding: t; -*-
(setq minimal-emacs-gc-cons-threshold (* 64 1024 1024)
minimal-emacs-user-directory "~/.config/minimal-emacs/"
minimal-emacs-var-dir (expand-file-name "var/" minimal-emacs-user-directory)
package-user-dir (expand-file-name "elpa" minimal-emacs-var-dir)
user-emacs-directory minimal-emacs-var-dir
custom-file (expand-file-name "customs.el" minimal-emacs-var-dir)) My post-init.el:;;; post-init.el --- code that run after init.el -*- no-byte-compile: t; lexical-binding: t; -*-
;; Custom file
(load custom-file 'noerror 'nomessage)
;; Compile-angel
(setq load-prefer-newer t
native-comp-jit-compilation t
native-comp-deferred-compilation t)
(use-package compile-angel :ensure t :demand t
:custom (compile-angel-verbose nil)
:config
(compile-angel-on-load-mode)
(add-hook 'emacs-lisp-mode-hook #'compile-angel-on-save-local-mode))
;; Save history, reverts, recent files and positions
(use-package auto-revert :ensure nil
:hook (after-init . global-auto-revert-mode))
(use-package recentf :ensure nil
:hook (after-init . recentf-mode))
(use-package savehist :ensure nil
:hook (after-init . savehist-mode))
(use-package save-place :ensure nil
:hook (after-init . save-place-mode))
;; Minibuffer
(use-package vertico :ensure t
:commands vertico-mode
:hook (after-init . vertico-mode))
(use-package orderless :ensure t :defer t
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion)))))
(use-package marginalia :ensure t
:commands (marginalia-mode marginalia-cycle)
:hook (after-init . marginalia-mode))
(use-package embark :ensure t
:commands (embark-act
embark-dwim
embark-export
embark-collect
embark-bindings
embark-prefix-help-command)
:bind (("C-." . embark-act) ;; pick some comfortable binding
("C-;" . embark-dwim) ;; good alternative: M-.
("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
:init (setq prefix-help-command #'embark-prefix-help-command)
:config (add-to-list 'display-buffer-alist ;; Hide the mode line of the Embark live/completions buffers
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
(use-package embark-consult :ensure t
:hook (embark-collect-mode . consult-preview-at-point-mode))
(use-package consult :ensure t
:bind (;; C-c bindings in `mode-specific-map'
("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
([remap Info-search] . consult-info)
;; C-x bindings in `ctl-x-map'
("C-x M-:" . consult-complex-command)
("C-x b" . consult-buffer)
("C-x C-b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame)
("C-x t b" . consult-buffer-other-tab)
("C-x r b" . consult-bookmark)
("C-x p b" . consult-project-buffer)
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop)
;; M-g bindings in `goto-map'
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake)
("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline)
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings in `search-map'
("M-s d" . consult-find)
("M-s c" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history)
("M-s e" . consult-isearch-history)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history)
("M-r" . consult-history))
;; Enable automatic preview at point in the *Completions* buffer.
:hook (completion-list-mode . consult-preview-at-point-mode)
:init
;; Optionally configure the register formatting. This improves the register
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
;; Optionally tweak the register preview window.
(advice-add #'register-preview :override #'consult-register-window)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
:config
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
;; :preview-key "M-."
:preview-key '(:debounce 0.4 any))
(setq consult-narrow-key "<"))
;; LSP
(use-package eglot :ensure nil :defer t
:commands (eglot
eglot-rename
eglot-ensure
eglot-rename
eglot-format-buffer)
:custom
(eglot-report-progress nil) ; Prevent minibuffer spam
(eglot-autoshutdown t)
:config
;; Optimizations
(fset #'jsonrpc--log-event #'ignore)
(setq jsonrpc-event-hook nil)
(setq-default eglot-workspace-configuration
'((haskell
(formatProvider . "fourmolu"))))
(setq completion-category-overrides '((eglot (styles orderless))
(eglot-capf (styles orderless))))
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
:hook ((nix-ts-mode rust-ts-mode haskell-mode) . eglot-ensure))
;; TODO: Elpaca
;; (use-package eglot-booster
;; :ensure (:host github :repo "jdtsmith/eglot-booster")
;; :after eglot
;; :config
;; (eglot-booster-mode))
;; Completions
(use-package corfu :ensure t
:commands (corfu-mode global-corfu-mode)
:hook ((prog-mode . corfu-mode)
(shell-mode . corfu-mode)
(eshell-mode . corfu-mode))
:custom
;; Hide commands in M-x which do not apply to the current mode.
(read-extended-command-predicate #'command-completion-default-include-p)
;; Disable Ispell completion function. As an alternative try `cape-dict'.
(text-mode-ispell-word-completion nil)
(tab-always-indent 'complete)
:config (global-corfu-mode))
(use-package cape :ensure t :defer t
:commands (cape-dabbrev cape-file cape-elisp-block)
:bind ("C-c p" . cape-prefix-map)
:hook
(completion-at-point-functions . cape-dabbrev)
(completion-at-point-functions . cape-file)
(completion-at-point-functions . cape-elisp-block))
;; Hide warnings and display only errors
(setq warning-minimum-level :error)
;; Show possible keybindings
(use-package which-key
:ensure nil
:hook (after-init . which-key-mode))
;; Undo window modifications
(use-package winner :ensure nil
:hook (after-init . winner-mode))
;; Delete entire selection
(use-package delete-selection :ensure nil
:hook (after-init . delete-selection-mode))
;; Smooth scrolling
(use-package pixel-scroll-precision :ensure nil
:hook (after-init . pixel-scroll-precision-mode))
;; Handle buffer names for identically-named files
(use-package uniquify :ensure nil
:custom
(uniquify-buffer-name-style 'reverse)
(uniquify-separator "•")
(uniquify-after-kill-buffer-p t)
(uniquify-ignore-buffers-re "^\\*"))
;; Fonts
(let ((mono-spaced-font "Iosevka Comfy")
(proportionately-spaced-font "Geist"))
(set-face-attribute 'default nil :family mono-spaced-font :height 120)
(set-face-attribute 'fixed-pitch nil :family mono-spaced-font :height 1.0)
(set-face-attribute 'variable-pitch nil :family proportionately-spaced-font :height 1.0))
(use-package nerd-icons :ensure t :defer t)
(add-hook 'after-init-hook #'global-prettify-symbols-mode)
;; Modal Keybindings
(use-package meow
:ensure t
:defer t
:config
(defun meow-setup ()
(setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
(meow-motion-overwrite-define-key
'("j" . meow-next)
'("k" . meow-prev)
'("<escape>" . ignore))
(meow-leader-define-key
;; SPC j/k will run the original command in MOTION state.
'("j" . "H-j")
'("k" . "H-k")
;; Use SPC (0-9) for digit arguments.
'("1" . meow-digit-argument)
'("2" . meow-digit-argument)
'("3" . meow-digit-argument)
'("4" . meow-digit-argument)
'("5" . meow-digit-argument)
'("6" . meow-digit-argument)
'("7" . meow-digit-argument)
'("8" . meow-digit-argument)
'("9" . meow-digit-argument)
'("0" . meow-digit-argument)
'("/" . meow-keypad-describe-key)
'("?" . meow-cheatsheet)
'("r" . recentf)
'("e" . eat-other-window)
'(";" . comment-line)
)
(meow-normal-define-key
'("0" . meow-expand-0)
'("9" . meow-expand-9)
'("8" . meow-expand-8)
'("7" . meow-expand-7)
'("6" . meow-expand-6)
'("5" . meow-expand-5)
'("4" . meow-expand-4)
'("3" . meow-expand-3)
'("2" . meow-expand-2)
'("1" . meow-expand-1)
'("-" . negative-argument)
'(";" . meow-reverse)
'("," . meow-inner-of-thing)
'("." . meow-bounds-of-thing)
'("[" . meow-beginning-of-thing)
'("]" . meow-end-of-thing)
'("a" . meow-append)
'("A" . meow-open-below)
'("b" . meow-back-word)
'("B" . meow-back-symbol)
'("c" . meow-change)
'("d" . meow-delete)
'("D" . meow-backward-delete)
'("e" . meow-next-word)
'("E" . meow-next-symbol)
'("f" . meow-find)
'("g" . meow-cancel-selection)
'("G" . meow-grab)
'("h" . meow-left)
'("H" . meow-left-expand)
'("i" . meow-insert)
'("I" . meow-open-above)
'("j" . meow-next)
'("J" . meow-next-expand)
'("k" . meow-prev)
'("K" . meow-prev-expand)
'("l" . meow-right)
'("L" . meow-right-expand)
'("m" . meow-join)
'("n" . meow-search)
'("o" . meow-block)
'("O" . meow-to-block)
'("p" . meow-yank)
'("q" . meow-quit)
'("Q" . meow-goto-line)
'("r" . meow-replace)
'("R" . meow-swap-grab)
'("s" . meow-kill)
'("t" . meow-till)
'("u" . meow-undo)
'("U" . meow-undo-in-selection)
'("v" . meow-visit)
'("w" . meow-mark-word)
'("W" . meow-mark-symbol)
'("x" . meow-line)
'("X" . meow-goto-line)
'("y" . meow-save)
'("Y" . meow-sync-grab)
'("z" . meow-pop-selection)
'("'" . repeat)
'("<escape>" . ignore)))
:hook
(after-init . meow-setup)
(after-init . meow-global-mode))
;; Auto remove unused buffers
(use-package buffer-terminator
:ensure t
:custom
(buffer-terminator-verbose nil)
:hook
(after-init . buffer-terminator-mode))
;; Better help
(use-package helpful
:ensure t
:bind
(("C-h C-f" . helpful-callable)
("C-h f" . view-emacs-FAQ)
("C-h v" . helpful-variable)
("C-h k" . helpful-key)
("C-h x" . helpful-command)
("C-c C-d" . helpful-at-point)
("C-h F" . helpful-function)))
;; Dashboard
(use-package dashboard
:ensure t
:hook
(after-init . dashboard-setup-startup-hook)
:custom
(initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name)))
;; (dashboard-banner-logo-title "Bem-vindo ao Emacs!")
(dashboard-startup-banner 'logo)
(dashboard-center-content t)
(dashboard-vertically-center-content t)
(dashboard-items '((projects . 5)
(recents . 5)
(bookmarks . 5)))
(dashboard-display-icons-p t)
(dashboard-icon-type 'nerd-icons)
(dashboard-set-heading-icons t)
(dashboard-set-file-icons t))
;; Indentation
(use-package aggressive-indent
:ensure t
:hook
(after-init . global-aggressive-indent-mode)
:config
(add-to-list 'aggressive-indent-excluded-modes 'haskell-mode))
;; Parenthesis matching
(use-package paren-mode :ensure nil
:hook (prog-mode . show-paren-mode))
(use-package electric-pair :ensure nil
:hook (prog-mode . electric-pair-mode))
;; Auto theme switcher
(use-package auto-dark
:ensure t
:custom
(auto-dark-themes '((modus-vivendi) (modus-operandi)))
:hook (after-init . auto-dark-mode))
;; Terminal
(use-package eat :ensure t :defer t)
;; Git stuff
(use-package magit
:ensure t
:bind ("C-x g" . magit))
(use-package diff-hl
:ensure t
:hook
(after-init . global-diff-hl-mode)
(after-init . diff-hl-flydiff-mode)
(magit-post-refresh . diff-hl-magit-post-refresh))
;; Modes
(use-package treesit-auto
:ensure t
:custom
(treesit-auto-install 'prompt)
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode))
(use-package markdown-mode :ensure t :mode ("README\\.md\\'" . gfm-mode) :mode "\\.md\\'")
(use-package nix-ts-mode :ensure t :mode "\\.nix\\'")
(use-package haskell-mode
:ensure t
:mode "\\.hs\\'"
:hook
(haskell-mode . turn-on-haskell-indent))
(use-package rust-mode
:ensure t
:mode "\\.rs\\'"
:custom
(rust-format-on-save t)
(rust-mode-treesitter-derive t)) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 6 replies
-
I fixed the issue by removing the following from your configuration:
Keep in mind that if you change the
|
Beta Was this translation helpful? Give feedback.
-
Ensure that the If you place the entire configuration in
|
Beta Was this translation helpful? Give feedback.
-
I've made a minimal config to show that it doesn't work and help with the solution, which is placed in ~/.config/emacs: pre-early-init.el;;; pre-early-init.el --- code that run before early-init.el -*- no-byte-compile: t; lexical-binding: t; -*-
(setq minimal-emacs-gc-cons-threshold (* 64 1024 1024)
minimal-emacs-var-dir (expand-file-name "var/" minimal-emacs-user-directory)
package-user-dir (expand-file-name "elpa" minimal-emacs-var-dir)
user-emacs-directory minimal-emacs-var-dir
custom-file null-device) pre-init.el;;; pre-init.el --- code that run before init.el -*- no-byte-compile: t; lexical-binding: t; -*-
;; Elpaca bootstrap
(setq package-enable-at-startup nil)
(defvar elpaca-installer-version 0.8)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil :depth 1
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (apply #'call-process `("git" nil ,buffer t "clone"
,@(when-let* ((depth (plist-get order :depth)))
(list (format "--depth=%d" depth) "--no-single-branch"))
,(plist-get order :repo) ,repo))))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
;; Optional: Install use-package support
(elpaca elpaca-use-package
(elpaca-use-package-mode)) post-init.el;;; post-init.el --- code that run after init.el -*- no-byte-compile: t; lexical-binding: t; -*-
;; Dashboard
(use-package dashboard :ensure t
:hook (after-init . dashboard-setup-startup-hook)
:custom
(initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name)))
;; (dashboard-banner-logo-title "Bem-vindo ao Emacs!")
(dashboard-startup-banner 'logo)
(dashboard-center-content t)
(dashboard-vertically-center-content t)
(dashboard-items '((projects . 5)
(recents . 5)
(bookmarks . 5)))
(dashboard-display-icons-p t)
(dashboard-icon-type 'nerd-icons)
(dashboard-set-heading-icons t)
(dashboard-set-file-icons t)) This configuration shows this warning:
And this message:
|
Beta Was this translation helpful? Give feedback.
-
I found the problem of Elpaca, and it's related to NixOS, see here. So, Elpaca uses the build date to figure out some stuff and the Nixpkgs package doesn't provide it (for reproducibility purposes). Thanks for all the help and sorry to bother about it, if I find an automatic solution I'll put it here, otherwise it's just a matter of setting the elpaca-core-date. |
Beta Was this translation helpful? Give feedback.
-
No problem at all! Thank you for the update. It's great that you identified the issue. |
Beta Was this translation helpful? Give feedback.
I found the problem of Elpaca, and it's related to NixOS, see here. So, Elpaca uses the build date to figure out some stuff and the Nixpkgs package doesn't provide it (for reproducibility purposes). Thanks for all the help and sorry to bother about it, if I find an automatic solution I'll put it here, otherwise it's just a matter of setting the elpaca-core-date.