This commit is contained in:
2025-07-08 21:00:40 +09:00
6 changed files with 696 additions and 160 deletions

View File

1
.gitignore vendored
View File

@@ -2,7 +2,6 @@
!README.md !README.md
!early-init.el !early-init.el
!init.el !init.el
!.images/
!.github/ !.github/
!.LICENSE !.LICENSE

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="151" height="20" role="img" aria-label="Made for: GNU Emacs"><title>Made for: GNU Emacs</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="151" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="76" height="20" fill="#555"/><rect x="76" width="75" height="20" fill="#7f5ab6"/><rect width="151" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjZmFmYWZhIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+R05VIEVtYWNzPC90aXRsZT48cGF0aCBkPSJNMTIsMjRDNS40NDgsMjQsMC4xMTgsMTguNjE3LDAuMTE4LDEyUzUuNDQ4LDAsMTIsMGM2LjU1MiwwLDExLjg4Miw1LjM4MywxMS44ODIsMTJTMTguNTUyLDI0LDEyLDI0eiBNMTIsMC42NjEgQzUuODEzLDAuNjYxLDAuNzc5LDUuNzQ4LDAuNzc5LDEyUzUuODEzLDIzLjMzOSwxMiwyMy4zMzljNi4xODcsMCwxMS4yMjEtNS4wODYsMTEuMjIxLTExLjMzOVMxOC4xODcsMC42NjEsMTIsMC42NjF6IE04LjAzLDIwLjE5NyBjMCwwLDAuOTc4LDAuMDY5LDIuMjM2LTAuMDQyYzAuNTEtMC4wNDUsMi40NDQtMC4yMzUsMy44OTEtMC41NTJjMCwwLDEuNzY0LTAuMzc3LDIuNzA3LTAuNzI1YzAuOTg3LTAuMzY0LDEuNTI0LTAuNjczLDEuNzY2LTEuMTEgYy0wLjAxMS0wLjA5LDAuMDc0LTAuNDA4LTAuMzgxLTAuNTk5Yy0xLjE2NC0wLjQ4OC0yLjUxNC0wLjQtNS4xODUtMC40NTdjLTIuOTYyLTAuMTAyLTMuOTQ4LTAuNTk4LTQuNDcyLTAuOTk3IGMtMC41MDMtMC40MDUtMC4yNS0xLjUyNiwxLjkwNy0yLjUxM2MxLjA4Ni0wLjUyNiw1LjM0NS0xLjQ5Niw1LjM0NS0xLjQ5NmMtMS40MzQtMC43MDktNC4xMDktMS45NTUtNC42NTktMi4yMjQgYy0wLjQ4Mi0wLjIzNi0xLjI1NC0wLjU5MS0xLjQyMS0xLjAyMWMtMC4xOS0wLjQxMywwLjQ0OC0wLjc2OCwwLjgwNC0wLjg3YzEuMTQ3LTAuMzMxLDIuNzY2LTAuNTM2LDQuMjQtMC41NiBjMC43NDEtMC4wMTIsMC44NjEtMC4wNTksMC44NjEtMC4wNTljMS4wMjItMC4xNywxLjY5NS0wLjg2OSwxLjQxNC0xLjk3NmMtMC4yNTItMS4xMy0xLjU3OS0xLjc5NS0yLjg0LTEuNTY1IGMtMS4xODgsMC4yMTctNC4wNSwxLjA0OC00LjA1LDEuMDQ4YzMuNTM5LTAuMDMxLDQuMTMxLDAuMDI4LDQuMzk1LDAuMzk4YzAuMTU2LDAuMjE4LTAuMDcxLDAuNTE4LTEuMDE1LDAuNjcyIGMtMS4wMjcsMC4xNjgtMy4xNjMsMC4zNy0zLjE2MywwLjM3Yy0yLjA0OSwwLjEyMi0zLjQ5MiwwLjEzLTMuOTI1LDEuMDQ2QzYuMjAyLDcuNTY0LDYuNzg3LDguMDk0LDcuMDQzLDguNDI1IGMxLjA4MiwxLjIwNCwyLjY0NiwxLjg1MywzLjY1MiwyLjMzMWMwLjM3OSwwLjE4LDEuNDksMC41MiwxLjQ5LDAuNTJjLTMuMjY1LTAuMTgtNS42MTksMC44MjMtNy4wMDEsMS45NzcgYy0xLjU2MiwxLjQ0NS0wLjg3MSwzLjE2OCwyLjMzLDQuMjI4YzEuODkxLDAuNjI2LDIuODI4LDAuOTIxLDUuNjQ4LDAuNjY3YzEuNjYxLTAuMDksMS45MjMtMC4wMzYsMS45MzksMC4xIGMwLjAyMywwLjE5Mi0xLjg0NSwwLjY2OS0yLjM1NSwwLjgxNkMxMS40NDgsMTkuNDM4LDguMDQ3LDIwLjE5Myw4LjAzLDIwLjE5N3oiLz48L3N2Zz4="/><text aria-hidden="true" x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="490">Made for</text><text x="475" y="140" transform="scale(.1)" fill="#fff" textLength="490">Made for</text><text aria-hidden="true" x="1125" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="650">GNU Emacs</text><text x="1125" y="140" transform="scale(.1)" fill="#fff" textLength="650">GNU Emacs</text></g></svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

582
README.md

File diff suppressed because it is too large Load Diff

View File

@@ -4,21 +4,36 @@
;; URL: https://github.com/jamescherti/minimal-emacs.d ;; URL: https://github.com/jamescherti/minimal-emacs.d
;; Package-Requires: ((emacs "29.1")) ;; Package-Requires: ((emacs "29.1"))
;; Keywords: maint ;; Keywords: maint
;; Version: 1.2.0 ;; Version: 1.2.1
;; SPDX-License-Identifier: GPL-3.0-or-later ;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Commentary: ;;; Commentary:
;; The minimal-emacs.d project is a customizable base that provides better Emacs ;; The minimal-emacs.d project is a lightweight and optimized Emacs base
;; defaults and optimized startup, intended to serve as a solid foundation for ;; (init.el and early-init.el) that gives you full control over your
;; your vanilla Emacs configuration. ;; configuration. It provides better defaults, an optimized startup, and a clean
;; foundation for building your own vanilla Emacs setup.
;;
;; Building the minimal-emacs.d init.el and early-init.el was the result of
;; extensive research and testing to fine-tune the best parameters and
;; optimizations for an Emacs configuration.
;;
;; Do not modify this file; instead, modify pre-early-init.el or
;; post-early-init.el.
;;; Code: ;;; Code:
;;; Internal variables
(defvar minimal-emacs--backup-gc-cons-threshold gc-cons-threshold
"Backup of the original value of `gc-cons-threshold' before startup.")
(setq gc-cons-threshold most-positive-fixnum)
;;; Variables ;;; Variables
(defvar minimal-emacs-ui-features '() (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 Emacs UI features that can be enabled: This variable holds a list of Emacs UI features that can be enabled:
- context-menu (Enables the context menu in graphical environments.) - context-menu (Enables the context menu in graphical environments.)
- tool-bar (Enables the tool bar in graphical environments.) - tool-bar (Enables the tool bar in graphical environments.)
- menu-bar (Enables the menu bar in graphical environments.) - menu-bar (Enables the menu bar in graphical environments.)
@@ -31,14 +46,17 @@ This variable holds a list Emacs UI features that can be enabled:
(defvar minimal-emacs-debug (bound-and-true-p init-file-debug) (defvar minimal-emacs-debug (bound-and-true-p init-file-debug)
"Non-nil to enable debug.") "Non-nil to enable debug.")
(defvar minimal-emacs-gc-cons-threshold (* 32 1024 1024)
"Value to set `gc-cons-threshold' to after Emacs startup.
Ignored if `minimal-emacs-optimize-startup-gc' is nil.")
(defvar minimal-emacs-optimize-startup-gc t (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 After Emacs finishes loading, `gc-cons-threshold' is restored to the value
stored in `minimal-emacs--restore-gc-cons-threshold'.") 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.
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'.")
(defvar minimal-emacs-inhibit-redisplay-during-startup nil (defvar minimal-emacs-inhibit-redisplay-during-startup nil
"Suppress redisplay during startup to improve performance. "Suppress redisplay during startup to improve performance.
@@ -66,15 +84,21 @@ When set to non-nil, Emacs will automatically call `package-initialize' and
`package-refresh-contents' to set up and update the package system.") `package-refresh-contents' to set up and update the package system.")
(defvar minimal-emacs-setup-native-compilation t (defvar minimal-emacs-setup-native-compilation t
"If non-nil, enable and configure native compilation. "Controls whether native compilation settings are enabled during setup.
When enabled, this variable sets the following: When non-nil, the following variables are set to non-nil to enable
native compilation features:
- `native-comp-deferred-compilation' - `native-comp-deferred-compilation'
- `native-comp-jit-compilation' - `native-comp-jit-compilation'
- `package-native-compile'") - `package-native-compile'
If nil, these variables are left at their default values and are not
modified during setup.")
(defvar minimal-emacs-user-directory user-emacs-directory (defvar minimal-emacs-user-directory user-emacs-directory
"The default value of the `user-emacs-directory' variable.") "The default value of the `user-emacs-directory' variable.")
(defvar minimal-emacs-dired-group-directories-first nil
"If non-nil, group directories first in Dired listings.")
;;; Load pre-early-init.el ;;; Load pre-early-init.el
;; Prefer loading newer compiled files ;; Prefer loading newer compiled files
@@ -135,22 +159,33 @@ pre-early-init.el, and post-early-init.el.")
(setq garbage-collection-messages minimal-emacs-debug) (setq garbage-collection-messages minimal-emacs-debug)
(defun minimal-emacs--restore-gc-cons-threshold () (defun minimal-emacs--restore-gc-cons-threshold ()
"Restore `minimal-emacs-gc-cons-threshold'." "Restore `gc-cons-threshold' to `minimal-emacs-gc-cons-threshold'."
(setq gc-cons-threshold minimal-emacs-gc-cons-threshold)) (if (bound-and-true-p minimal-emacs-gc-cons-threshold-restore-delay)
;; Defer garbage collection during initialization to avoid 2 collections.
(run-at-time
minimal-emacs-gc-cons-threshold-restore-delay nil
(lambda () (setq gc-cons-threshold minimal-emacs-gc-cons-threshold)))
(setq gc-cons-threshold minimal-emacs-gc-cons-threshold)))
(when minimal-emacs-optimize-startup-gc (if minimal-emacs-optimize-startup-gc
(setq gc-cons-threshold most-positive-fixnum) ;; `gc-cons-threshold' is managed by minimal-emacs.d
(add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc-cons-threshold 105)) (add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc-cons-threshold 105)
;; gc-cons-threshold is not managed by minimal-emacs.d.
;; If it is equal to `most-positive-fixnum', this indicates that the user has
;; not overridden the value in their `pre-early-init.el' configuration.
(when (= gc-cons-threshold most-positive-fixnum)
(setq gc-cons-threshold minimal-emacs--backup-gc-cons-threshold)))
;;; Native compilation and Byte compilation ;;; Native compilation and Byte compilation
(if (and (featurep 'native-compile) (if (and (featurep 'native-compile)
(fboundp 'native-comp-available-p) (fboundp 'native-comp-available-p)
(native-comp-available-p)) (native-comp-available-p))
(when minimal-emacs-setup-native-compilation
;; Activate `native-compile' ;; Activate `native-compile'
(setq native-comp-deferred-compilation minimal-emacs-setup-native-compilation (setq native-comp-deferred-compilation t
native-comp-jit-compilation minimal-emacs-setup-native-compilation native-comp-jit-compilation t
package-native-compile minimal-emacs-setup-native-compilation) package-native-compile t))
;; Deactivate the `native-compile' feature if it is not available ;; Deactivate the `native-compile' feature if it is not available
(setq features (delq 'native-compile features))) (setq features (delq 'native-compile features)))
@@ -180,6 +215,9 @@ pre-early-init.el, and post-early-init.el.")
(setq warning-minimum-level (if minimal-emacs-debug :warning :error)) (setq warning-minimum-level (if minimal-emacs-debug :warning :error))
(setq warning-suppress-types '((lexical-binding))) (setq warning-suppress-types '((lexical-binding)))
(when minimal-emacs-debug
(setq message-log-max 16384))
;;; Performance: Miscellaneous options ;;; Performance: Miscellaneous options
;; Font compacting can be very resource-intensive, especially when rendering ;; Font compacting can be very resource-intensive, especially when rendering
@@ -187,6 +225,10 @@ pre-early-init.el, and post-early-init.el.")
(setq inhibit-compacting-font-caches t) (setq inhibit-compacting-font-caches t)
(when (and (not (daemonp)) (not noninteractive)) (when (and (not (daemonp)) (not noninteractive))
;; 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 ;; Without this, Emacs will try to resize itself to a specific column size
(setq frame-inhibit-implied-resize t) (setq frame-inhibit-implied-resize t)
@@ -216,8 +258,13 @@ pre-early-init.el, and post-early-init.el.")
;; `inhibit-startup-screen', but it would still initialize anyway. ;; `inhibit-startup-screen', but it would still initialize anyway.
(advice-add 'display-startup-screen :override #'ignore) (advice-add 'display-startup-screen :override #'ignore)
;; Shave seconds off startup time by starting the scratch buffer in ;; The initial buffer is created during startup even in non-interactive
;; `fundamental-mode' ;; sessions, and its major mode is fully initialized. Modes like `text-mode',
;; `org-mode', or even the default `lisp-interaction-mode' load extra packages
;; and run hooks, which can slow down startup.
;;
;; Using `fundamental-mode' for the initial buffer to avoid unnecessary
;; startup overhead.
(setq initial-major-mode 'fundamental-mode (setq initial-major-mode 'fundamental-mode
initial-scratch-message nil) initial-scratch-message nil)
@@ -416,7 +463,7 @@ this stage of initialization."
(setq package-archives '(("melpa" . "https://melpa.org/packages/") (setq package-archives '(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/"))) ("nongnu" . "https://elpa.nongnu.org/nongnu/")))
(customize-set-variable 'package-archive-priorities '(("gnu" . 99) (setq package-archive-priorities '(("gnu" . 99)
("nongnu" . 80) ("nongnu" . 80)
("melpa" . 70))) ("melpa" . 70)))

147
init.el
View File

@@ -4,13 +4,20 @@
;; URL: https://github.com/jamescherti/minimal-emacs.d ;; URL: https://github.com/jamescherti/minimal-emacs.d
;; Package-Requires: ((emacs "29.1")) ;; Package-Requires: ((emacs "29.1"))
;; Keywords: maint ;; Keywords: maint
;; Version: 1.2.0 ;; Version: 1.2.1
;; SPDX-License-Identifier: GPL-3.0-or-later ;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Commentary: ;;; Commentary:
;; The minimal-emacs.d project is a customizable base that provides better Emacs ;; The minimal-emacs.d project is a lightweight and optimized Emacs base
;; defaults and optimized startup, intended to serve as a solid foundation for ;; (init.el and early-init.el) that gives you full control over your
;; your vanilla Emacs configuration. ;; configuration. It provides better defaults, an optimized startup, and a clean
;; foundation for building your own vanilla Emacs setup.
;;
;; Building the minimal-emacs.d init.el and early-init.el was the result of
;; extensive research and testing to fine-tune the best parameters and
;; optimizations for an Emacs configuration.
;;
;; Do not modify this file; instead, modify pre-init.el or post-init.el.
;;; Code: ;;; Code:
@@ -31,6 +38,11 @@
(setq use-short-answers t) (setq use-short-answers t)
(advice-add 'yes-or-no-p :override #'y-or-n-p)) (advice-add 'yes-or-no-p :override #'y-or-n-p))
;;; Features, warnings, and errors
;; Disable warnings from the legacy advice API. They aren't useful.
(setq ad-redefinition-action 'accept)
;;; Undo/redo ;;; Undo/redo
(setq undo-limit (* 13 160000) (setq undo-limit (* 13 160000)
@@ -51,11 +63,6 @@
;; Ensure use-package is available ;; Ensure use-package is available
(require 'use-package)) (require 'use-package))
;;; Features, warnings, and errors
;; Disable warnings from the legacy advice API. They aren't useful.
(setq ad-redefinition-action 'accept)
;;; Minibuffer ;;; Minibuffer
;; Allow nested minibuffers ;; Allow nested minibuffers
@@ -69,7 +76,8 @@
;;; User interface ;;; User interface
;; By default, Emacs "updates" its ui more often than it needs to ;; By default, Emacs "updates" its ui more often than it needs to
(setq idle-update-delay 1.0) (setq which-func-update-delay 1.0)
(setq idle-update-delay which-func-update-delay) ;; Obsolete in >= 30.1
(defalias #'view-hello-file #'ignore) ; Never show the hello file (defalias #'view-hello-file #'ignore) ; Never show the hello file
@@ -77,6 +85,11 @@
(setq visible-bell nil) (setq visible-bell nil)
(setq ring-bell-function #'ignore) (setq ring-bell-function #'ignore)
;; 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))
;;; Show-paren ;;; Show-paren
(setq show-paren-delay 0.1 (setq show-paren-delay 0.1
@@ -90,13 +103,11 @@
compilation-ask-about-save nil compilation-ask-about-save nil
compilation-scroll-output 'first-error) compilation-scroll-output 'first-error)
;; Recenter to the middle of the window for `compile-goto-error', which is also
;; used by `wgrep' and `embark-export'.
(setq next-error-recenter '(4))
;;; Misc ;;; Misc
(setq whitespace-line-column nil) ; whitespace-mode (setq custom-buffer-done-kill t)
(setq whitespace-line-column nil) ; Use the value of `fill-column'.
;; Can be activated with `display-line-numbers-mode' ;; Can be activated with `display-line-numbers-mode'
(setq-default display-line-numbers-width 3) (setq-default display-line-numbers-width 3)
@@ -104,9 +115,6 @@
(setq truncate-string-ellipsis "") (setq truncate-string-ellipsis "")
;; Improve Emacs' responsiveness by delaying syntax highlighting during input
(setq redisplay-skip-fontification-on-input t)
;; Disable truncation of printed s-expressions in the message buffer ;; Disable truncation of printed s-expressions in the message buffer
(setq eval-expression-print-length nil (setq eval-expression-print-length nil
eval-expression-print-level nil) eval-expression-print-level nil)
@@ -114,6 +122,20 @@
;; Position underlines at the descent line instead of the baseline. ;; Position underlines at the descent line instead of the baseline.
(setq x-underline-at-descent-line t) (setq x-underline-at-descent-line t)
(setq tramp-verbose 1)
(setq tramp-completion-reread-directory-timeout 50)
(setq remote-file-name-inhibit-cache 50)
;; Automatically rescan the buffer for Imenu entries when `imenu' is invoked
;; This ensures the index reflects recent edits.
(setq imenu-auto-rescan t)
;; Prevent truncation of long function names in `imenu' listings
(setq imenu-max-item-length 160)
;; Disable auto-adding a new line at the bottom when scrolling.
(setq next-line-add-newlines nil)
;;; Files ;;; Files
;; Delete by moving to trash in interactive mode ;; Delete by moving to trash in interactive mode
@@ -161,6 +183,7 @@
(setq vc-git-print-log-follow t) (setq vc-git-print-log-follow t)
(setq vc-make-backup-files nil) ; Do not backup version controlled files (setq vc-make-backup-files nil) ; Do not backup version controlled files
(setq vc-git-diff-switches '("--histogram")) ; Faster algorithm for diffing.
;;; Auto save ;;; Auto save
@@ -226,10 +249,6 @@
;;; Frames and windows ;;; Frames and windows
;; 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)
;; However, do not resize windows pixelwise, as this can cause crashes in some ;; However, do not resize windows pixelwise, as this can cause crashes in some
;; cases when resizing too many windows at once or rapidly. ;; cases when resizing too many windows at once or rapidly.
(setq window-resize-pixelwise nil) (setq window-resize-pixelwise nil)
@@ -242,6 +261,12 @@
window-divider-default-places t window-divider-default-places t
window-divider-default-right-width 1) window-divider-default-right-width 1)
;;; Fontification
;; Disable fontification during user input to reduce lag in large buffers.
;; Also helps marginally with scrolling performance.
(setq redisplay-skip-fontification-on-input t)
;;; Scrolling ;;; Scrolling
;; Enables faster scrolling. This may result in brief periods of inaccurate ;; Enables faster scrolling. This may result in brief periods of inaccurate
@@ -290,8 +315,7 @@
;; Don't blink the paren matching the one at point, it's too distracting. ;; Don't blink the paren matching the one at point, it's too distracting.
(setq blink-matching-paren nil) (setq blink-matching-paren nil)
;; Don't stretch the cursor to fit wide characters, it is disorienting, ;; Do not extend the cursor to fit wide characters
;; especially for tabs.
(setq x-stretch-cursor nil) (setq x-stretch-cursor nil)
;; Reduce rendering/line scan work by not rendering cursors or regions in ;; Reduce rendering/line scan work by not rendering cursors or regions in
@@ -326,13 +350,18 @@
;; when the window is narrower than `truncate-partial-width-windows' characters. ;; when the window is narrower than `truncate-partial-width-windows' characters.
(setq truncate-partial-width-windows nil) (setq truncate-partial-width-windows nil)
;; Configure automatic indentation to be triggered exclusively by newline and
;; DEL (backspace) characters.
(setq-default electric-indent-chars '(?\n ?\^?))
;; Prefer spaces over tabs. Spaces offer a more consistent default compared to ;; Prefer spaces over tabs. Spaces offer a more consistent default compared to
;; 8-space tabs. This setting can be adjusted on a per-mode basis as needed. ;; 8-space tabs. This setting can be adjusted on a per-mode basis as needed.
(setq-default indent-tabs-mode nil (setq-default indent-tabs-mode nil
tab-width 4) tab-width 4)
;; Enable indentation and completion using the TAB key ;; Enable indentation and completion using the TAB key
(setq-default tab-always-indent nil) (setq tab-always-indent 'complete)
(setq tab-first-completion 'word-or-paren-or-punct)
;; Perf: Reduce command completion overhead. ;; Perf: Reduce command completion overhead.
(setq read-extended-command-predicate #'command-completion-default-include-p) (setq read-extended-command-predicate #'command-completion-default-include-p)
@@ -371,16 +400,22 @@
(setq sh-indent-after-continuation 'always) (setq sh-indent-after-continuation 'always)
;;; Dired ;;; Dired and ls-lisp
(setq dired-free-space nil (setq dired-free-space nil
dired-dwim-target t ; Propose a target for intelligent moving or copying. dired-dwim-target t ; Propose a target for intelligent moving/copying
dired-deletion-confirmer 'y-or-n-p dired-deletion-confirmer 'y-or-n-p
dired-filter-verbose nil dired-filter-verbose nil
dired-recursive-deletes 'top dired-recursive-deletes 'top
dired-recursive-copies 'always dired-recursive-copies 'always
dired-create-destination-dirs 'ask dired-create-destination-dirs 'ask)
image-dired-thumb-size 150)
;; This is a higher-level predicate that wraps `dired-directory-changed-p'
;; with additional logic. This `dired-buffer-stale-p' predicate handles remote
;; files, wdired, unreadable dirs, and delegates to dired-directory-changed-p
;; for modification checks.
(setq auto-revert-remote-files nil)
(setq dired-auto-revert-buffer 'dired-buffer-stale-p)
(setq dired-vc-rename-file t) (setq dired-vc-rename-file t)
@@ -391,7 +426,18 @@
(setq dired-omit-verbose nil) (setq dired-omit-verbose nil)
(setq dired-omit-files (concat "\\`[.]\\'")) (setq dired-omit-files (concat "\\`[.]\\'"))
;; ls-lisp ;; Group directories first
(when minimal-emacs-dired-group-directories-first
(with-eval-after-load 'dired
(let ((args "--group-directories-first -ahlv"))
(when (or (eq system-type 'darwin)
(eq system-type 'berkeley-unix))
(if-let* ((gls (executable-find "gls")))
(setq insert-directory-program gls)
(setq args nil)))
(when args
(setq dired-listing-switches args)))))
(setq ls-lisp-verbosity nil) (setq ls-lisp-verbosity nil)
(setq ls-lisp-dirs-first t) (setq ls-lisp-dirs-first t)
@@ -416,29 +462,31 @@
;;; Eglot ;;; Eglot
(setq eglot-sync-connect 1 ;; A setting of nil or 0 means Eglot will not block the UI at all, allowing
eglot-autoshutdown t) ;; Emacs to remain fully responsive, although LSP features will only become
;; available once the connection is established in the background.
(setq eglot-sync-connect 0)
(setq eglot-autoshutdown t) ; Shut down server after killing last managed buffer
;; Activate Eglot in cross-referenced non-project files ;; Activate Eglot in cross-referenced non-project files
(setq eglot-extend-to-xref t) (setq eglot-extend-to-xref t)
;; Eglot optimization ;; Eglot optimization
(if minimal-emacs-debug
(setq eglot-events-buffer-config '(:size 2000000 :format full))
;; This reduces log clutter to improves performance.
(setq jsonrpc-event-hook nil) (setq jsonrpc-event-hook nil)
(setq eglot-events-buffer-size 0) ;; Reduce memory usage and avoid cluttering *EGLOT events* buffer
(setq eglot-report-progress nil) ; Prevent Eglot minibuffer spam (setq eglot-events-buffer-size 0) ; Deprecated
(setq eglot-events-buffer-config '(:size 0 :format short)))
;; Eglot optimization: Disable `eglot-events-buffer' to maintain consistent (setq eglot-report-progress minimal-emacs-debug) ; Prevent minibuffer spam
;; performance in long-running Emacs sessions.
(setq eglot-events-buffer-config '(:size 0 :format full))
;;; Flymake ;;; Flymake
(setq flymake-fringe-indicator-position 'left-fringe)
(setq flymake-show-diagnostics-at-end-of-line nil) (setq flymake-show-diagnostics-at-end-of-line nil)
;; Suppress the display of Flymake error counters when there are no errors.
(setq flymake-suppress-zero-counters t)
;; Disable wrapping around when navigating Flymake errors. ;; Disable wrapping around when navigating Flymake errors.
(setq flymake-wrap-around nil) (setq flymake-wrap-around nil)
@@ -459,8 +507,8 @@
(setq flyspell-issue-welcome-flag nil) (setq flyspell-issue-welcome-flag nil)
;; Greatly improves flyspell performance by preventing messages from being ;; Improves flyspell performance by preventing messages from being displayed for
;; displayed for each word when checking the entire buffer. ;; each word when checking the entire buffer.
(setq flyspell-issue-message-flag nil) (setq flyspell-issue-message-flag nil)
;;; ispell ;;; ispell
@@ -475,7 +523,7 @@
(setq ibuffer-formats (setq ibuffer-formats
'((mark modified read-only locked '((mark modified read-only locked
" " (name 40 40 :left :elide) " " (name 55 55 :left :elide)
" " (size 8 -1 :right) " " (size 8 -1 :right)
" " (mode 18 18 :left :elide) " " filename-and-process) " " (mode 18 18 :left :elide) " " filename-and-process)
(mark " " (name 16 -1) " " filename))) (mark " " (name 16 -1) " " filename)))
@@ -498,13 +546,22 @@
;;; dabbrev ;;; dabbrev
(setq dabbrev-upcase-means-case-search t) (setq dabbrev-upcase-means-case-search t)
(setq dabbrev-ignored-buffer-modes (setq dabbrev-ignored-buffer-modes
'(archive-mode image-mode docview-mode tags-table-mode pdf-view-mode)) '(archive-mode image-mode docview-mode tags-table-mode pdf-view-mode))
(setq dabbrev-ignored-buffer-regexps
'(;; - Buffers starting with a space (internal or temporary buffers)
"\\` "
;; Tags files such as ETAGS, GTAGS, RTAGS, TAGS, e?tags, and GPATH,
;; including versions with numeric extensions like <123>
"\\(?:\\(?:[EG]?\\|GR\\)TAGS\\|e?tags\\|GPATH\\)\\(<[0-9]+>\\)?"))
;;; Remove warnings from narrow-to-region, upcase-region... ;;; Remove warnings from narrow-to-region, upcase-region...
(dolist (cmd '(list-timers narrow-to-region upcase-region downcase-region (dolist (cmd '(list-timers narrow-to-region upcase-region downcase-region
erase-buffer scroll-left dired-find-alternate-file)) list-threads erase-buffer scroll-left
dired-find-alternate-file))
(put cmd 'disabled nil)) (put cmd 'disabled nil))
;;; Load post init ;;; Load post init