From 983077017abd7af4de18f2fbad7e8ec5fbc62a25 Mon Sep 17 00:00:00 2001 From: Mars Date: Sun, 13 Oct 2024 01:00:36 -0400 Subject: [PATCH] weh --- config.org | 166 ++++++++++++++++++++++++-------------------------- early-init.el | 56 ++++++++++++++++- 2 files changed, 132 insertions(+), 90 deletions(-) diff --git a/config.org b/config.org index e050149..b77cb64 100644 --- a/config.org +++ b/config.org @@ -1,3 +1,5 @@ +;; -*- lexical-binding: t; -*- + #+TITLE: Emacs Configuration #+AUTHOR: Mars (@pupbrained) #+EMAIL: mars@pupbrained.xyz @@ -260,88 +262,88 @@ *** Eglot #+begin_src emacs-lisp - (use-package markdown-mode - :ensure t - :mode ("README\\.md\\'" . gfm-mode) - :init (setq markdown-command "multimarkdown") - :bind (:map markdown-mode-map - ("C-c C-e" . markdown-do))) + (use-package markdown-mode + :ensure t + :mode ("README\\.md\\'" . gfm-mode) + :init (setq markdown-command "multimarkdown") + :bind (:map markdown-mode-map + ("C-c C-e" . markdown-do))) - (use-package eglot-booster - :after eglot - :ensure (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster") - :config (eglot-booster-mode)) + (use-package eglot-booster + :after eglot + :ensure (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster") + :config (eglot-booster-mode)) - (use-package eglot - :ensure nil - :config - (defun my-eglot-rename (newname) - "Rename the current symbol to NEWNAME with initial input a." - (interactive - (list (read-from-minibuffer - (format "Rename `%s' to: " (or (thing-at-point 'symbol t) - (error "no symbol at point"))) - (or (thing-at-point 'symbol t) "") nil nil nil - (symbol-name (symbol-at-point))))) - (eglot--server-capable-or-lose :renameProvider) - (eglot--apply-workspace-edit - (jsonrpc-request (eglot--current-server-or-lose) - :textDocument/rename `(,@(eglot--TextDocumentPositionParams) - :newName ,newname)) - current-prefix-arg)) - (fset #'jsonrpc--log-event #'ignore) - (setopt eglot-events-buffer-size 0) - (defun eglot-format-buffer-on-save () - (when (not (derived-mode-p 'python-ts-mode)) - (add-hook 'before-save-hook #'eglot-format-buffer -10 t))) - (add-hook 'eglot-managed-mode-hook #'eglot-format-buffer-on-save) - (add-to-list 'eglot-server-programs '(nix-mode . ("nixd"))) - (add-to-list 'eglot-server-programs - `(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never"))) - :hook - (rust-mode . eglot-ensure) - (rust-ts-mode . eglot-ensure) - (sh-script-mode . eglot-ensure) - (python-mode . eglot-ensure) - (python-ts-mode . eglot-ensure) - (json-mode . eglot-ensure) - (json-ts-mode . eglot-ensure) - (nix-mode . eglot-ensure) - (yaml-mode . eglot-ensure) - (yaml-ts-mode . eglot-ensure) - (c-mode . eglot-ensure) - (c-ts-mode . eglot-ensure) - (c++-mode . eglot-ensure) - (c++-ts-mode . eglot-ensure) - (c3-ts-mode . eglot-ensure) - (rust-mode . eglot-ensure) - (go-mode . eglot-ensure) - (go-ts-mode . eglot-ensure)) + (use-package eglot + :ensure nil + :config + (defun my-eglot-rename (newname) + "Rename the current symbol to NEWNAME with initial input a." + (interactive + (list (read-from-minibuffer + (format "Rename `%s' to: " (or (thing-at-point 'symbol t) + (error "no symbol at point"))) + (or (thing-at-point 'symbol t) "") nil nil nil + (symbol-name (symbol-at-point))))) + (eglot--server-capable-or-lose :renameProvider) + (eglot--apply-workspace-edit + (jsonrpc-request (eglot--current-server-or-lose) + :textDocument/rename `(,@(eglot--TextDocumentPositionParams) + :newName ,newname)) + current-prefix-arg)) + (fset #'jsonrpc--log-event #'ignore) + (setopt eglot-events-buffer-size 0) + (defun eglot-format-buffer-on-save () + (when (not (derived-mode-p 'python-ts-mode)) + (add-hook 'before-save-hook #'eglot-format-buffer -10 t))) + (add-hook 'eglot-managed-mode-hook #'eglot-format-buffer-on-save) + (add-to-list 'eglot-server-programs + '(nix-mode . ("nixd")) + `(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never"))) + :hook + (rust-mode . eglot-ensure) + (rust-ts-mode . eglot-ensure) + (sh-script-mode . eglot-ensure) + (python-mode . eglot-ensure) + (python-ts-mode . eglot-ensure) + (json-mode . eglot-ensure) + (json-ts-mode . eglot-ensure) + (nix-mode . eglot-ensure) + (yaml-mode . eglot-ensure) + (yaml-ts-mode . eglot-ensure) + (c-mode . eglot-ensure) + (c-ts-mode . eglot-ensure) + (c++-mode . eglot-ensure) + (c++-ts-mode . eglot-ensure) + (c3-ts-mode . eglot-ensure) + (rust-mode . eglot-ensure) + (go-mode . eglot-ensure) + (go-ts-mode . eglot-ensure)) - (use-package rust-mode - :ensure t) + (use-package rust-mode + :ensure t) - (use-package tuareg - :ensure t - :mode ("\\.ml\\'" . tuareg-mode) - :hook (tuareg-mode . eglot-ensure)) + (use-package tuareg + :ensure t + :mode ("\\.ml\\'" . tuareg-mode) + :hook (tuareg-mode . eglot-ensure)) - (use-package merlin - :ensure t - :hook (tuareg-mode . merlin-mode)) + (use-package merlin + :ensure t + :hook (tuareg-mode . merlin-mode)) - (use-package glsl-mode - :ensure t - :mode ("\\.vert\\'" "\\.frag\\'" "\\.geom\\'")) + (use-package glsl-mode + :ensure t + :mode ("\\.vert\\'" "\\.frag\\'" "\\.geom\\'")) - (use-package eldoc-box - :custom - (eldoc-box-max-pixel-width 1024) - :config - (setq eldoc-message-function #'ignore) - (setq eldoc-idle-delay 0) - (custom-set-faces - '(eldoc-box-body ((t (:family "Iosevka Comfy Motion" :height 140 :background "#181825" :foreground "#cdd6f4")))))) + (use-package eldoc-box + :custom + (eldoc-box-max-pixel-width 1024) + :custom-face + (eldoc-box-body ((t (:family "Iosevka Comfy Motion" :background "#181825" :foreground "#cdd6f4")))) + :config + (setq eldoc-message-function #'ignore + eldoc-idle-delay 0)) #+end_src *** Apheleia @@ -351,12 +353,10 @@ :ensure t :config (add-to-list 'apheleia-formatters - '(alejandra "alejandra" "--quiet" "-")) - (add-to-list 'apheleia-formatters + '(alejandra "alejandra" "--quiet" "-") '(clang-format "clang-format")) (add-to-list 'apheleia-mode-alist - '(nix-mode . alejandra)) - (add-to-list 'apheleia-mode-alist + '(nix-mode . alejandra) '(c-mode . clang-format)) (add-to-list 'apheleia-mode-alist '(c++-mode . clang-format)) @@ -433,14 +433,6 @@ (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)) #+end_src -** Disable Bars - -#+begin_src emacs-lisp - (menu-bar-mode -1) - (scroll-bar-mode -1) - (tool-bar-mode -1) -#+end_src - ** Line Numbers #+begin_src emacs-lisp diff --git a/early-init.el b/early-init.el index a3d7194..bef0acc 100644 --- a/early-init.el +++ b/early-init.el @@ -1,4 +1,54 @@ +;; -*- lexical-binding: t; -*- + +;;; early-init.el --- Emacs pre package.el & GUI configuration -*- lexical-binding: t; -*- (setq package-enable-at-startup nil) -(setq tab-always-indent 'complete) -(setq text-mode-ispell-word-completion nil) -(setq read-extended-command-predicate #'command-completion-default-include-p) +(setq inhibit-default-init nil) + +(setq native-comp-async-report-warnings-errors nil) + +(defvar default-file-name-handler-alist file-name-handler-alist) +(setq file-name-handler-alist nil) + +(setq gc-cons-threshold most-positive-fixnum + gc-cons-percentage 1) + +(defun +gc-after-focus-change () + "Run GC when frame loses focus." + (run-with-idle-timer + 5 nil + (lambda () (unless (frame-focus-state) (garbage-collect))))) + +(defun +reset-init-values () + (run-with-idle-timer + 1 nil + (lambda () + (setq file-name-handler-alist default-file-name-handler-alist + gc-cons-percentage 0.1 + gc-cons-threshold 100000000) + (message "gc-cons-threshold & file-name-handler-alist restored") + (when (boundp 'after-focus-change-function) + (add-function :after after-focus-change-function #'+gc-after-focus-change))))) + +(with-eval-after-load 'elpaca + (add-hook 'elpaca-after-init-hook '+reset-init-values)) + +(push '(menu-bar-lines . 0) default-frame-alist) +(push '(tool-bar-lines . 0) default-frame-alist) +(push '(vertical-scroll-bars) default-frame-alist) + +(setq server-client-instructions nil) + +(setq frame-inhibit-implied-resize t) + +(push '(font . "Iosevka Comfy Motion") default-frame-alist) +(set-face-font 'default "Iosevka Comfy Motion") +(set-face-font 'variable-pitch "Iosevka Comfy Motion Duo") +(copy-face 'default 'fixed-pitch) + +(advice-add #'x-apply-session-resources :override #'ignore) + +(setq desktop-restore-forces-onscreen nil) + +(setq ring-bell-function #'ignore + inhibit-startup-screen t) +