mirror of
https://github.com/materusPL/nixos-config
synced 2026-07-02 12:46:42 +00:00
update
This commit is contained in:
@@ -1,41 +1,84 @@
|
||||
;;; -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar materus/init-early t) ; Var to ensure early-init loaded
|
||||
(setq materus/init-early t) ; Probably useless
|
||||
(setenv "LSP_USE_PLISTS" "true")
|
||||
(setq c-default-style nil)
|
||||
(defvar materus/init-early t
|
||||
"Is emacs using materus early init") ; Var to ensure early-init loaded, not used anymore but keeping it anyway
|
||||
(setq materus/init-early t) ; Probably useless
|
||||
|
||||
(set-language-environment "UTF-8")
|
||||
(setq default-input-method nil)
|
||||
(setenv "LSP_USE_PLISTS" "true") ; Make lsp-mode use plists
|
||||
;;
|
||||
(setq c-default-style nil) ; Clear default styles for languages, will set them up later
|
||||
(setq default-input-method nil) ; Disable default input method, I'm not using them anyway so far
|
||||
(setq initial-major-mode 'fundamental-mode) ; Use fundamental mode in scratch buffer, speed up loading, not really important when emacs used as daemon
|
||||
(setq auto-save-default nil) ; TODO: configure auto saves, disable for now
|
||||
(setq backup-directory-alist
|
||||
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Set backup location
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(concat user-emacs-directory "var/recovery/") t))) ; Set auto-save location
|
||||
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/")) ; Set auto-save-list location
|
||||
(setq load-prefer-newer t) ; Prefer newer files to load
|
||||
|
||||
;; Packages
|
||||
(setq package-enable-at-startup t) ; Ensure packages are enable since I'm either using built in package manager or nix
|
||||
(setq package-quickstart nil) ; Disable package quickstart, it's annoying if forget to update it and doesn't speed up much
|
||||
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra")) ; Extra load path for packages
|
||||
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" )) ; Set elpa path for this emacs version, should use nix packages anyway so keeping just in case
|
||||
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" )) ; Set path to gnupg for elpa
|
||||
(add-to-list 'package-archives
|
||||
'("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/")) ; Add nongnu-devel repo to package manager
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ; Add melpa repo to package manager
|
||||
(customize-set-variable 'package-archive-priorities '(("gnu" . 99)
|
||||
("nongnu" . 80)
|
||||
("nongnu-devel" . 70)
|
||||
("melpa" . 0))) ; Repository priority
|
||||
;;
|
||||
|
||||
(setq inhibit-compacting-font-caches t) ; Don't compact fonts
|
||||
|
||||
(set-language-environment "UTF-8") ; Use UTF-8
|
||||
|
||||
(setq custom-file (concat user-emacs-directory "etc/custom.el")) ; Set custom file location, don't want clutter in main directory
|
||||
(setq custom-theme-directory
|
||||
(expand-file-name "/etc/materus/themes/" user-emacs-directory)) ; Set custom themes location
|
||||
|
||||
(setq ring-bell-function 'ignore) ; Disable bell
|
||||
|
||||
|
||||
(defvar materus-emacs-gc-cons-threshold (* 32 1024 1024)
|
||||
"The value of `gc-cons-threshold' after Emacs startup.") ; Define after init garbage collector threshold
|
||||
|
||||
(setq gc-cons-threshold most-positive-fixnum) ; Set `gc-cons-threshold' so it won't collectect during initialization
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq gc-cons-threshold materus-emacs-gc-cons-threshold))) ; Set `gc-cons-threshold' to desired value after startup
|
||||
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
(setq frame-resize-pixelwise t)
|
||||
(setq window-resize-pixelwise t) ; Allow pixelwise resizing of window and frame
|
||||
|
||||
(setq initial-major-mode 'fundamental-mode)
|
||||
(setq native-comp-async-report-warnings-errors nil)
|
||||
(setq package-enable-at-startup nil)
|
||||
(unless (daemonp)
|
||||
(add-to-list 'initial-frame-alist '(fullscreen . maximized)))
|
||||
(setq default-frame-alist
|
||||
'((width . 130)
|
||||
(height . 40)))
|
||||
(add-to-list 'initial-frame-alist '(fullscreen . maximized))) ; Start first frame maximized if not running as daemon, daemon frame are set up later in config
|
||||
(setq default-frame-alist ; Set default size for frames
|
||||
'((width . 130)
|
||||
(height . 40)))
|
||||
|
||||
(setq native-comp-speed 3)
|
||||
(add-hook 'emacs-startup-hook (lambda () (package-initialize)
|
||||
(setq gc-cons-threshold 100000000 ; ~100mb
|
||||
gc-cons-percentage 0.1)
|
||||
))
|
||||
(unless (daemonp)
|
||||
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
|
||||
gc-cons-percentage 0.6)
|
||||
(advice-add #'tty-run-terminal-initialization :override #'ignore)
|
||||
(add-hook 'window-setup-hook
|
||||
(lambda ()
|
||||
(advice-remove #'tty-run-terminal-initialization #'ignore)
|
||||
(advice-add #'tty-run-terminal-initialization :override #'ignore)
|
||||
(add-hook 'window-setup-hook
|
||||
(lambda ()
|
||||
(unless (display-graphic-p)
|
||||
(advice-remove #'tty-run-terminal-initialization #'ignore)
|
||||
(tty-run-terminal-initialization (selected-frame) nil t)
|
||||
)
|
||||
)
|
||||
)
|
||||
)))
|
||||
|
||||
(when (boundp 'native-comp-eln-load-path) ; Change dir for eln-cache
|
||||
(startup-redirect-eln-cache (expand-file-name "/var/eln-cache/" user-emacs-directory)))
|
||||
(setq native-comp-async-report-warnings-errors nil) ; Silence warnings
|
||||
(setq native-comp-speed 3) ; Set native-comp speed
|
||||
|
||||
(setq native-comp-jit-compilation t
|
||||
;native-comp-deferred-compilation t
|
||||
package-native-compile t)
|
||||
|
||||
|
||||
;; Setting up native-comp cache location
|
||||
|
||||
(when (and (fboundp 'startup-redirect-eln-cache)
|
||||
(fboundp 'native-comp-available-p)
|
||||
@@ -43,11 +86,3 @@
|
||||
(startup-redirect-eln-cache
|
||||
(convert-standard-filename
|
||||
(expand-file-name "var/eln-cache/" user-emacs-directory))))
|
||||
|
||||
(setq auto-save-default nil)
|
||||
(setq backup-directory-alist
|
||||
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Change backup and auto save dir to var dir
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(concat user-emacs-directory "var/recovery/") t)))
|
||||
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/"))
|
||||
(setq custom-file (concat user-emacs-directory "etc/custom.el"))
|
||||
|
||||
@@ -3,11 +3,18 @@
|
||||
#+DESCRIPTION: materus emacs configuration
|
||||
#+STARTUP: overview
|
||||
#+PROPERTY: header-args :tangle etc/materus/emacs-config.el :comments link
|
||||
#+OPTIONS: \n:t
|
||||
#+auto_tangle: t
|
||||
|
||||
My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
|
||||
|
||||
* Table of Contents :noexport:TOC_3:
|
||||
- [[#init-files][Init Files]]
|
||||
- [[#early-init][Early Init]]
|
||||
- [[#early-init-variables][Early Init Variables]]
|
||||
- [[#garbage-collector][Garbage Collector]]
|
||||
- [[#early-frame-settings][Early Frame Settings]]
|
||||
- [[#native-compilation][Native compilation]]
|
||||
- [[#init][Init]]
|
||||
- [[#compile-time][Compile Time]]
|
||||
- [[#packages][Packages]]
|
||||
@@ -60,44 +67,100 @@ Early init file, setting for GC and some paths.
|
||||
#+begin_src emacs-lisp :comments no
|
||||
;;; -*- lexical-binding: t; -*-
|
||||
#+end_src
|
||||
*** Early Init Variables
|
||||
Setting early init variables
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
(defvar materus/init-early t) ; Var to ensure early-init loaded
|
||||
(setq materus/init-early t) ; Probably useless
|
||||
(setenv "LSP_USE_PLISTS" "true")
|
||||
(setq c-default-style nil)
|
||||
(defvar materus/init-early t
|
||||
"Is emacs using materus early init") ; Var to ensure early-init loaded, not used anymore but keeping it anyway
|
||||
(setq materus/init-early t) ; Probably useless
|
||||
|
||||
(set-language-environment "UTF-8")
|
||||
(setq default-input-method nil)
|
||||
(setenv "LSP_USE_PLISTS" "true") ; Make lsp-mode use plists
|
||||
;;
|
||||
(setq c-default-style nil) ; Clear default styles for languages, will set them up later
|
||||
(setq default-input-method nil) ; Disable default input method, I'm not using them anyway so far
|
||||
(setq initial-major-mode 'fundamental-mode) ; Use fundamental mode in scratch buffer, speed up loading, not really important when emacs used as daemon
|
||||
(setq auto-save-default nil) ; TODO: configure auto saves, disable for now
|
||||
(setq backup-directory-alist
|
||||
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Set backup location
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(concat user-emacs-directory "var/recovery/") t))) ; Set auto-save location
|
||||
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/")) ; Set auto-save-list location
|
||||
(setq load-prefer-newer t) ; Prefer newer files to load
|
||||
|
||||
;; Packages
|
||||
(setq package-enable-at-startup t) ; Ensure packages are enable since I'm either using built in package manager or nix
|
||||
(setq package-quickstart nil) ; Disable package quickstart, it's annoying if forget to update it and doesn't speed up much
|
||||
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra")) ; Extra load path for packages
|
||||
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" )) ; Set elpa path for this emacs version, should use nix packages anyway so keeping just in case
|
||||
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" )) ; Set path to gnupg for elpa
|
||||
(add-to-list 'package-archives
|
||||
'("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/")) ; Add nongnu-devel repo to package manager
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ; Add melpa repo to package manager
|
||||
(customize-set-variable 'package-archive-priorities '(("gnu" . 99)
|
||||
("nongnu" . 80)
|
||||
("nongnu-devel" . 70)
|
||||
("melpa" . 0))) ; Repository priority
|
||||
;;
|
||||
|
||||
(setq inhibit-compacting-font-caches t) ; Don't compact fonts
|
||||
|
||||
(set-language-environment "UTF-8") ; Use UTF-8
|
||||
|
||||
(setq custom-file (concat user-emacs-directory "etc/custom.el")) ; Set custom file location, don't want clutter in main directory
|
||||
(setq custom-theme-directory
|
||||
(expand-file-name "/etc/materus/themes/" user-emacs-directory)) ; Set custom themes location
|
||||
|
||||
(setq ring-bell-function 'ignore) ; Disable bell
|
||||
|
||||
|
||||
(defvar materus-emacs-gc-cons-threshold (* 32 1024 1024)
|
||||
"The value of `gc-cons-threshold' after Emacs startup.") ; Define after init garbage collector threshold
|
||||
|
||||
|
||||
#+end_src
|
||||
*** Garbage Collector
|
||||
Settings for garbage collector
|
||||
#+begin_src emacs-lisp
|
||||
(setq gc-cons-threshold most-positive-fixnum) ; Set `gc-cons-threshold' so it won't collectect during initialization
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq gc-cons-threshold materus-emacs-gc-cons-threshold))) ; Set `gc-cons-threshold' to desired value after startup
|
||||
|
||||
#+end_src
|
||||
*** Early Frame Settings
|
||||
Early frame settings, maybe some could be move to normal init
|
||||
#+begin_src emacs-lisp
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
(setq frame-resize-pixelwise t)
|
||||
(setq window-resize-pixelwise t) ; Allow pixelwise resizing of window and frame
|
||||
|
||||
(setq initial-major-mode 'fundamental-mode)
|
||||
(setq native-comp-async-report-warnings-errors nil)
|
||||
(setq package-enable-at-startup nil)
|
||||
(unless (daemonp)
|
||||
(add-to-list 'initial-frame-alist '(fullscreen . maximized)))
|
||||
(setq default-frame-alist
|
||||
'((width . 130)
|
||||
(height . 40)))
|
||||
(add-to-list 'initial-frame-alist '(fullscreen . maximized))) ; Start first frame maximized if not running as daemon, daemon frame are set up later in config
|
||||
(setq default-frame-alist ; Set default size for frames
|
||||
'((width . 130)
|
||||
(height . 40)))
|
||||
|
||||
(setq native-comp-speed 3)
|
||||
(add-hook 'emacs-startup-hook (lambda () (package-initialize)
|
||||
(setq gc-cons-threshold 100000000 ; ~100mb
|
||||
gc-cons-percentage 0.1)
|
||||
))
|
||||
(unless (daemonp)
|
||||
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
|
||||
gc-cons-percentage 0.6)
|
||||
(advice-add #'tty-run-terminal-initialization :override #'ignore)
|
||||
(add-hook 'window-setup-hook
|
||||
(lambda ()
|
||||
(advice-remove #'tty-run-terminal-initialization #'ignore)
|
||||
(advice-add #'tty-run-terminal-initialization :override #'ignore)
|
||||
(add-hook 'window-setup-hook
|
||||
(lambda ()
|
||||
(unless (display-graphic-p)
|
||||
(advice-remove #'tty-run-terminal-initialization #'ignore)
|
||||
(tty-run-terminal-initialization (selected-frame) nil t)
|
||||
)
|
||||
)
|
||||
)
|
||||
)))
|
||||
#+end_src
|
||||
*** Native compilation
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
(when (boundp 'native-comp-eln-load-path) ; Change dir for eln-cache
|
||||
(startup-redirect-eln-cache (expand-file-name "/var/eln-cache/" user-emacs-directory)))
|
||||
(setq native-comp-async-report-warnings-errors nil) ; Silence warnings
|
||||
(setq native-comp-speed 3) ; Set native-comp speed
|
||||
|
||||
(setq native-comp-jit-compilation t
|
||||
;native-comp-deferred-compilation t
|
||||
package-native-compile t)
|
||||
|
||||
|
||||
;; Setting up native-comp cache location
|
||||
|
||||
(when (and (fboundp 'startup-redirect-eln-cache)
|
||||
(fboundp 'native-comp-available-p)
|
||||
@@ -106,13 +169,6 @@ Early init file, setting for GC and some paths.
|
||||
(convert-standard-filename
|
||||
(expand-file-name "var/eln-cache/" user-emacs-directory))))
|
||||
|
||||
(setq auto-save-default nil)
|
||||
(setq backup-directory-alist
|
||||
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Change backup and auto save dir to var dir
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(concat user-emacs-directory "var/recovery/") t)))
|
||||
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/"))
|
||||
(setq custom-file (concat user-emacs-directory "etc/custom.el"))
|
||||
#+end_src
|
||||
|
||||
** Init
|
||||
@@ -126,8 +182,6 @@ Checking if using emacs from my nix config (not used anymore, might use in futur
|
||||
#+end_src
|
||||
#+begin_src emacs-lisp
|
||||
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
|
||||
(unless (file-directory-p (concat user-emacs-directory "var/quickstart"))
|
||||
(make-directory (concat user-emacs-directory "var/quickstart") t))
|
||||
(load (concat user-emacs-directory "etc/materus/nix-init") t)
|
||||
(load (concat user-emacs-directory "etc/materus/emacs-config"))
|
||||
(load custom-file t)
|
||||
@@ -154,12 +208,6 @@ After some testing default package manager works best for me.
|
||||
#+begin_src emacs-lisp
|
||||
(require 'cl-lib)
|
||||
(require 'package)
|
||||
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))
|
||||
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))
|
||||
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra"))
|
||||
|
||||
(add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||
#+end_src
|
||||
** Packages list & function
|
||||
Packages to install
|
||||
@@ -281,9 +329,7 @@ Packages to install
|
||||
(package-refresh-contents)
|
||||
(dolist (p materus/packages)
|
||||
(when (not (package-installed-p p))
|
||||
(package-install p)))
|
||||
(package-quickstart-refresh)))
|
||||
(package-initialize)
|
||||
(package-install p)))))
|
||||
(unless materus/use-nix-packages
|
||||
(materus/install-packages))
|
||||
#+end_src
|
||||
@@ -323,9 +369,7 @@ Graphical related settings.
|
||||
(lambda (frame) (when (= (length (frame-list)) 2)
|
||||
(set-frame-parameter frame 'fullscreen 'maximized)))))
|
||||
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
(setq frame-resize-pixelwise t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
(when (display-graphic-p)
|
||||
(set-frame-font "Hack Nerd Font" nil t)
|
||||
)
|
||||
@@ -337,8 +381,8 @@ Graphical related settings.
|
||||
|
||||
(tool-bar-mode -1)
|
||||
|
||||
(setq read-process-output-max (* 1024 1024 3))
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
|
||||
(setq-default cursor-type '(bar . 1))
|
||||
;; Rainbow mode
|
||||
(use-package rainbow-mode
|
||||
@@ -576,7 +620,7 @@ Other configs
|
||||
(use-package dap-gdb-lldb)
|
||||
|
||||
|
||||
|
||||
(setq read-process-output-max (* 1024 1024 3))
|
||||
|
||||
(defun lsp-booster--advice-json-parse (old-fn &rest args)
|
||||
"Try to parse bytecode instead of json."
|
||||
|
||||
@@ -15,12 +15,6 @@
|
||||
;; [[file:../../emacs-materus-config.org::*Init package manager config][Init package manager config:1]]
|
||||
(require 'cl-lib)
|
||||
(require 'package)
|
||||
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))
|
||||
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))
|
||||
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra"))
|
||||
|
||||
(add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||
;; Init package manager config:1 ends here
|
||||
|
||||
;; [[file:../../emacs-materus-config.org::*Packages list & function][Packages list & function:1]]
|
||||
@@ -141,9 +135,7 @@
|
||||
(package-refresh-contents)
|
||||
(dolist (p materus/packages)
|
||||
(when (not (package-installed-p p))
|
||||
(package-install p)))
|
||||
(package-quickstart-refresh)))
|
||||
(package-initialize)
|
||||
(package-install p)))))
|
||||
(unless materus/use-nix-packages
|
||||
(materus/install-packages))
|
||||
;; Packages list & function:1 ends here
|
||||
@@ -178,9 +170,7 @@
|
||||
(lambda (frame) (when (= (length (frame-list)) 2)
|
||||
(set-frame-parameter frame 'fullscreen 'maximized)))))
|
||||
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
(setq frame-resize-pixelwise t)
|
||||
(setq window-resize-pixelwise t)
|
||||
|
||||
(when (display-graphic-p)
|
||||
(set-frame-font "Hack Nerd Font" nil t)
|
||||
)
|
||||
@@ -192,8 +182,8 @@
|
||||
|
||||
(tool-bar-mode -1)
|
||||
|
||||
(setq read-process-output-max (* 1024 1024 3))
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
|
||||
(setq-default cursor-type '(bar . 1))
|
||||
;; Rainbow mode
|
||||
(use-package rainbow-mode
|
||||
@@ -423,7 +413,7 @@
|
||||
(use-package dap-gdb-lldb)
|
||||
|
||||
|
||||
|
||||
(setq read-process-output-max (* 1024 1024 3))
|
||||
|
||||
(defun lsp-booster--advice-json-parse (old-fn &rest args)
|
||||
"Try to parse bytecode instead of json."
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
;;; -*- lexical-binding: t; -*-
|
||||
|
||||
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
|
||||
(unless (file-directory-p (concat user-emacs-directory "var/quickstart"))
|
||||
(make-directory (concat user-emacs-directory "var/quickstart") t))
|
||||
(load (concat user-emacs-directory "etc/materus/nix-init") t)
|
||||
(load (concat user-emacs-directory "etc/materus/emacs-config"))
|
||||
(load custom-file t)
|
||||
|
||||
Reference in New Issue
Block a user