From e82959cc666b7d6f97ded9a404a3ff948c67c0d1 Mon Sep 17 00:00:00 2001 From: my name Date: Wed, 12 Aug 2026 00:12:21 +0200 Subject: [PATCH] fixed lsp, orderless, corfu irrelevant elements are now correctly filtered out of lsp by orderless,corfu. fixed some whitespace, indentation --- config.el | 246 ++++++++--------- early-init.el | 460 ++++++++++++++++---------------- init.el | 128 ++++----- packages/completion-packages.el | 95 ++++--- packages/dev-packages.el | 220 +++++++-------- packages/editing-packages.el | 56 ++-- packages/system-packages.el | 56 ++-- packages/tutilities-packages.el | 13 +- packages/visuals-packages.el | 79 +++--- 9 files changed, 687 insertions(+), 666 deletions(-) diff --git a/config.el b/config.el index c71391f..9036384 100644 --- a/config.el +++ b/config.el @@ -4,9 +4,9 @@ ;; Custom & Packages Loading ;; ============================================================ (let ((custom-dir (expand-file-name "custom/" user-emacs-directory))) - (when (file-directory-p custom-dir) - (dolist (file (directory-files custom-dir nil "\\.el$")) - (load (expand-file-name (file-name-sans-extension file) custom-dir))))) + (when (file-directory-p custom-dir) + (dolist (file (directory-files custom-dir nil "\\.el$")) + (load (expand-file-name (file-name-sans-extension file) custom-dir))))) (add-to-list 'load-path (expand-file-name "packages/" user-emacs-directory)) (add-to-list 'custom-theme-load-path (expand-file-name "themes/" user-emacs-directory)) @@ -14,81 +14,84 @@ (add-hook 'after-init-hook (lambda () - (require 'visuals-packages) ; ui, eye candy - (require 'editing-packages) ; text editing - (require 'system-packages) ; emacs itself - (require 'tutilities-packages) ; tertiary utilities - (require 'completion-packages) ; ui, functional - (require 'dev-packages) ; lsp, treesitter - ) + (with-demoted-errors "Error in after-init-hook: %S" + (require 'visuals-packages) ; ui, eye candy + (require 'editing-packages) ; text editing + (require 'system-packages) ; emacs itself + (require 'tutilities-packages) ; tertiary utilities + (require 'completion-packages) ; ui, functional + (require 'dev-packages) ; lsp, treesitter + )) ) ;; ============================================================ ;; Keybindings ;; ============================================================ (use-package general - :config + :config - (general-define-key - :keymaps 'global - "C-l" nil ; recenter - "C-n" nil ; next line - "C-p" nil ; previous line - "C-f" nil ; forward chard - "C-o" nil ; idk - "C-t" nil ; transpose - ;"C-m" nil can't be rebound because is same as ret - "C->" nil ;end of buffer - "C-<" nil ;start of buffer - ) + (general-define-key + :keymaps 'global + "C-l" nil ; recenter + "C-n" nil ; next line + "C-p" nil ; previous line + "C-f" nil ; forward chard + "C-o" nil ; idk + "C-t" nil ; transpose + ;"C-m" nil can't be rebound because is same as ret + "C->" nil ;end of buffer + "C-<" nil ;start of buffer + "C-" nil + "C-" nil + ) - (general-def - :keymaps 'global - "C-S-c" #'my/system-copy - "C-S-x" #'my/system-cut - "C-S-v" #'my/system-paste - "C-z" #'undo - "C-M-z" #'undo-redo - "C-k" #'avy-kill-whole-line - "C-r" #'recenter-top-bottom - "C-b" #'scroll-down-command - "C-" #'my/delete-word-backward - "M-" #'my/delete-word-backward - "M-s M-s" #'scroll-lock-mode - "C-w" #'delete-window + (general-def + :keymaps 'global + "C-S-c" #'my/system-copy + "C-S-x" #'my/system-cut + "C-S-v" #'my/system-paste + "C-z" #'undo + "C-M-z" #'undo-redo + "C-k" #'avy-kill-whole-line + "C-r" #'recenter-top-bottom + "C-b" #'scroll-down-command + "C-" #'my/delete-word-backward + "M-" #'my/delete-word-backward + "M-s M-s" #'scroll-lock-mode + "C-w" #'delete-window - "C-x m" #'switch-to-minibuffer + "C-x m" #'switch-to-minibuffer - "M-w" #'clipetty-kill-ring-save - ; "C-x S-v" #'shrink-window - ; "C-x v" #'enlarge-window - ) - (general-def - :keymaps 'override - "C-s C-s C-f" #'my/avy-char-region ; search select find - "C-s C-s C-l" #'my/avy-line-region ; search select line - "C-s C-e" #'expreg-expand ; selection expand - "C-s C-c" #'expreg-contract ; selection contract + "M-w" #'clipetty-kill-ring-save + ; "C-x S-v" #'shrink-window + ; "C-x v" #'enlarge-window + ) + (general-def + :keymaps 'override + "C-s C-s C-f" #'my/avy-char-region ; search select find + "C-s C-s C-l" #'my/avy-line-region ; search select line + "C-s C-e" #'expreg-expand ; selection expand + "C-s C-c" #'expreg-contract ; selection contract - "C-s f" #'kirigami-toggle-fold ; fold - ) + "C-s f" #'kirigami-toggle-fold ; fold + ) - (general-def - :keymaps 'override + (general-def + :keymaps 'override - "C-f C-r" #'buffer-table ; recent buffer - "C-f C-f" #'avy-goto-char-timer ; find - "C-f C-l" #'consult-line ; line - "C-f g" #'avy-goto-line ; goto + "C-f C-r" #'buffer-table ; recent buffer + "C-f C-f" #'avy-goto-char-timer ; find + "C-f C-l" #'consult-line ; line + "C-f g" #'avy-goto-line ; goto + ) + + (general-def + :keymaps 'override + "C-s s" #'shell-pop ; shell + ) ) - (general-def - :keymaps 'override - "C-s s" #'shell-pop ; shell - ) - ) - ;; 1. Make single ';' trigger Control for the very next keypress (define-key key-translation-map (kbd ";") 'event-apply-control-modifier) @@ -101,28 +104,29 @@ ;; ============================================================ (use-package emacs - :ensure nil - :custom - ;; --- Completion & Search --- - (completion-ignore-case t) - (read-file-name-completion-ignore-case t) - (read-buffer-completion-ignore-case t) - (text-mode-ispell-word-completion nil) + :ensure nil + :custom + ;; --- Completion & Search --- + (completion-ignore-case t) + (read-file-name-completion-ignore-case t) + (read-buffer-completion-ignore-case t) + (text-mode-ispell-word-completion nil) + (completion-category-overrides '((point (styles orderless basic)))) - ;; --- Backup & Auto-save --- - ;; Centralize all backup files to a single directory to avoid cluttering projects - (backup-directory-alist '(("." . "~/MyEmacsBackups"))) - (auto-save-list-file-prefix "~/MyEmacsBackups") - (backup-by-copying t) - (create-lockfiles nil) - (make-backup-files nil) + ;; --- Backup & Auto-save --- + ;; Centralize all backup files to a single directory to avoid cluttering projects + (backup-directory-alist '(("." . "~/MyEmacsBackups/"))) + (auto-save-list-file-prefix "~/MyEmacsBackups/") + (backup-by-copying t) + (create-lockfiles nil) + (make-backup-files nil) - ;; --- Miscellaneous --- - (tab-always-indent 'complete) + ;; --- Miscellaneous --- + (tab-always-indent 'complete) - :hook - (prog-mode . hs-minor-mode) - ) + :hook + (prog-mode . hs-minor-mode) + ) ;; ============================================================ ;; 3. Core Settings & UI @@ -144,7 +148,7 @@ truncate-lines nil ; Enable line wrapping fast-but-imprecise-scrolling t ring-bell-function 'ignore ; Silence the system bell - + ;; --- File & Buffer Handling --- find-file-visit-truename t @@ -187,52 +191,52 @@ ;; 5. Hooks, Modes & Theming ;; ============================================================ +(add-hook 'text-mode-hook #'jit-spell-mode) + (add-hook 'after-init-hook (lambda () - ;; --- Modes --- - (recentf-mode t) ; save/load recent files - (global-display-line-numbers-mode 1) ; always display line numbers - (global-hl-line-mode 0) (hl-line-mode 0) ; handled by god mode toggle - (savehist-mode 1) - (global-clipetty-mode t) ; copy-paste in terminal - (global-auto-revert-mode t) ; automatically refresh buffer - (yas-global-mode t) ; yasnippets - (repeat-mode 1) ; repeat key without modifier - (electric-pair-mode t) ; automatically handle pairs - (jit-spell-mode t) ; spellcheck - (fringe-mode '(0 . 8)) ; fringe only on right edge - (delete-selection-mode 1) - (auto-revert-mode t) + ;; --- Modes --- + (recentf-mode t) ; save/load recent files + (global-display-line-numbers-mode 1) ; always display line numbers + (global-hl-line-mode 0) (hl-line-mode 0) ; handled by god mode toggle + (savehist-mode 1) + (global-clipetty-mode t) ; copy-paste in terminal + (global-auto-revert-mode t) ; automatically refresh buffer + (yas-global-mode t) ; yasnippets + (repeat-mode 1) ; repeat key without modifier + (electric-pair-mode t) ; automatically handle pairs + (fringe-mode '(0 . 8)) ; fringe only on right edge + (delete-selection-mode 1) - ;; --- Special UI Settings --- - (setq ispell-program-name "hunspell" - ispell-dictionary "en_US,nl_NL") + ;; --- Special UI Settings --- + (setq ispell-program-name "hunspell" + ispell-dictionary "en_US,nl_NL") - ;; Ensure help opens in a side window rather than replacing current buffer - (setq display-buffer-alist - (cons '("Help" . (display-buffer-in-side-window - :side 'bottom - :style 'overriding - :window-height 0.3)) - display-buffer-alist)) + ;; Ensure help opens in a side window rather than replacing current buffer + (setq display-buffer-alist + (cons '("Help" . (display-buffer-in-side-window + :side 'bottom + :style 'overriding + :window-height 0.3)) + display-buffer-alist)) - (setq minibuffer-prompt-properties - '(read-only t intangible t cursor-intangible t face minibuffer-prompt)) - ) + (setq minibuffer-prompt-properties + '(read-only t intangible t cursor-intangible t face minibuffer-prompt)) + ) ) ;; Dired Customization (with-eval-after-load 'dired - (add-hook 'dired-mode-hook - (lambda () - (define-key dired-mode-map (kbd "a") 'dired-up-directory) - (define-key dired-mode-map (kbd "v") 'dirvish-move)))) + (add-hook 'dired-mode-hook + (lambda () + (define-key dired-mode-map (kbd "a") 'dired-up-directory) + (define-key dired-mode-map (kbd "v") 'dirvish-move)))) ;; Recentf Maintenance (with-eval-after-load 'recentf - (run-at-time nil 600 #'recentf-cleanup) - (setq recentf-exclude '(".*/$"))) + (run-at-time nil 600 #'recentf-cleanup) + (setq recentf-exclude '(".*/$"))) ;; General Hooks (add-hook 'find-file-hook #'recentf-save-list) @@ -240,7 +244,7 @@ ;; Mode-specific fonts (dolist (hook '(markdown-mode-hook org-mode-hook json-mode-hook)) - (add-hook hook (lambda () (buffer-face-set '(:family "Noto Sans" :height 140))))) + (add-hook hook (lambda () (buffer-face-set '(:family "Noto Sans" :height 140))))) ;; File Associations (add-to-list 'auto-mode-alist '("\\.qd$" . markdown-mode)) @@ -252,10 +256,10 @@ (add-hook 'window-setup-hook (lambda () - (set-face-attribute 'default nil :family "Noto Sans Mono" :height 110) - (set-face-attribute 'variable-pitch nil :family "Noto Sans" :height 120) - (load-theme 'cutarv42 t) - ) + (set-face-attribute 'default nil :family "Noto Sans Mono" :height 110) + (set-face-attribute 'variable-pitch nil :family "Noto Sans" :height 120) + (load-theme 'cutarv42 t) + ) ) - (setq nerd-icons-font-family "Symbols Nerd Font Mono") +(setq nerd-icons-font-family "Symbols Nerd Font Mono") diff --git a/early-init.el b/early-init.el index 357ff6f..2b24560 100644 --- a/early-init.el +++ b/early-init.el @@ -31,14 +31,14 @@ ;; Temporarily raise the garbage collection threshold to its maximum value. ;; It will be restored later to controlled values. (if noninteractive - (setq gc-cons-threshold 268435456) ; 256 Mb - (setq gc-cons-threshold most-positive-fixnum)) + (setq gc-cons-threshold 268435456) ; 256 Mb + (setq gc-cons-threshold most-positive-fixnum)) (setq gc-cons-percentage 1.0) ;;; Variables (defvar minimal-emacs-ui-features '() - "List of user interface features to enable in minimal Emacs setup. + "List of user interface features to enable in minimal Emacs setup. This variable holds a list of Emacs UI features that can be enabled: - context-menu (Enables the context menu in graphical environments.) - tool-bar (Enables the tool bar in graphical environments.) @@ -47,123 +47,123 @@ This variable holds a list of Emacs UI features that can be enabled: - tooltips (Enables tooltips.)") (defvar minimal-emacs-frame-title-format "%b – Emacs" - "Template for displaying the title bar of visible and iconified frame.") + "Template for displaying the title bar of visible and iconified frame.") (defvar minimal-emacs-debug (bound-and-true-p init-file-debug) - "Non-nil to enable debug.") + "Non-nil to enable debug.") (defvar minimal-emacs-optimize-startup-gc t - "If non-nil, increase `gc-cons-threshold' during startup to reduce pauses. + "If non-nil, increase `gc-cons-threshold' during startup to reduce pauses. After Emacs finishes loading, `gc-cons-threshold' is restored to the value stored in `minimal-emacs-gc-cons-threshold'.") (defvar minimal-emacs-gc-cons-threshold (* 32 1024 1024) - "Value to which `gc-cons-threshold' is set after Emacs startup. + "Value to which `gc-cons-threshold' is set after Emacs startup. Ignored if `minimal-emacs-optimize-startup-gc' is nil.") (defvar minimal-emacs-gc-cons-percentage gc-cons-percentage - "Value to which `gc-cons-percentage' is set after Emacs startup. + "Value to which `gc-cons-percentage' is set after Emacs startup. Ignored if `minimal-emacs-optimize-startup-gc' is nil.") (defvar minimal-emacs-gc-cons-threshold-restore-delay nil - "Number of seconds to wait before restoring `gc-cons-threshold'.") + "Number of seconds to wait before restoring `gc-cons-threshold'.") (defvar minimal-emacs-optimize-file-name-handler-alist t - "Enable optimization of `file-name-handler-alist'. + "Enable optimization of `file-name-handler-alist'. When non-nil, this variable activates optimizations to reduce file name handler lookups during Emacs startup.") (defvar minimal-emacs-disable-mode-line-during-startup t - "Disable the mode line during startup. + "Disable the mode line during startup. This reduces visual clutter and slightly enhances startup performance. The tradeoff is that the mode line is hidden during the startup phase.") (defvar minimal-emacs-package-initialize-and-refresh nil - "Whether to automatically initialize and refresh packages. + "Whether to automatically initialize and refresh packages. When set to non-nil, Emacs will automatically call `package-initialize' and `package-refresh-contents' to set up and update the package system.") (defvar minimal-emacs-inhibit-redisplay-during-startup nil - "Suppress redisplay during startup to improve performance. + "Suppress redisplay during startup to improve performance. This prevents visual updates while Emacs initializes. The tradeoff is that you won't see the progress or activities during the startup process.") (defvar minimal-emacs-inhibit-message-during-startup nil - "Suppress startup messages for a cleaner experience. + "Suppress startup messages for a cleaner experience. This slightly enhances performance. The tradeoff is that you won't be informed of the progress or any relevant activities during startup.") (defvar minimal-emacs-user-directory user-emacs-directory - "Directory beneath minimal-emacs.d files are placed. + "Directory beneath minimal-emacs.d files are placed. Note that this should end with a directory separator.") (defvar minimal-emacs-load-pre-early-init t - "If non-nil, attempt to load `pre-early-init.el`.") + "If non-nil, attempt to load `pre-early-init.el`.") (defvar minimal-emacs-load-post-early-init t - "If non-nil, attempt to load `post-early-init.el`.") + "If non-nil, attempt to load `post-early-init.el`.") (defvar minimal-emacs-load-pre-init t - "If non-nil, attempt to load `pre-init.el`.") + "If non-nil, attempt to load `pre-init.el`.") (defvar minimal-emacs-load-post-init t - "If non-nil, attempt to load `post-init.el`.") + "If non-nil, attempt to load `post-init.el`.") ;;; Load pre-early-init.el ;; Prefer loading newer compiled files (setq load-prefer-newer t) (when minimal-emacs-debug - (setq debug-on-error minimal-emacs-debug)) + (setq debug-on-error minimal-emacs-debug)) (defvar minimal-emacs--success nil) (defun minimal-emacs--check-success () - "Verify that the Emacs configuration has loaded successfully." - (unless minimal-emacs--success - (cond - ((or (file-exists-p (expand-file-name "~/.emacs.el")) - (file-exists-p (expand-file-name "~/.emacs"))) - (error "Emacs ignored loading 'init.el'. Please ensure that files such as ~/.emacs or ~/.emacs.el do not exist, as they may be preventing Emacs from loading the 'init.el' file")) + "Verify that the Emacs configuration has loaded successfully." + (unless minimal-emacs--success + (cond + ((or (file-exists-p (expand-file-name "~/.emacs.el")) + (file-exists-p (expand-file-name "~/.emacs"))) + (error "Emacs ignored loading 'init.el'. Please ensure that files such as ~/.emacs or ~/.emacs.el do not exist, as they may be preventing Emacs from loading the 'init.el' file")) - (t - (error "Configuration error. Debug by starting Emacs with: --debug-init"))))) + (t + (error "Configuration error. Debug by starting Emacs with: --debug-init"))))) (unless noninteractive - (add-hook 'emacs-startup-hook #'minimal-emacs--check-success 102)) + (add-hook 'emacs-startup-hook #'minimal-emacs--check-success 102)) (defvar minimal-emacs-load-compiled-init-files nil - "If non-nil, attempt to load byte-compiled .elc for init files. + "If non-nil, attempt to load byte-compiled .elc for init files. This will enable minimal-emacs to load byte-compiled or possibly native-compiled init files for the following initialization files: pre-init.el, post-init.el, pre-early-init.el, and post-early-init.el.") (defun minimal-emacs--remove-el-file-suffix (filename) - "Remove the Elisp file suffix from FILENAME and return it (.el, .el.gz...)." - (let ((suffixes (mapcar (lambda (ext) (concat ".el" ext)) - load-file-rep-suffixes))) - (catch 'done - (dolist (suffix suffixes filename) - (when (string-suffix-p suffix filename) - (setq filename (substring filename 0 (- (length suffix)))) - (throw 'done t)))) - filename)) + "Remove the Elisp file suffix from FILENAME and return it (.el, .el.gz...)." + (let ((suffixes (mapcar (lambda (ext) (concat ".el" ext)) + load-file-rep-suffixes))) + (catch 'done + (dolist (suffix suffixes filename) + (when (string-suffix-p suffix filename) + (setq filename (substring filename 0 (- (length suffix)))) + (throw 'done t)))) + filename)) (defun minimal-emacs-load-user-init (filename) - "Execute a file of Lisp code named FILENAME." - (let ((init-file (expand-file-name filename - minimal-emacs-user-directory))) - (if (not minimal-emacs-load-compiled-init-files) - (load init-file :no-error (not minimal-emacs-debug) :nosuffix) - ;; Remove the file suffix (.el, .el.gz, etc.) to let the `load' function - ;; select between .el and .elc files. - (setq init-file (minimal-emacs--remove-el-file-suffix init-file)) - (load init-file :no-error (not minimal-emacs-debug))))) + "Execute a file of Lisp code named FILENAME." + (let ((init-file (expand-file-name filename + minimal-emacs-user-directory))) + (if (not minimal-emacs-load-compiled-init-files) + (load init-file :no-error (not minimal-emacs-debug) :nosuffix) + ;; Remove the file suffix (.el, .el.gz, etc.) to let the `load' function + ;; select between .el and .elc files. + (setq init-file (minimal-emacs--remove-el-file-suffix init-file)) + (load init-file :no-error (not minimal-emacs-debug))))) (when minimal-emacs-load-pre-early-init - (minimal-emacs-load-user-init "pre-early-init.el")) + (minimal-emacs-load-user-init "pre-early-init.el")) (setq custom-theme-directory - (expand-file-name "themes/" minimal-emacs-user-directory)) + (expand-file-name "themes/" minimal-emacs-user-directory)) (setq custom-file (expand-file-name "custom.el" minimal-emacs-user-directory)) @@ -172,43 +172,43 @@ pre-early-init.el, and post-early-init.el.") ;; garbage collection during startup but will be reset later. (defun minimal-emacs--restore-gc-values () - "Restore garbage collection values to minimal-emacs.d values." - (setq gc-cons-threshold minimal-emacs-gc-cons-threshold) - (setq gc-cons-percentage minimal-emacs-gc-cons-percentage)) + "Restore garbage collection values to minimal-emacs.d values." + (setq gc-cons-threshold minimal-emacs-gc-cons-threshold) + (setq gc-cons-percentage minimal-emacs-gc-cons-percentage)) (defun minimal-emacs--restore-gc () - "Restore garbage collection settings." - (if (and (bound-and-true-p minimal-emacs-gc-cons-threshold-restore-delay) - ;; In noninteractive mode, the event loop does not run - (not noninteractive)) - ;; Defer garbage collection during initialization to avoid 2 collections. - (run-with-timer minimal-emacs-gc-cons-threshold-restore-delay nil - #'minimal-emacs--restore-gc-values) - (minimal-emacs--restore-gc-values))) + "Restore garbage collection settings." + (if (and (bound-and-true-p minimal-emacs-gc-cons-threshold-restore-delay) + ;; In noninteractive mode, the event loop does not run + (not noninteractive)) + ;; Defer garbage collection during initialization to avoid 2 collections. + (run-with-timer minimal-emacs-gc-cons-threshold-restore-delay nil + #'minimal-emacs--restore-gc-values) + (minimal-emacs--restore-gc-values))) (if minimal-emacs-optimize-startup-gc - ;; `gc-cons-threshold' is managed by minimal-emacs.d - (add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc 105) - ;; gc-cons-threshold is not managed by minimal-emacs.d. - (when (= gc-cons-threshold most-positive-fixnum) - (setq gc-cons-threshold minimal-emacs--backup-gc-cons-threshold) - (setq gc-cons-percentage minimal-emacs--backup-gc-cons-percentage))) + ;; `gc-cons-threshold' is managed by minimal-emacs.d + (add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc 105) + ;; gc-cons-threshold is not managed by minimal-emacs.d. + (when (= gc-cons-threshold most-positive-fixnum) + (setq gc-cons-threshold minimal-emacs--backup-gc-cons-threshold) + (setq gc-cons-percentage minimal-emacs--backup-gc-cons-percentage))) ;;; Native compilation and Byte compilation (unless (and (featurep 'native-compile) - (fboundp 'native-comp-available-p) - (native-comp-available-p)) - ;; Deactivate the `native-compile' feature if it is not available - (setq native-comp-jit-compilation nil) - (setq features (delq 'native-compile features))) + (fboundp 'native-comp-available-p) + (native-comp-available-p)) + ;; Deactivate the `native-compile' feature if it is not available + (setq native-comp-jit-compilation nil) + (setq features (delq 'native-compile features))) (setq native-comp-warning-on-missing-source minimal-emacs-debug - native-comp-async-report-warnings-errors (or minimal-emacs-debug 'silent)) + native-comp-async-report-warnings-errors (or minimal-emacs-debug 'silent)) (setq jka-compr-verbose minimal-emacs-debug) (setq byte-compile-warnings minimal-emacs-debug - byte-compile-verbose minimal-emacs-debug) + byte-compile-verbose minimal-emacs-debug) ;;; Miscellaneous @@ -235,7 +235,7 @@ pre-early-init.el, and post-early-init.el.") (setq warning-inhibit-types '((files missing-lexbind-cookie))) (when minimal-emacs-debug - (setq message-log-max 16384)) + (setq message-log-max 16384)) ;; Disable warnings from the legacy advice API. They aren't useful. (setq ad-redefinition-action 'accept) @@ -247,225 +247,225 @@ pre-early-init.el, and post-early-init.el.") (setq auto-mode-case-fold nil) (unless minimal-emacs-debug - ;; Unset command line options irrelevant to the current OS. These options - ;; are still processed by `command-line-1` but have no effect. - (unless (eq system-type 'darwin) - (setq command-line-ns-option-alist nil)) - (unless (memq initial-window-system '(x pgtk)) - (setq command-line-x-option-alist nil))) + ;; Unset command line options irrelevant to the current OS. These options + ;; are still processed by `command-line-1` but have no effect. + (unless (eq system-type 'darwin) + (setq command-line-ns-option-alist nil)) + (unless (memq initial-window-system '(x pgtk)) + (setq command-line-x-option-alist nil))) (unless noninteractive - ;; In PGTK, this timeout introduces latency. Reducing it from the default 0.1 - ;; improves responsiveness of childframes and related packages. - (when (boundp 'pgtk-wait-for-event-timeout) - (setq pgtk-wait-for-event-timeout 0.001)) + ;; In PGTK, this timeout introduces latency. Reducing it from the default 0.1 + ;; improves responsiveness of childframes and related packages. + (when (boundp 'pgtk-wait-for-event-timeout) + (setq pgtk-wait-for-event-timeout 0.001)) - ;; Font compacting can be very resource-intensive, especially when rendering - ;; icon fonts on Windows. This will increase memory usage. - (setq inhibit-compacting-font-caches t) + ;; Font compacting can be very resource-intensive, especially when rendering + ;; icon fonts on Windows. This will increase memory usage. + (setq inhibit-compacting-font-caches t) - ;; Resizing the Emacs frame can be costly when changing the font. Disable this - ;; to improve startup times with fonts larger than the system default. - (setq frame-resize-pixelwise t) + ;; Resizing the Emacs frame can be costly when changing the font. Disable this + ;; to improve startup times with fonts larger than the system default. + (setq frame-resize-pixelwise t) - ;; Without this, Emacs will try to resize itself to a specific column size - (setq frame-inhibit-implied-resize t) + ;; Without this, Emacs will try to resize itself to a specific column size + (setq frame-inhibit-implied-resize t) - ;; Reduce *Message* noise at startup. An empty scratch buffer (or the - ;; dashboard) is more than enough, and faster to display. - (setq inhibit-startup-screen t - inhibit-startup-echo-area-message user-login-name) - (setq initial-buffer-choice nil - inhibit-startup-buffer-menu t - inhibit-x-resources t) + ;; Reduce *Message* noise at startup. An empty scratch buffer (or the + ;; dashboard) is more than enough, and faster to display. + (setq inhibit-startup-screen t + inhibit-startup-echo-area-message user-login-name) + (setq initial-buffer-choice nil + inhibit-startup-buffer-menu t + inhibit-x-resources t) - ;; Disable startup screens and messages - (setq inhibit-splash-screen t) + ;; Disable startup screens and messages + (setq inhibit-splash-screen t) - ;; Disable bidirectional text scanning for a modest performance boost. - (setq-default bidi-display-reordering 'left-to-right - bidi-paragraph-direction 'left-to-right) + ;; Disable bidirectional text scanning for a modest performance boost. + (setq-default bidi-display-reordering 'left-to-right + bidi-paragraph-direction 'left-to-right) - ;; Give up some bidirectional functionality for slightly faster re-display. - (setq bidi-inhibit-bpa t) + ;; Give up some bidirectional functionality for slightly faster re-display. + (setq bidi-inhibit-bpa t) - ;; Remove "For information about GNU Emacs..." message at startup - (advice-add 'display-startup-echo-area-message :override #'ignore) + ;; Remove "For information about GNU Emacs..." message at startup + (advice-add 'display-startup-echo-area-message :override #'ignore) - ;; Suppress the vanilla startup screen completely. We've disabled it with - ;; `inhibit-startup-screen', but it would still initialize anyway. - (advice-add 'display-startup-screen :override #'ignore)) + ;; Suppress the vanilla startup screen completely. We've disabled it with + ;; `inhibit-startup-screen', but it would still initialize anyway. + (advice-add 'display-startup-screen :override #'ignore)) ;;; Performance: File-name-handler-alist (defvar minimal-emacs--old-file-name-handler-alist (default-toplevel-value - 'file-name-handler-alist)) + 'file-name-handler-alist)) (defun minimal-emacs--respect-file-handlers (fn args-left) - "Respect file handlers. + "Respect file handlers. FN is the function and ARGS-LEFT is the same argument as `command-line-1'. Emacs processes command-line files very early in startup. These files may include special paths like TRAMP paths, so restore `file-name-handler-alist' for this stage of initialization." - (let ((file-name-handler-alist (if args-left - minimal-emacs--old-file-name-handler-alist - file-name-handler-alist))) - (funcall fn args-left))) + (let ((file-name-handler-alist (if args-left + minimal-emacs--old-file-name-handler-alist + file-name-handler-alist))) + (funcall fn args-left))) (defun minimal-emacs--restore-file-name-handler-alist () - "Restore `file-name-handler-alist'." - (set-default-toplevel-value - 'file-name-handler-alist - ;; Merge instead of overwrite to preserve any changes made since startup. - (delete-dups (append file-name-handler-alist - minimal-emacs--old-file-name-handler-alist)))) + "Restore `file-name-handler-alist'." + (set-default-toplevel-value + 'file-name-handler-alist + ;; Merge instead of overwrite to preserve any changes made since startup. + (delete-dups (append file-name-handler-alist + minimal-emacs--old-file-name-handler-alist)))) (when (and minimal-emacs-optimize-file-name-handler-alist - (not minimal-emacs-debug) - (not noninteractive)) - ;; Determine the state of bundled libraries using calc-loaddefs.el. If - ;; compressed, retain the gzip handler in `file-name-handler-alist`. If - ;; compiled or neither, omit the gzip handler during startup for improved - ;; startup and package load time. - (set-default-toplevel-value - 'file-name-handler-alist - (if (locate-file-internal "calc-loaddefs.el" load-path) - nil - (list (rassq 'jka-compr-handler - minimal-emacs--old-file-name-handler-alist)))) + (not minimal-emacs-debug) + (not noninteractive)) + ;; Determine the state of bundled libraries using calc-loaddefs.el. If + ;; compressed, retain the gzip handler in `file-name-handler-alist`. If + ;; compiled or neither, omit the gzip handler during startup for improved + ;; startup and package load time. + (set-default-toplevel-value + 'file-name-handler-alist + (if (locate-file-internal "calc-loaddefs.el" load-path) + nil + (list (rassq 'jka-compr-handler + minimal-emacs--old-file-name-handler-alist)))) - ;; Ensure the new value persists through any current let-binding. - (put 'file-name-handler-alist 'initial-value - minimal-emacs--old-file-name-handler-alist) + ;; Ensure the new value persists through any current let-binding. + (put 'file-name-handler-alist 'initial-value + minimal-emacs--old-file-name-handler-alist) - ;; Emacs processes command-line files very early in startup. These files may - ;; include special paths TRAMP. Restore `file-name-handler-alist'. - (advice-add 'command-line-1 :around #'minimal-emacs--respect-file-handlers) + ;; Emacs processes command-line files very early in startup. These files may + ;; include special paths TRAMP. Restore `file-name-handler-alist'. + (advice-add 'command-line-1 :around #'minimal-emacs--respect-file-handlers) - (add-hook 'emacs-startup-hook #'minimal-emacs--restore-file-name-handler-alist - 101)) + (add-hook 'emacs-startup-hook #'minimal-emacs--restore-file-name-handler-alist + 101)) ;;; Performance: Inhibit redisplay (defun minimal-emacs--reset-inhibit-redisplay () - "Reset inhibit redisplay." - (setq-default inhibit-redisplay nil) - (remove-hook 'post-command-hook #'minimal-emacs--reset-inhibit-redisplay)) + "Reset inhibit redisplay." + (setq-default inhibit-redisplay nil) + (remove-hook 'post-command-hook #'minimal-emacs--reset-inhibit-redisplay)) (when (and minimal-emacs-inhibit-redisplay-during-startup - (not noninteractive) - (not minimal-emacs-debug)) - ;; Suppress redisplay and redraw during startup to avoid delays and - ;; prevent flashing an unstyled Emacs frame. - (setq-default inhibit-redisplay t) - (add-hook 'post-command-hook #'minimal-emacs--reset-inhibit-redisplay -100)) + (not noninteractive) + (not minimal-emacs-debug)) + ;; Suppress redisplay and redraw during startup to avoid delays and + ;; prevent flashing an unstyled Emacs frame. + (setq-default inhibit-redisplay t) + (add-hook 'post-command-hook #'minimal-emacs--reset-inhibit-redisplay -100)) ;;; Performance: Inhibit message (defun minimal-emacs--reset-inhibit-message () - "Reset inhibit message." - (setq-default inhibit-message nil) - (remove-hook 'post-command-hook #'minimal-emacs--reset-inhibit-message)) + "Reset inhibit message." + (setq-default inhibit-message nil) + (remove-hook 'post-command-hook #'minimal-emacs--reset-inhibit-message)) (when (and minimal-emacs-inhibit-message-during-startup - (not noninteractive) - (not minimal-emacs-debug)) - (setq-default inhibit-message t) - (add-hook 'post-command-hook #'minimal-emacs--reset-inhibit-message -100)) + (not noninteractive) + (not minimal-emacs-debug)) + (setq-default inhibit-message t) + (add-hook 'post-command-hook #'minimal-emacs--reset-inhibit-message -100)) ;;; Performance: Disable mode-line during startup (defvar-local minimal-emacs--hidden-mode-line nil - "Store the buffer-local value of `mode-line-format' during startup.") + "Store the buffer-local value of `mode-line-format' during startup.") (when (and minimal-emacs-disable-mode-line-during-startup - (not noninteractive) - (not minimal-emacs-debug)) - (put 'mode-line-format - 'initial-value (default-toplevel-value 'mode-line-format)) - (setq-default mode-line-format nil) - (dolist (buf (buffer-list)) - (with-current-buffer buf - (when (local-variable-p 'mode-line-format) - (setq minimal-emacs--hidden-mode-line mode-line-format) - (setq mode-line-format nil))))) + (not noninteractive) + (not minimal-emacs-debug)) + (put 'mode-line-format + 'initial-value (default-toplevel-value 'mode-line-format)) + (setq-default mode-line-format nil) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when (local-variable-p 'mode-line-format) + (setq minimal-emacs--hidden-mode-line mode-line-format) + (setq mode-line-format nil))))) ;;; Restore values (defun minimal-emacs--startup-load-user-init-file (fn &rest args) - "Advice to reset `mode-line-format'. FN and ARGS are the function and args." - (unwind-protect - ;; Start up as normal - (apply fn args) - ;; If we don't undo inhibit-{message, redisplay} and there's an error, we'll - ;; see nothing but a blank Emacs frame. - (when minimal-emacs-inhibit-message-during-startup - (setq-default inhibit-message nil)) - (when minimal-emacs-inhibit-redisplay-during-startup - (setq-default inhibit-redisplay nil)) - ;; Restore the mode-line - (when minimal-emacs-disable-mode-line-during-startup - (unless (default-toplevel-value 'mode-line-format) - (setq-default mode-line-format (get 'mode-line-format - 'initial-value))) - (dolist (buf (buffer-list)) - (with-current-buffer buf - (when (local-variable-p 'minimal-emacs--hidden-mode-line) - (setq mode-line-format minimal-emacs--hidden-mode-line) - (kill-local-variable 'minimal-emacs--hidden-mode-line))))))) + "Advice to reset `mode-line-format'. FN and ARGS are the function and args." + (unwind-protect + ;; Start up as normal + (apply fn args) + ;; If we don't undo inhibit-{message, redisplay} and there's an error, we'll + ;; see nothing but a blank Emacs frame. + (when minimal-emacs-inhibit-message-during-startup + (setq-default inhibit-message nil)) + (when minimal-emacs-inhibit-redisplay-during-startup + (setq-default inhibit-redisplay nil)) + ;; Restore the mode-line + (when minimal-emacs-disable-mode-line-during-startup + (unless (default-toplevel-value 'mode-line-format) + (setq-default mode-line-format (get 'mode-line-format + 'initial-value))) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (when (local-variable-p 'minimal-emacs--hidden-mode-line) + (setq mode-line-format minimal-emacs--hidden-mode-line) + (kill-local-variable 'minimal-emacs--hidden-mode-line))))))) (advice-add 'startup--load-user-init-file :around - #'minimal-emacs--startup-load-user-init-file) + #'minimal-emacs--startup-load-user-init-file) ;;; UI elements (defun minimal-emacs--setup-toolbar (&rest _) - "Setup the toolbar." - (when (fboundp 'tool-bar-setup) - (advice-remove 'tool-bar-setup #'ignore) - (when (bound-and-true-p tool-bar-mode) - (funcall 'tool-bar-setup)))) + "Setup the toolbar." + (when (fboundp 'tool-bar-setup) + (advice-remove 'tool-bar-setup #'ignore) + (when (bound-and-true-p tool-bar-mode) + (funcall 'tool-bar-setup)))) (unless noninteractive - (setq frame-title-format minimal-emacs-frame-title-format - icon-title-format minimal-emacs-frame-title-format) + (setq frame-title-format minimal-emacs-frame-title-format + icon-title-format minimal-emacs-frame-title-format) - ;; I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and - ;; `scroll-bar-mode' because manipulating frame parameters can trigger or queue - ;; a superfluous and potentially expensive frame redraw at startup, depending - ;; on the window system. The variables must also be set to `nil' so users don't - ;; have to call the functions twice to re-enable them. - (unless (memq 'menu-bar minimal-emacs-ui-features) - (push '(menu-bar-lines . 0) default-frame-alist) - (unless (memq window-system '(mac ns)) - (setq menu-bar-mode nil))) + ;; I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and + ;; `scroll-bar-mode' because manipulating frame parameters can trigger or queue + ;; a superfluous and potentially expensive frame redraw at startup, depending + ;; on the window system. The variables must also be set to `nil' so users don't + ;; have to call the functions twice to re-enable them. + (unless (memq 'menu-bar minimal-emacs-ui-features) + (push '(menu-bar-lines . 0) default-frame-alist) + (unless (memq window-system '(mac ns)) + (setq menu-bar-mode nil))) - (when (fboundp 'tool-bar-setup) - ;; Temporarily override the tool-bar-setup function to prevent it from - ;; running during the initial stages of startup - (advice-add 'tool-bar-setup :override #'ignore) + (when (fboundp 'tool-bar-setup) + ;; Temporarily override the tool-bar-setup function to prevent it from + ;; running during the initial stages of startup + (advice-add 'tool-bar-setup :override #'ignore) - (advice-add 'startup--load-user-init-file :after - #'minimal-emacs--setup-toolbar)) + (advice-add 'startup--load-user-init-file :after + #'minimal-emacs--setup-toolbar)) - (unless (memq 'tool-bar minimal-emacs-ui-features) - (push '(tool-bar-lines . 0) default-frame-alist) - (setq tool-bar-mode nil)) + (unless (memq 'tool-bar minimal-emacs-ui-features) + (push '(tool-bar-lines . 0) default-frame-alist) + (setq tool-bar-mode nil)) - (setq default-frame-scroll-bars 'right) - (push '(vertical-scroll-bars) default-frame-alist) - (push '(horizontal-scroll-bars) default-frame-alist) - (setq scroll-bar-mode nil) + (setq default-frame-scroll-bars 'right) + (push '(vertical-scroll-bars) default-frame-alist) + (push '(horizontal-scroll-bars) default-frame-alist) + (setq scroll-bar-mode nil) - (unless (memq 'tooltips minimal-emacs-ui-features) - (when (bound-and-true-p tooltip-mode) - (tooltip-mode -1))) + (unless (memq 'tooltips minimal-emacs-ui-features) + (when (bound-and-true-p tooltip-mode) + (tooltip-mode -1))) - ;; Disable GUIs because they are inconsistent across systems, desktop - ;; environments, and themes, and they don't match the look of Emacs. - (unless (memq 'dialogs minimal-emacs-ui-features) - (setq use-file-dialog nil) - (setq use-dialog-box nil))) + ;; Disable GUIs because they are inconsistent across systems, desktop + ;; environments, and themes, and they don't match the look of Emacs. + (unless (memq 'dialogs minimal-emacs-ui-features) + (setq use-file-dialog nil) + (setq use-dialog-box nil))) ;;; Security (setq gnutls-verify-error t) ; Prompts if there are cert issues @@ -496,7 +496,7 @@ this stage of initialization." ;;; Load post-early-init.el (when minimal-emacs-load-post-early-init - (minimal-emacs-load-user-init "post-early-init.el")) + (minimal-emacs-load-user-init "post-early-init.el")) ;; Local variables: ;; byte-compile-warnings: (not obsolete free-vars) diff --git a/init.el b/init.el index ae98230..47f9079 100644 --- a/init.el +++ b/init.el @@ -5,37 +5,37 @@ (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) (defvar elpaca-sources-directory (expand-file-name "sources/" elpaca-directory)) (defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" - :ref nil :depth 1 :inherit ignore - :files (:defaults "elpaca-test.el" (:exclude "extensions")) - :build (:not elpaca-activate))) + :ref nil :depth 1 :inherit ignore + :files (:defaults "elpaca-test.el" (:exclude "extensions")) + :build (:not elpaca-activate))) (let* ((repo (expand-file-name "elpaca/" elpaca-sources-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) - (let ((load-source-file-function nil)) (load "./elpaca-autoloads")))) + (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) + (let ((load-source-file-function nil)) (load "./elpaca-autoloads")))) (add-hook 'after-init-hook #'elpaca-process-queues) (elpaca `(,@elpaca-order)) (elpaca benchmark-init) @@ -52,7 +52,7 @@ (elpaca compat) (elpaca general) ;Keybindings (elpaca vertico) ;vertical minibuffer -(elpaca vertico-posframe) ;hover +(elpaca vertico-posframe) ;hover (elpaca orderless) ;Filtering for Consult/Vertico (elpaca marginalia) ;Annotations in the minibuffer (elpaca corfu) ;In-buffer completion @@ -63,42 +63,42 @@ (elpaca nerd-icons-dired) (elpaca nerd-icons-corfu) (elpaca doom-modeline) -(elpaca base16-theme) ;; ============================================================================== ;; EDITING & NAVIGATION ;; ============================================================================== ;;(elpaca meow) ; Modal editing -(elpaca god-mode) ; psuedo modal editing +(elpaca god-mode) ; psuedo modal editing (elpaca multiple-cursors) (elpaca avy) ; Fast jumping -(elpaca surround) ; utilties around surround selection +(elpaca surround) ; utilties around surround selection (elpaca expreg) ; expand selection (elpaca undo-fu) (elpaca vundo) ; Visual undo tree (elpaca xclip) -(elpaca clipetty) ; clipboard stuff TUI-GUI-Wayland +(elpaca clipetty) ; clipboard stuff TUI-GUI-Wayland (elpaca embark) ; Contextual actions (elpaca embark-consult) -(elpaca wgrep) ; allow writeable grep buffers -;(elpaca lsp-embark) +(elpaca wgrep) ; allow writeable grep buffers + ;(elpaca lsp-embark) (elpaca kirigami) ; folding meta utility -(elpaca pcre2el) ; fix regex +(elpaca pcre2el) ; fix regex ;; ============================================================================== ;; CODE ANALYSIS & VISUALS ;; ============================================================================== -(elpaca treesit-auto) ; automatically install treesitter grammars -(elpaca treesit-fold) ; folding based on treesit +(elpaca treesit-auto) ; automatically install treesitter grammars +(elpaca treesit-fold) ; folding based on treesit (elpaca highlight-quoted) ; emacs -(elpaca highlight-defined) ; emacs -(elpaca color-identifiers-mode) ; emacs -(elpaca highlight-parentheses) ; delimiters around point -(elpaca rainbow-delimiters) ; rainbow colours for pairs +(elpaca highlight-defined) ; emacs +(elpaca color-identifiers-mode) ; emacs +(elpaca highlight-parentheses) ; delimiters around point +(elpaca rainbow-delimiters) ; rainbow colours for pairs (elpaca outline-indent) ; -(elpaca (svg-margin :repo "chiply/svg-margin" - :host github)) +(elpaca (svg-margin + :repo "chiply/svg-margin" + :host github)) ;; ============================================================================== ;; LSP & DEVELOPMENT ;; ============================================================================== @@ -125,19 +125,21 @@ ;; UTILITIES ;; ============================================================================== -(elpaca consult) ; Enhanced search/navigation -(elpaca ghostel) ; terminal +(elpaca consult) ; Enhanced search/navigation +(elpaca ghostel) ; terminal (elpaca shell-pop) -(elpaca colorful-mode) ; colourise color codes -(elpaca (dirvish :repo "latiagertrutis/dirvish" - :host github)) ; broken on emacs 30, fixed by using fork -(elpaca (dired-clipboard :repo "kn66/dired-clipboard.el" ;system clipboard in dired - :host github)) -(elpaca transient) ; bindings in modes -(elpaca magit) ; git client -(elpaca transpose-frame) ; edit frame layout -(elpaca jit-spell) ; spellcheck -(elpaca sudo-edit) ; sudo util +(elpaca colorful-mode) ; colourise color codes +(elpaca (dirvish + :repo "latiagertrutis/dirvish" + :host github)) ; broken on emacs 30, fixed by using fork +(elpaca (dired-clipboard + :repo "kn66/dired-clipboard.el" ;system clipboard in dired + :host github)) +(elpaca transient) ; bindings in modes +(elpaca magit) ; git client +(elpaca transpose-frame) ; edit frame layout +(elpaca jit-spell) ; spellcheck +(elpaca sudo-edit) ; sudo util ;; ============================================================================== ;; KNOWLEDGE MANAGEMENT (ZK/DENOTE) ;; ============================================================================== @@ -151,9 +153,9 @@ ;; ============================================================================== (elpaca elpaca-use-package - ;; Automatically adds :ensure t and :defer t to use-package declarations - (elpaca-use-package-mode) - (setq elpaca-use-package-by-default t)) + ;; Automatically adds :ensure t and :defer t to use-package declarations + (elpaca-use-package-mode) + (setq elpaca-use-package-by-default t)) (load (expand-file-name "config.el" user-emacs-directory)) (custom-set-variables @@ -162,7 +164,7 @@ ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(custom-safe-themes - '())) + '())) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -174,4 +176,4 @@ (setq minimal-emacs--success t) (setq initial-major-mode 'fundamental-mode - initial-scratch-message nil) + initial-scratch-message nil) diff --git a/packages/completion-packages.el b/packages/completion-packages.el index 92fe37d..3172ee8 100644 --- a/packages/completion-packages.el +++ b/packages/completion-packages.el @@ -1,60 +1,69 @@ ;;; completion-packages.el --- Completion stack configuration -*- lexical-binding: t; -*- (use-package corfu - :config - (global-corfu-mode) - (corfu-popupinfo-mode) - (setq corfu-quit-at-boundary 'seperator - corfu-quit-no-match 'seperator) - :custom - (corfu-auto t) - (corfu-auto-delay 0.2) - (corfu-auto-prefix 2) - (corfu-popupinfo-delay '(0.5 . 0.3))) + :config + (global-corfu-mode) + (corfu-popupinfo-mode) + (setq corfu-quit-at-boundary 'separator + corfu-quit-no-match 'separator) + :custom + (corfu-auto t) + (corfu-auto-delay 0.1) + (corfu-auto-prefix 1) + (corfu-popupinfo-delay '(0.5 . 0.3))) (use-package vertico - :init - (vertico-mode) - :config - (vertico-multiform-mode t) + :init + (vertico-mode) + :config + (vertico-multiform-mode t) - (setq vertico-multiform-commands - '( - (consult-imenu posframe indexed) - (consult-completion-in-region grid))) - ) + (setq vertico-multiform-commands + '( + (consult-imenu posframe indexed) + (consult-completion-in-region grid))) + ) (use-package vertico-posframe - :after vertico - :config - (vertico-posframe-mode t) + :after vertico + :config + (vertico-posframe-mode t) - (setq vertico-posframe-width 150 - vertico-posframe-min-width 90 - vertico-posframe-border-width 3 - vertico-count 15 - vertico-scroll-margin 4) - ) + (setq vertico-posframe-width 150 + vertico-posframe-min-width 90 + vertico-posframe-border-width 3 + vertico-count 15 + vertico-scroll-margin 4) + ) -;use consult + vertico instead of corfu if in terminal + ;use consult + vertico instead of corfu if in terminal (use-package consult - :defer t - :init - (setq completion-in-region-function #'consult-completion-in-region - consult-fd-args '("fd" "--color=never" "--hidden" )) - :config - (add-hook 'after-change-major-mode-hook - (lambda () - (setq completion-in-region-function #'consult-completion-in-regionc))) - ) + :defer t + :init + (setq completion-in-region-function #'consult-completion-in-region + consult-fd-args '("fd" "--color=never" "--hidden" )) + :config + (add-hook 'after-change-major-mode-hook + (lambda () + (setq completion-in-region-function #'consult-completion-in-region))) + ) (use-package marginalia - :init - (marginalia-mode)) + :init + (marginalia-mode)) (use-package orderless - :custom - (completion-styles '(orderless basic)) - (completion-pcm-leading-wildcard t)) + :custom + (completion-styles '(orderless basic)) + (completion-pcm-leading-wildcard t) + (completion-category-defaults nil) + (orderless-matching-styles '(orderless-prefixes orderless-literal)) + + :config + ;;necessary to force filtering of lsp-mode candidates + (add-to-list 'completion-category-overrides + '(lsp-capf (styles orderless) + (orderless-matching-styles orderless-prefixes orderless-literal))) + ) (provide 'completion-packages) diff --git a/packages/dev-packages.el b/packages/dev-packages.el index a361b25..06ce8ae 100644 --- a/packages/dev-packages.el +++ b/packages/dev-packages.el @@ -1,130 +1,138 @@ ;; Tree-sitter & LSP tweaks (Core transformative changes) (use-package treesit-auto - :functions global-treesit-auto-mode - :config - (treesit-auto-add-to-auto-mode-alist 'all) - :hook (after-init . global-treesit-auto-mode) - :custom - (treesit-auto-install 'prompt) - ) + :functions global-treesit-auto-mode + :config + (treesit-auto-add-to-auto-mode-alist 'all) + :hook (after-init . global-treesit-auto-mode) + :custom + (treesit-auto-install 'prompt) + ) (use-package treesit-fold - :defer t - :commands (treesit-fold-close - treesit-fold-close-all - treesit-fold-open - treesit-fold-toggle - treesit-fold-open-all - treesit-fold-mode - global-treesit-fold-mode - treesit-fold-open-recursively - treesit-fold-line-comment-mode) - :custom - (treesit-fold-line-count-show t) - (treesit-fold-line-count-format "--▼--") - :config - (set-face-attribute 'treesit-fold-replacement-face nil - :foreground "#808080" - :box nil - :weight 'bold)) + :defer t + :commands (treesit-fold-close + treesit-fold-close-all + treesit-fold-open + treesit-fold-toggle + treesit-fold-open-all + treesit-fold-mode + global-treesit-fold-mode + treesit-fold-open-recursively + treesit-fold-line-comment-mode) + :custom + (treesit-fold-line-count-show t) + (treesit-fold-line-count-format "--▼--") + :config + (set-face-attribute 'treesit-fold-replacement-face nil + :foreground "#808080" + :box nil + :weight 'bold)) ;; Tree-sitter hooks (dolist (hook '(c-ts-mode-hook c++-ts-mode-hook java-ts-mode-hook rust-ts-mode-hook go-ts-mode-hook ruby-ts-mode-hook js-ts-mode-hook typescript-ts-mode-hook tsx-ts-mode-hook css-ts-mode-hook html-ts-mode-hook bash-ts-mode-hook cmake-ts-mode-hook dockerfile-ts-mode-hook json-ts-mode-hook toml-ts-mode-hook yaml-ts-mode-hook)) - (add-hook hook #'treesit-fold-mode)) + (add-hook hook #'treesit-fold-mode)) (with-eval-after-load 'treesit - (setq treesit-font-lock-level 4)) + (setq treesit-font-lock-level 4)) (use-package mason - :defer t - :config - (mason-setup)) + :defer t + :config + (mason-setup)) (defvar my/lsp-mode-hooks - '(c-mode-hook - c++-mode-hook - c-ts-mode-hook - c++-ts-mode-hook - typescript-ts-mode-hook - js-ts-mode-hook - tsx-ts-mode-hook - arduino-mode-hook - toml-ts-mode-hook - json-ts-mode-hook - python-mode-hook) - "List of major mode hooks to enable LSP.") + '(c-mode-hook + c++-mode-hook + c-ts-mode-hook + c++-ts-mode-hook + typescript-ts-mode-hook + js-ts-mode-hook + tsx-ts-mode-hook + arduino-mode-hook + toml-ts-mode-hook + json-ts-mode-hook + python-mode-hook) + "List of major mode hooks to enable LSP.") (dolist (hook my/lsp-mode-hooks) - (add-hook hook #'lsp-deferred)) + (add-hook hook #'lsp-deferred)) (use-package lsp-mode - :defer t - :commands lsp - :init - (setq lsp-keymap-prefix "C-l") - :config - (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)) - (setq lsp-clients-clangd-executable "clangd" - lsp-clangd-binary-path "/usr/bin/clangd" - lsp-clients--clangd-default-executable "/usr/bind/clangd" - lsp-completion-provider :none - lsp-clients-clangd-args '("--header-insertion=iwyu" "--fallback-style=LLVM") - ) + :defer t + :commands lsp + :init + (setq lsp-keymap-prefix "C-l") + :config + (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration) + (setq lsp-clients-clangd-executable "clangd" + lsp-clangd-binary-path "/usr/bin/clangd" + lsp-clients--clangd-default-executable "/usr/bin/clangd" + lsp-completion-provider :none + lsp-completion-enable-filtering nil + lsp-completion-sort-initial-results t + lsp-clients-clangd-args '("--header-insertion=iwyu" + "--fallback-style=LLVM" + "-query-driver=/usr/bin/c++" + "--header-insertion-decorators") - (with-eval-after-load 'lsp-mode - (define-key lsp-command-map (kbd "a") #'lsp-execute-code-action) - (define-key lsp-command-map (kbd "d") #'lsp-ui-doc-glance) - (define-key lsp-command-map (kbd "r") #'lsp-rename) - - ;; Safe Capability Filter: Handles both association list (alist) and hash-table formats - (advice-add 'lsp--client-capabilities :filter-return - (lambda (caps) - (cond - ;; If it's a hash table - ((hash-table-p caps) - (when-let ((text-doc (gethash "textDocument" caps))) - (if (hash-table-p text-doc) - (remhash "inlineCompletion" text-doc) - (setcdr (assoc "inlineCompletion" text-doc) nil)))) - ;; If it's an association list (alist) - ((listp caps) - (when-let ((text-doc (cdr (assoc 'textDocument caps)))) - (setcdr (assoc 'textDocument caps) - (assq-delete-all 'inlineCompletion text-doc))))) - caps)) - - ;; Set up arduino-mode safely after lsp-mode is loaded - (add-to-list 'lsp-language-id-configuration '(arduino-mode . "cpp")) - (lsp-register-client - (make-lsp-client - :new-connection (lsp-stdio-connection '("clangd" "--header-insertion=never")) - :activation-fn (lsp-activate-on "arduino") - :server-id 'lsp-arduino-clangd - )))) - -(use-package lsp-ui - :defer t - :after lsp-mode - :commands lsp-ui-mode - :init - (setq lsp-ui-sideline-show-symbol t - lsp-ui-side-show-code-actions t - lsp-ui-sideline-show-hover t - - lsp-ui-doc-enable t - lsp-ui-doc-delay 1 - lsp-ui-doc-position 'at-point - lsp-ui-sideline-show-hover t - lsp-ui-sideline-show-diagnostics t - lsp-ui-side-show-code-actions t - lsp-ui-sideline-delay 0.25 - - ) - ) + lsp-enable-indentation t + lsp-enable-on-type-formatting nil + )) (with-eval-after-load 'lsp-mode - (add-to-list 'lsp-disabled-clients 'tailwindcss)) + (define-key lsp-command-map (kbd "a") #'lsp-execute-code-action) + (define-key lsp-command-map (kbd "d") #'lsp-ui-doc-glance) + (define-key lsp-command-map (kbd "r") #'lsp-rename) + + ;; Safe Capability Filter: Handles both association list (alist) and hash-table formats + (advice-add 'lsp--client-capabilities :filter-return + (lambda (caps) + (cond + ;; If it's a hash table + ((hash-table-p caps) + (when-let ((text-doc (gethash "textDocument" caps))) + (if (hash-table-p text-doc) + (remhash "inlineCompletion" text-doc) + (setcdr (assoc "inlineCompletion" text-doc) nil)))) + ;; If it's an association list (alist) + ((listp caps) + (when-let ((text-doc (cdr (assoc 'textDocument caps)))) + (setcdr (assoc 'textDocument caps) + (assq-delete-all 'inlineCompletion text-doc))))) + caps)) + + ;; Set up arduino-mode safely after lsp-mode is loaded + (add-to-list 'lsp-language-id-configuration '(arduino-mode . "cpp")) + (lsp-register-client + (make-lsp-client + :new-connection (lsp-stdio-connection '("clangd" "--header-insertion=never")) + :activation-fn (lsp-activate-on "arduino") + :server-id 'lsp-arduino-clangd + ))) + +(use-package lsp-ui + :defer t + :after lsp-mode + :commands lsp-ui-mode + :init + (setq lsp-ui-sideline-show-symbol t + lsp-ui-side-show-code-actions t + lsp-ui-sideline-show-hover t + + lsp-ui-doc-enable t + lsp-ui-doc-delay 1 + lsp-ui-doc-position 'at-point + lsp-ui-sideline-show-hover t + lsp-ui-sideline-show-diagnostics t + lsp-ui-side-show-code-actions t + lsp-ui-sideline-delay 0.25 + + ) + ) + +(with-eval-after-load 'lsp-mode + (add-to-list 'lsp-disabled-clients 'tailwindcss)) (provide 'dev-packages) diff --git a/packages/editing-packages.el b/packages/editing-packages.el index bb522d1..570ca4e 100644 --- a/packages/editing-packages.el +++ b/packages/editing-packages.el @@ -1,40 +1,40 @@ ;;; editing-packages.el --- Editing and navigation configuration -*- lexical-binding: t; -*- (use-package avy - :defer t - :config - (setq avy-timeout-seconds 0.25 - avy-style 'at-full - avy-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l ?A ?S ?D ?F ?G ?H ?J ?K ?L) - avy-orders-alist nil) - ) + :defer t + :config + (setq avy-timeout-seconds 0.25 + avy-style 'at-full + avy-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) + avy-orders-alist nil) + ) (use-package surround - :defer t - :bind-keymap ("M-'" . surround-keymap)) + :defer t + :bind-keymap ("M-'" . surround-keymap)) (use-package kirigami - :defer t - :commands (kirigami-open-fold - kirigami-open-fold-rec - kirigami-close-fold - kirigami-toggle-fold - kirigami-open-folds - kirigami-close-folds-except-current - kirigami-close-folds)) + :defer t + :commands (kirigami-open-fold + kirigami-open-fold-rec + kirigami-close-fold + kirigami-toggle-fold + kirigami-open-folds + kirigami-close-folds-except-current + kirigami-close-folds)) (use-package embark - :defer t - :bind - (("M-m" . embark-act) - ("C-h B" . embark-bindings) - ) - :config - (add-to-list 'display-buffer-alist - '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" - nil - (window-parameters (mode-line-format . none)))) - ) + :defer t + :bind + (("M-m" . embark-act) + ("C-h B" . embark-bindings) + ) + :config + (add-to-list 'display-buffer-alist + '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" + nil + (window-parameters (mode-line-format . none)))) + ) (provide 'editing-packages) diff --git a/packages/system-packages.el b/packages/system-packages.el index 0733d72..6337fb5 100644 --- a/packages/system-packages.el +++ b/packages/system-packages.el @@ -1,44 +1,44 @@ ;;; system-packages.el --- System and utility package configuration -*- lexical-binding: t; -*- (use-package clipetty - :hook (after-init . global-clipetty-mode)) + :hook (after-init . global-clipetty-mode)) (use-package dirvish - :config - (dirvish-peek-mode) - (dirvish-side-follow-mode) - (add-hook 'dirvish-directory-view-mode 'diredfl-mode) - (with-eval-after-load 'dirvish - (define-key dirvish-mode-map (kbd "a") #'dirvish-setup-menu) - (define-key dirvish-mode-map (kbd "v") #'dirvish-move)) - ) + :config + (dirvish-peek-mode) + (dirvish-side-follow-mode) + (add-hook 'dirvish-directory-view-mode 'diredfl-mode) + (with-eval-after-load 'dirvish + (define-key dirvish-mode-map (kbd "a") #'dirvish-setup-menu) + (define-key dirvish-mode-map (kbd "v") #'dirvish-move)) + ) (use-package shell-pop - :defer t - :custom - ;(shell-pop-universal-key "C-s s") - (shell-pop-window-position "bottom") - (shell-pop-term-shell shell-file-name) - (shell-pop-window-size 50) - ) + :defer t + :custom + ;(shell-pop-universal-key "C-s s") + (shell-pop-window-position "bottom") + (shell-pop-term-shell shell-file-name) + (shell-pop-window-size 50) + ) (with-eval-after-load 'shell-pop - (setopt shell-pop-shell-type '("ghostel" "*ghostel*" - (lambda () - (when (fboundp 'ghostel) - (let ((ghostel-shell shell-pop-term-shell)) - (ghostel))))))) + (setopt shell-pop-shell-type '("ghostel" "*ghostel*" + (lambda () + (when (fboundp 'ghostel) + (let ((ghostel-shell shell-pop-term-shell)) + (ghostel))))))) (use-package dired-clipboard - :hook (dired-mode . dired-clipboard-mode) - :config - (setq dired-clipboard-use-wl-copy t - dired-clipboard-wayland-target 'uri-list) - ) + :hook (dired-mode . dired-clipboard-mode) + :config + (setq dired-clipboard-use-wl-copy t + dired-clipboard-wayland-target 'uri-list) + ) (use-package benchmark-init - :hook - (after-init . benchmark-init/deactivate)) + :hook + (after-init . benchmark-init/deactivate)) (provide 'system-packages) diff --git a/packages/tutilities-packages.el b/packages/tutilities-packages.el index 03d0ab1..a068f27 100644 --- a/packages/tutilities-packages.el +++ b/packages/tutilities-packages.el @@ -1,10 +1,9 @@ - (use-package denote - :defer t - :config - (setq denote-directory (list (expand-file-name "~/lyrinv/SOR/Notes/")) - denote-file-type 'markdown-yaml - denote-prompts '(title subdirectory keywords)) - ) + :defer t + :config + (setq denote-directory (list (expand-file-name "~/lyrinv/SOR/Notes/")) + denote-file-type 'markdown-yaml + denote-prompts '(title subdirectory keywords)) + ) (provide 'tutilities-packages) diff --git a/packages/visuals-packages.el b/packages/visuals-packages.el index 5729749..ea03da8 100644 --- a/packages/visuals-packages.el +++ b/packages/visuals-packages.el @@ -1,68 +1,67 @@ ;;; visuals-packages.el --- Visual and structural configuration -*- lexical-binding: t; -*- t (use-package highlight-quoted - :hook (emacs-lisp-mode . highlight-quoted-mode)) + :hook (emacs-lisp-mode . highlight-quoted-mode)) (use-package highlight-defined - :hook (emacs-lisp-mode . highlight-defined-mode)) + :hook (emacs-lisp-mode . highlight-defined-mode)) (use-package color-identifiers-mode - :hook (emacs-lisp-mode . color-identifiers-mode)) + :hook (emacs-lisp-mode . color-identifiers-mode)) (use-package rainbow-delimiters - :hook - (prog-mode . rainbow-delimiters-mode) - (inferior-ess-mode . rainbow-delimiters-mode)) + :hook + (prog-mode . rainbow-delimiters-mode) + (inferior-ess-mode . rainbow-delimiters-mode)) (use-package highlight-parentheses - :hook (prog-mode . highlight-parentheses-mode) - :config - (setq highlight-parentheses-colors - '("grey95" "#111" "#333" "#666") - highlight-parentheses-background-colors - '("pink" "blue" "green" "red") - ) - ) + :hook (prog-mode . highlight-parentheses-mode) + :config + (setq highlight-parentheses-colors + '("grey95" "#111" "#333" "#666") + highlight-parentheses-background-colors + '("pink" "blue" "green" "red") + ) + ) (use-package colorful-mode - :defer t - :config (setq colorful-allow-mouse-clicks nil)) + :defer t + :config (setq colorful-allow-mouse-clicks nil)) (use-package doom-modeline - :defer t - :hook - (window-setup . doom-modeline-mode) - :config - (setq - ;doom-modeline-minor-modes t - doom-modeline-indent-info t - doom-modeline-column-zero-based t - doom-modeline-position-column-line-format '("%l:%c")) - ) + :defer t + :hook + (window-setup . doom-modeline-mode) + :config + (setq + ;doom-modeline-minor-modes t + doom-modeline-indent-info t + doom-modeline-column-zero-based t + doom-modeline-position-column-line-format '("%l:%c")) + ) ;;--- ;; icons ;;--- (use-package nerd-icons-completion - :defer t - :after marginalia - :config - (nerd-icons-completion-mode) - (add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)) + :defer t + :after marginalia + :config + (nerd-icons-completion-mode) + (add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)) (use-package nerd-icons-corfu - :defer t - :after corfu - :config - (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) + :defer t + :after corfu + :config + (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) (use-package nerd-icons-dired - :defer t - :config - (nerd-icons-dired-mode) - (add-hook 'dired-mode-hook #'nerd-icons-dired-mode)) + :defer t + :config + (nerd-icons-dired-mode) + (add-hook 'dired-mode-hook #'nerd-icons-dired-mode)) (provide 'visuals-packages) -