Handle multiple emacs config files

This commit is contained in:
Erwin Boskma 2023-04-05 13:21:29 +02:00
parent 76718a4bf4
commit 489239b2ed
Signed by: erwin
SSH key fingerprint: SHA256:CyeNoWXd3kjX2Nwu6pDxxdS7OqmPVOy0NavA/KU/ntU
2 changed files with 22 additions and 6 deletions

View file

@ -17,7 +17,7 @@ Last export: {{{modification-time(%Y-%m-%d %H:%M)}}}
This ends up in =early-init.el=.
#+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle early-init.el
;; -*- lexical-binding: t; -*-
;; Prevent package.el from loading packages until we're ready for it
(setq package-enable-at-startup nil)
@ -37,6 +37,17 @@ This ends up in =early-init.el=.
;; compiled ahead-of-time when they are installed and site files are compiled
;; when gccemacs is installed.
(setq comp-deferred-compilation nil)
;; This should fix input lag by ~80% when using PGTK
(setq-default pgtk-wait-for-event-timeout 0)
#+end_src
** Enable lexical binding
Setting =lexical-binding= to =t= can improve startup time. This has to be first!
#+begin_src emacs-lisp
;; -*- lexical-binding: t; -*-
#+end_src
** Personal variables
@ -1136,6 +1147,7 @@ Rust support with [[https://github.com/rust-lang/rust-mode][rust-mode]].
:after lsp-mode
:hook
(rust-mode . lsp-deferred)
(rust-ts-mode . lsp-deferred)
(before-save . lsp-format-buffer)
(before-save . lsp-organize-imports)
:init

View file

@ -6,14 +6,16 @@
with lib; let
cfg = config.eboskma.programs.emacs;
tangleEmacsConfig = initFile: pkgs.runCommand "tangled-emacs-${initFile}" { } ''
cp ${./config.org} ./config.org
${cfg.package}/bin/emacs --batch --quick --load org ./config.org --funcall org-babel-tangle
cp ${initFile} $out
'';
emacsWithPackages = pkgs.emacsWithPackagesFromUsePackage {
config =
let
tangledOrgConfig = pkgs.runCommand "tangled-emacs-config" { } ''
cp ${./config.org} ./config.org
${cfg.package}/bin/emacs --batch -Q ./config.org -f org-babel-tangle
cp init.el $out
'';
tangledOrgConfig = tangleEmacsConfig "init.el";
in
builtins.readFile tangledOrgConfig;
@ -67,6 +69,8 @@ in
socketActivation.enable = true;
};
home.file."emacs.d/early-init.el".source = tangleEmacsConfig "early-init.el";
home.packages = with pkgs; [
(texlive.combine {
inherit (texlive) scheme-small wrapfig ulem capt-of;