Merge branch 'main' of https://github.com/jamescherti/minimal-emacs.d
This commit is contained in:
133
early-init.el
133
early-init.el
@@ -4,7 +4,7 @@
|
||||
;; URL: https://github.com/jamescherti/minimal-emacs.d
|
||||
;; Package-Requires: ((emacs "29.1"))
|
||||
;; Keywords: maint
|
||||
;; Version: 1.1.1
|
||||
;; Version: 1.1.2
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
;;; Commentary:
|
||||
@@ -38,23 +38,49 @@ turned on.")
|
||||
(defvar minimal-emacs-gc-cons-threshold (* 16 1024 1024)
|
||||
"The value of `gc-cons-threshold' after Emacs startup.")
|
||||
|
||||
(defvar minimal-emacs-optimize-startup-gc t
|
||||
"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--restore-gc-cons-threshold'.")
|
||||
|
||||
(defvar minimal-emacs-package-initialize-and-refresh t
|
||||
"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.
|
||||
This prevents visual updates while Emacs initializes, leading to a cleaner and
|
||||
faster startup. 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.
|
||||
By disabling startup messages, this slightly enhances performance and provides a
|
||||
cleaner startup. The tradeoff is that you won't be informed of the progress or
|
||||
any relevant activities during startup.")
|
||||
|
||||
(defvar minimal-emacs-disable-mode-line-during-startup nil
|
||||
"Disable the mode line during startup to improve performance.
|
||||
This reduces visual clutter and slightly enhances startup performance. The
|
||||
tradeoff is that the mode line is hidden during the startup phase, giving a more
|
||||
minimalistic appearance during startup.")
|
||||
|
||||
(defvar minimal-emacs-user-directory user-emacs-directory
|
||||
"The default value of the `user-emacs-directory' variable.")
|
||||
|
||||
;;; Load pre-early-init.el
|
||||
|
||||
;; Prefer loading newer compiled files
|
||||
(setq load-prefer-newer t)
|
||||
|
||||
(defun minimal-emacs-load-user-init (filename)
|
||||
"Execute a file of Lisp code named FILENAME."
|
||||
(let ((user-init-file
|
||||
(expand-file-name filename
|
||||
minimal-emacs-user-directory)))
|
||||
(when (file-exists-p user-init-file)
|
||||
(load user-init-file nil t))))
|
||||
(load user-init-file nil t t))))
|
||||
|
||||
(minimal-emacs-load-user-init "pre-early-init.el")
|
||||
|
||||
@@ -66,11 +92,13 @@ When set to non-nil, Emacs will automatically call `package-initialize' and
|
||||
;; Garbage collection significantly affects startup times. This setting delays
|
||||
;; garbage collection during startup but will be reset later.
|
||||
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
(when minimal-emacs-optimize-startup-gc
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq gc-cons-threshold minimal-emacs-gc-cons-threshold)))
|
||||
(defun minimal-emacs--restore-gc-cons-threshold ()
|
||||
"Restore `minimal-emacs-gc-cons-threshold'."
|
||||
(setq gc-cons-threshold minimal-emacs-gc-cons-threshold))
|
||||
(add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc-cons-threshold 105))
|
||||
|
||||
;;; Misc
|
||||
|
||||
@@ -81,76 +109,87 @@ When set to non-nil, Emacs will automatically call `package-initialize' and
|
||||
|
||||
;;; Performance
|
||||
|
||||
;; Prefer loading newer compiled files
|
||||
(setq load-prefer-newer 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)
|
||||
|
||||
(unless (daemonp)
|
||||
(let ((old-value (default-toplevel-value 'file-name-handler-alist)))
|
||||
(set-default-toplevel-value
|
||||
'file-name-handler-alist
|
||||
;; 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 (eval-when-compile
|
||||
(locate-file-internal "calc-loaddefs.el" load-path))
|
||||
(locate-file-internal "calc-loaddefs.el"
|
||||
load-path))
|
||||
nil
|
||||
(list (rassq 'jka-compr-handler old-value))))
|
||||
;; Ensure the new value persists through any current let-binding.
|
||||
(set-default-toplevel-value 'file-name-handler-alist
|
||||
file-name-handler-alist)
|
||||
;; Remember the old value to reset it as needed.
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(put 'file-name-handler-alist 'initial-value old-value)
|
||||
;; 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.
|
||||
(define-advice command-line-1 (:around (fn args-left) respect-file-handlers)
|
||||
(let ((file-name-handler-alist
|
||||
(if args-left old-value file-name-handler-alist)))
|
||||
(funcall fn args-left)))
|
||||
|
||||
;; Restore the old value to reset it as needed.
|
||||
(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.
|
||||
;; Merge instead of overwrite to preserve any changes made since startup.
|
||||
(delete-dups (append file-name-handler-alist old-value))))
|
||||
101))
|
||||
|
||||
(add-hook
|
||||
'emacs-startup-hook #'minimal-emacs--restore-file-name-handler-alist 101))
|
||||
|
||||
(unless noninteractive
|
||||
(unless minimal-emacs-debug
|
||||
(unless minimal-emacs-debug
|
||||
(when minimal-emacs-inhibit-redisplay-during-startup
|
||||
;; Suppress redisplay and redraw during startup to avoid delays and
|
||||
;; prevent flashing an unstyled Emacs frame.
|
||||
;; (setq-default inhibit-redisplay t) ; Can cause artifacts
|
||||
(setq-default inhibit-message t)
|
||||
(defun minimal-emacs--reset-inhibit-redisplay ()
|
||||
(setq-default inhibit-redisplay nil)
|
||||
(remove-hook 'post-command-hook #'minimal-emacs--reset-inhibit-redisplay))
|
||||
|
||||
;; Reset the above variables to prevent Emacs from appearing frozen or
|
||||
;; visually corrupted after startup or if a startup error occurs.
|
||||
(defun minimal-emacs--reset-inhibited-vars-h ()
|
||||
;; (setq-default inhibit-redisplay nil) ; Can cause artifacts
|
||||
(setq-default inhibit-redisplay t)
|
||||
(add-hook 'post-command-hook #'minimal-emacs--reset-inhibit-redisplay -100))
|
||||
|
||||
(when minimal-emacs-inhibit-message-during-startup
|
||||
(defun minimal-emacs--reset-inhibit-message ()
|
||||
(setq-default inhibit-message nil)
|
||||
(remove-hook 'post-command-hook #'minimal-emacs--reset-inhibited-vars-h))
|
||||
(remove-hook 'post-command-hook #'minimal-emacs--reset-inhibit-message))
|
||||
|
||||
(add-hook 'post-command-hook
|
||||
#'minimal-emacs--reset-inhibited-vars-h -100))
|
||||
(setq-default inhibit-message t)
|
||||
(add-hook 'post-command-hook #'minimal-emacs--reset-inhibit-message -100))
|
||||
|
||||
(put 'mode-line-format
|
||||
'initial-value (default-toplevel-value 'mode-line-format))
|
||||
(when minimal-emacs-disable-mode-line-during-startup
|
||||
(setq-default mode-line-format nil)
|
||||
(dolist (buf (buffer-list))
|
||||
(with-current-buffer buf
|
||||
(setq mode-line-format nil)))
|
||||
|
||||
(put 'mode-line-format 'initial-value
|
||||
(default-toplevel-value 'mode-line-format))
|
||||
(setq-default mode-line-format nil)
|
||||
(setq mode-line-format nil))))
|
||||
|
||||
(defun minimal-emacs--startup-load-user-init-file (fn &rest args)
|
||||
"Advice for startup--load-user-init-file to reset mode-line-format."
|
||||
(unwind-protect
|
||||
(progn
|
||||
;; Start up as normal
|
||||
(apply fn args))
|
||||
(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.
|
||||
(setq-default inhibit-message nil)
|
||||
(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)))))
|
||||
(setq-default mode-line-format (get 'mode-line-format
|
||||
'initial-value))))))
|
||||
|
||||
(advice-add 'startup--load-user-init-file :around
|
||||
#'minimal-emacs--startup-load-user-init-file))
|
||||
@@ -256,8 +295,6 @@ When set to non-nil, Emacs will automatically call `package-initialize' and
|
||||
(push '(vertical-scroll-bars) default-frame-alist)
|
||||
(push '(horizontal-scroll-bars) default-frame-alist)
|
||||
(setq scroll-bar-mode nil)
|
||||
(when (fboundp 'horizontal-scroll-bar-mode)
|
||||
(horizontal-scroll-bar-mode -1))
|
||||
|
||||
(unless (memq 'tooltips minimal-emacs-ui-features)
|
||||
(when (bound-and-true-p tooltip-mode)
|
||||
@@ -270,9 +307,17 @@ When set to non-nil, Emacs will automatically call `package-initialize' and
|
||||
(setq use-dialog-box nil))
|
||||
|
||||
;;; package.el
|
||||
(setq package-enable-at-startup nil)
|
||||
(setq package-quickstart nil)
|
||||
(setq use-package-compute-statistics minimal-emacs-debug)
|
||||
|
||||
;; Setting use-package-expand-minimally to (t) results in a more compact output
|
||||
;; that emphasizes performance over clarity.
|
||||
(setq use-package-expand-minimally (not noninteractive))
|
||||
|
||||
(setq use-package-minimum-reported-time (if minimal-emacs-debug 0 0.1))
|
||||
(setq use-package-verbose minimal-emacs-debug)
|
||||
(setq package-enable-at-startup nil) ; Let the init.el file handle this
|
||||
(setq use-package-always-ensure t)
|
||||
(setq use-package-enable-imenu-support t)
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("melpa-stable" . "https://stable.melpa.org/packages/")
|
||||
("gnu" . "https://elpa.gnu.org/packages/")
|
||||
|
||||
275
init.el
275
init.el
@@ -4,7 +4,7 @@
|
||||
;; URL: https://github.com/jamescherti/minimal-emacs.d
|
||||
;; Package-Requires: ((emacs "29.1"))
|
||||
;; Keywords: maint
|
||||
;; Version: 1.1.1
|
||||
;; Version: 1.1.2
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
;;; Commentary:
|
||||
@@ -17,12 +17,16 @@
|
||||
;;; Load pre-init.el
|
||||
(minimal-emacs-load-user-init "pre-init.el")
|
||||
|
||||
;;; Networking
|
||||
;;; Before package
|
||||
|
||||
;; Increase how much is read from processes in a single chunk
|
||||
(setq read-process-output-max (* 1024 1024)) ; 1024kb
|
||||
|
||||
;; Don't ping things that look like domain names.
|
||||
(setq ffap-machine-p-known 'reject)
|
||||
|
||||
;;; package.el
|
||||
|
||||
(when (bound-and-true-p minimal-emacs-package-initialize-and-refresh)
|
||||
;; Initialize and refresh package contents again if needed
|
||||
(package-initialize)
|
||||
@@ -46,23 +50,14 @@
|
||||
|
||||
(setq warning-suppress-types '((lexical-binding)))
|
||||
|
||||
;; Some features that are not represented as packages can be found in
|
||||
;; `features', but this can be inconsistent. The following enforce consistency:
|
||||
(if (fboundp #'json-parse-string)
|
||||
(push 'jansson features))
|
||||
(if (string-match-p "HARFBUZZ" system-configuration-features) ; no alternative
|
||||
(push 'harfbuzz features))
|
||||
(if (bound-and-true-p module-file-suffix)
|
||||
(push 'dynamic-modules features))
|
||||
|
||||
;;; Minibuffer
|
||||
|
||||
;; Allow nested minibuffers
|
||||
(setq enable-recursive-minibuffers t)
|
||||
|
||||
;; Keep the cursor out of the read-only portions of the.minibuffer
|
||||
(setq minibuffer-prompt-properties
|
||||
'(read-only t intangible t cursor-intangible t face
|
||||
minibuffer-prompt))
|
||||
'(read-only t intangible t cursor-intangible t face minibuffer-prompt))
|
||||
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
||||
|
||||
;;; User interface
|
||||
@@ -71,59 +66,63 @@
|
||||
(setq idle-update-delay 1.0)
|
||||
|
||||
;; Allow for shorter responses: "y" for yes and "n" for no.
|
||||
(setq read-answer-short t)
|
||||
(if (boundp 'use-short-answers)
|
||||
(setq use-short-answers t)
|
||||
(advice-add #'yes-or-no-p :override #'y-or-n-p))
|
||||
(defalias #'view-hello-file #'ignore) ; Never show the hello file
|
||||
|
||||
;;; Misc
|
||||
;; No beeping or blinking
|
||||
(setq visible-bell nil)
|
||||
(setq ring-bell-function #'ignore)
|
||||
|
||||
;; switch-to-buffer runs pop-to-buffer-same-window instead
|
||||
(setq switch-to-buffer-obey-display-actions t)
|
||||
;;; Show-paren
|
||||
|
||||
(setq show-paren-delay 0.1
|
||||
show-paren-highlight-openparen t
|
||||
show-paren-when-point-inside-paren t
|
||||
show-paren-when-point-in-periphery t)
|
||||
|
||||
;;; Compilation
|
||||
|
||||
(setq compilation-always-kill t
|
||||
compilation-ask-about-save nil
|
||||
compilation-scroll-output 'first-error)
|
||||
|
||||
;;; Misc
|
||||
|
||||
(setq whitespace-line-column nil) ; whitespace-mode
|
||||
|
||||
;; I reduced the default value of 9 to simplify the font-lock keyword,
|
||||
;; aiming to improve performance. This package helps differentiate
|
||||
;; nested delimiter pairs, particularly in languages with heavy use of
|
||||
;; parentheses.
|
||||
;; aiming to improve performance.
|
||||
(setq rainbow-delimiters-max-face-count 5)
|
||||
|
||||
;; Can be activated with `display-line-numbers-mode'
|
||||
(setq-default display-line-numbers-width 3)
|
||||
(setq-default display-line-numbers-widen t)
|
||||
|
||||
(setq comint-prompt-read-only t)
|
||||
(setq comint-buffer-maximum-size 2048)
|
||||
|
||||
(setq compilation-always-kill t
|
||||
compilation-ask-about-save nil
|
||||
compilation-scroll-output 'first-error)
|
||||
|
||||
(setq truncate-string-ellipsis "…")
|
||||
|
||||
;; Delete by moving to trash in interactive mode
|
||||
(setq delete-by-moving-to-trash (not noninteractive))
|
||||
|
||||
;; Increase how much is read from processes in a single chunk
|
||||
(setq read-process-output-max (* 512 1024)) ; 512kb
|
||||
;; Improve Emacs' responsiveness by delaying syntax highlighting during input
|
||||
;; but may reduce visual feedback.
|
||||
(setq redisplay-skip-fontification-on-input t)
|
||||
|
||||
;; Collects and displays all available documentation immediately, even if
|
||||
;; multiple sources provide it. It concatenates the results.
|
||||
(setq eldoc-documentation-strategy 'eldoc-documentation-compose-eagerly)
|
||||
|
||||
;; For some reason, `abbrev_defs` is located in ~/.emacs.d/abbrev_defs, even
|
||||
;; when `user-emacs-directory` is modified. This ensures the abbrev file is
|
||||
;; correctly located based on the updated `user-emacs-directory`.
|
||||
(setq abbrev-file-name (expand-file-name "abbrev_defs" user-emacs-directory))
|
||||
;; Disable truncation of printed s-expressions in the message buffer
|
||||
(setq eval-expression-print-length nil
|
||||
eval-expression-print-level nil)
|
||||
|
||||
;; Position underlines at the descent line instead of the baseline.
|
||||
(setq x-underline-at-descent-line t)
|
||||
|
||||
;;; Files
|
||||
|
||||
;; Delete by moving to trash in interactive mode
|
||||
(setq delete-by-moving-to-trash (not noninteractive))
|
||||
|
||||
;; Disable the warning "X and Y are the same file". Ignoring this warning is
|
||||
;; acceptable since it will redirect you to the existing buffer regardless.
|
||||
(setq find-file-suppress-same-file-warnings t)
|
||||
@@ -133,22 +132,19 @@
|
||||
(setq find-file-visit-truename t
|
||||
vc-follow-symlinks t)
|
||||
|
||||
;; Skip confirmation prompts when creating a new file or buffer
|
||||
(setq confirm-nonexistent-file-or-buffer nil)
|
||||
|
||||
(setq uniquify-buffer-name-style 'forward)
|
||||
|
||||
(setq mouse-yank-at-point t)
|
||||
|
||||
;; Prefer vertical splits over horizontal ones
|
||||
(setq split-width-threshold 170
|
||||
split-height-threshold nil)
|
||||
|
||||
;; The native border "uses" a pixel of the fringe on the rightmost
|
||||
;; splits, whereas `window-divider` does not.
|
||||
(setq window-divider-default-bottom-width 1
|
||||
window-divider-default-places t
|
||||
window-divider-default-right-width 1)
|
||||
;;; Buffers
|
||||
|
||||
(setq uniquify-buffer-name-style 'forward)
|
||||
|
||||
(setq comint-prompt-read-only t)
|
||||
(setq comint-buffer-maximum-size 2048)
|
||||
|
||||
;; Skip confirmation prompts when creating a new file or buffer
|
||||
(setq confirm-nonexistent-file-or-buffer nil)
|
||||
|
||||
;;; Backup files
|
||||
|
||||
@@ -166,9 +162,14 @@
|
||||
(setq version-control t) ; Use version numbers for backup files
|
||||
(setq kept-new-versions 5)
|
||||
(setq kept-old-versions 5)
|
||||
|
||||
;;; VC
|
||||
|
||||
(setq vc-git-print-log-follow t)
|
||||
(setq vc-make-backup-files nil) ; Do not backup version controlled files
|
||||
|
||||
;;; Auto save
|
||||
|
||||
;; Enable auto-save to safeguard against crashes or data loss. The
|
||||
;; `recover-file' or `recover-session' functions can be used to restore
|
||||
;; auto-saved data.
|
||||
@@ -199,24 +200,31 @@
|
||||
(setq global-auto-revert-non-file-buffers t)
|
||||
|
||||
;;; recentf
|
||||
|
||||
;; `recentf' is an Emacs package that maintains a list of recently
|
||||
;; accessed files, making it easier to reopen files you have worked on
|
||||
;; recently.
|
||||
(setq recentf-max-saved-items 300) ; default is 20
|
||||
(setq recentf-auto-cleanup 'mode)
|
||||
(setq recentf-max-menu-items 15)
|
||||
(setq recentf-auto-cleanup (if (daemonp) 300 'never))
|
||||
|
||||
;; Update recentf-exclude
|
||||
(setq recentf-exclude (list "^/\\(?:ssh\\|su\\|sudo\\)?:"))
|
||||
|
||||
;;; saveplace
|
||||
;; `save-place-mode` enables Emacs to remember the last location within a file
|
||||
|
||||
;; `save-place-mode' enables Emacs to remember the last location within a file
|
||||
;; upon reopening. This feature is particularly beneficial for resuming work at
|
||||
;; the precise point where you previously left off.
|
||||
(setq save-place-file (expand-file-name "saveplace" user-emacs-directory))
|
||||
(setq save-place-limit 600)
|
||||
|
||||
;;; savehist
|
||||
;; `savehist` is an Emacs feature that preserves the minibuffer history between
|
||||
;; sessions. It saves the history of inputs in the minibuffer, such as commands,
|
||||
;; search strings, and other prompts, to a file. This allows users to retain
|
||||
;; their minibuffer history across Emacs restarts.
|
||||
|
||||
;; `savehist-mode' is an Emacs feature that preserves the minibuffer history
|
||||
;; between sessions. It saves the history of inputs in the minibuffer, such as
|
||||
;; commands, search strings, and other prompts, to a file. This allows users to
|
||||
;; retain their minibuffer history across Emacs restarts.
|
||||
(setq history-length 300)
|
||||
(setq savehist-save-minibuffer-history t) ;; Default
|
||||
|
||||
@@ -232,7 +240,14 @@
|
||||
|
||||
(setq resize-mini-windows 'grow-only)
|
||||
|
||||
;; The native border "uses" a pixel of the fringe on the rightmost
|
||||
;; splits, whereas `window-divider-mode' does not.
|
||||
(setq window-divider-default-bottom-width 1
|
||||
window-divider-default-places t
|
||||
window-divider-default-right-width 1)
|
||||
|
||||
;;; Scrolling
|
||||
|
||||
;; Enables faster scrolling through unfontified regions. This may result in
|
||||
;; brief periods of inaccurate syntax highlighting immediately after scrolling,
|
||||
;; which should quickly self-correct.
|
||||
@@ -270,7 +285,9 @@
|
||||
(setq hscroll-margin 2
|
||||
hscroll-step 1)
|
||||
|
||||
;;; Mouse Scroll
|
||||
;;; Mouse
|
||||
|
||||
(setq mouse-yank-at-point nil)
|
||||
|
||||
;; Emacs 29
|
||||
(when (memq 'context-menu minimal-emacs-ui-features)
|
||||
@@ -278,6 +295,7 @@
|
||||
(add-hook 'after-init-hook #'context-menu-mode)))
|
||||
|
||||
;;; Cursor
|
||||
|
||||
;; The blinking cursor is distracting and interferes with cursor settings in
|
||||
;; some minor modes that try to change it buffer-locally (e.g., Treemacs).
|
||||
;; Additionally, it can cause freezing, especially on macOS, for users with
|
||||
@@ -296,18 +314,16 @@
|
||||
(setq-default cursor-in-non-selected-windows nil)
|
||||
(setq highlight-nonselected-windows nil)
|
||||
|
||||
;;; Annoyances
|
||||
;;; Text editing, indent, font, and formatting
|
||||
|
||||
;; No beeping or blinking
|
||||
(setq visible-bell nil)
|
||||
(setq ring-bell-function #'ignore)
|
||||
;; Avoid automatic frame resizing when adjusting settings.
|
||||
(setq global-text-scale-adjust-resizes-frames nil)
|
||||
|
||||
;; This controls how long Emacs will blink to show the deleted pairs with
|
||||
;; `delete-pair'. A longer delay can be annoying as it causes a noticeable pause
|
||||
;; after each deletion, disrupting the flow of editing.
|
||||
(setq delete-pair-blink-delay 0.03)
|
||||
|
||||
;;; Indent and formatting
|
||||
(setq-default left-fringe-width 8)
|
||||
(setq-default right-fringe-width 8)
|
||||
|
||||
@@ -334,6 +350,9 @@
|
||||
;; Enable indentation and completion using the TAB key
|
||||
(setq-default tab-always-indent nil)
|
||||
|
||||
;; Perf: Reduce command completion overhead.
|
||||
(setq read-extended-command-predicate #'command-completion-default-include-p)
|
||||
|
||||
;; Enable multi-line commenting which ensures that `comment-indent-new-line'
|
||||
;; properly continues comments onto new lines, which is useful for writing
|
||||
;; longer comments or docstrings that span multiple lines.
|
||||
@@ -363,7 +382,7 @@
|
||||
;; Eliminate delay before highlighting search matches
|
||||
(setq lazy-highlight-initial-delay 0)
|
||||
|
||||
;;; Mode line
|
||||
;;; Modeline
|
||||
|
||||
;; Setting `display-time-default-load-average' to nil makes Emacs omit the load
|
||||
;; average information from the mode line.
|
||||
@@ -383,17 +402,37 @@
|
||||
;;; Dired
|
||||
|
||||
(setq dired-free-space nil
|
||||
dired-dwim-target t ; Propose a target for intelligent moving or copying.
|
||||
dired-deletion-confirmer 'y-or-n-p
|
||||
dired-filter-verbose nil
|
||||
dired-clean-confirm-killing-deleted-buffers nil
|
||||
dired-recursive-deletes 'top
|
||||
dired-recursive-copies 'always
|
||||
dired-create-destination-dirs 'ask)
|
||||
dired-create-destination-dirs 'ask
|
||||
;; Revert the Dired buffer without prompting.
|
||||
dired-auto-revert-buffer #'dired-buffer-stale-p
|
||||
image-dired-thumb-size 150)
|
||||
|
||||
;;; Font / Text scale
|
||||
(setq dired-vc-rename-file t)
|
||||
|
||||
;; Avoid automatic frame resizing when adjusting settings.
|
||||
(setq global-text-scale-adjust-resizes-frames nil)
|
||||
;; Disable the prompt about killing the Dired buffer for a deleted directory.
|
||||
(setq dired-clean-confirm-killing-deleted-buffers nil)
|
||||
|
||||
;; dired-omit-mode
|
||||
(setq dired-omit-verbose nil)
|
||||
(setq dired-omit-files (concat "\\`[.]\\'"
|
||||
"\\|\\(?:\\.js\\)?\\.meta\\'"
|
||||
"\\|\\.\\(?:elc|a\\|o\\|pyc\\|pyo\\|swp\\|class\\)\\'"
|
||||
"\\|^\\.DS_Store\\'"
|
||||
"\\|^\\.\\(?:svn\\|git\\)\\'"
|
||||
"\\|^\\.ccls-cache\\'"
|
||||
"\\|^__pycache__\\'"
|
||||
"\\|^\\.project\\(?:ile\\)?\\'"
|
||||
"\\|^flycheck_.*"
|
||||
"\\|^flymake_.*"))
|
||||
|
||||
;; ls-lisp
|
||||
(setq ls-lisp-verbosity nil)
|
||||
(setq ls-lisp-dirs-first t)
|
||||
|
||||
;;; Ediff
|
||||
|
||||
@@ -401,9 +440,111 @@
|
||||
(setq ediff-window-setup-function #'ediff-setup-windows-plain
|
||||
ediff-split-window-function #'split-window-horizontally)
|
||||
|
||||
;;; Load post-init.el
|
||||
;;; Help
|
||||
|
||||
;; Enhance `apropos' and related functions to perform more extensive searches
|
||||
(setq apropos-do-all t)
|
||||
|
||||
;; Fixes #11: Prevents help command completion from triggering autoload.
|
||||
;; (e.g., apropos-command, apropos-variable, apropos...)
|
||||
;; Loading additional files for completion can slow down help commands
|
||||
;; and may unintentionally execute initialization code from some libraries.
|
||||
(setq help-enable-completion-autoload nil)
|
||||
(setq help-enable-autoload nil)
|
||||
(setq help-enable-symbol-autoload nil)
|
||||
(setq help-window-select t)
|
||||
|
||||
;;; Eglot
|
||||
|
||||
(setq eglot-sync-connect 1
|
||||
eglot-autoshutdown t)
|
||||
|
||||
;; Activate Eglot in cross-referenced non-project files
|
||||
(setq eglot-extend-to-xref t)
|
||||
|
||||
;; Eglot optimization
|
||||
(setq jsonrpc-event-hook nil)
|
||||
(setq eglot-events-buffer-size 0)
|
||||
(setq eglot-report-progress nil) ; Prevent Eglot minibuffer spam
|
||||
|
||||
;; Eglot optimization: Disable `eglot-events-buffer' to maintain consistent
|
||||
;; performance in long-running Emacs sessions. By default, it retains 2,000,000
|
||||
;; lines, and each new event triggers pretty-printing of the entire buffer,
|
||||
;; leading to a gradual performance decline.
|
||||
(setq eglot-events-buffer-config '(:size 0 :format full))
|
||||
|
||||
;;; Flymake
|
||||
|
||||
(setq flymake-fringe-indicator-position 'left-fringe)
|
||||
(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.
|
||||
(setq flymake-wrap-around nil)
|
||||
|
||||
;;; hl-line-mode
|
||||
|
||||
;; Restrict `hl-line-mode' highlighting to the current window, reducing visual
|
||||
;; clutter and slightly improving `hl-line-mode' performance.
|
||||
(setq hl-line-sticky-flag nil)
|
||||
(setq global-hl-line-sticky-flag nil)
|
||||
|
||||
;;; icomplete
|
||||
|
||||
;; Do not delay displaying completion candidates in `fido-mode' or
|
||||
;; `fido-vertical-mode'
|
||||
(setq icomplete-compute-delay 0.01)
|
||||
|
||||
;;; flyspell
|
||||
|
||||
(setq flyspell-issue-welcome-flag nil)
|
||||
|
||||
;; Greatly improves flyspell performance by preventing messages from being
|
||||
;; displayed for each word when checking the entire buffer.
|
||||
(setq flyspell-issue-message-flag nil)
|
||||
|
||||
;;; ispell
|
||||
|
||||
;; In Emacs 30 and newer, disable Ispell completion to avoid annotation errors
|
||||
;; when no `ispell' dictionary is set.
|
||||
(setq text-mode-ispell-word-completion nil)
|
||||
|
||||
(setq ispell-silently-savep t)
|
||||
|
||||
;;; ibuffer
|
||||
|
||||
(setq ibuffer-formats
|
||||
'((mark modified read-only locked
|
||||
" " (name 40 40 :left :elide)
|
||||
" " (size 8 -1 :right)
|
||||
" " (mode 18 18 :left :elide) " " filename-and-process)
|
||||
(mark " " (name 16 -1) " " filename)))
|
||||
|
||||
;;; xref
|
||||
|
||||
;; Enable completion in the minibuffer instead of the definitions buffer
|
||||
(setq xref-show-definitions-function #'xref-show-definitions-completing-read
|
||||
xref-show-xrefs-function #'xref-show-definitions-completing-read)
|
||||
|
||||
;;; abbrev
|
||||
|
||||
;; Ensure `abbrev_defs` is stored in the correct location when
|
||||
;; `user-emacs-directory` is modified, as it defaults to ~/.emacs.d/abbrev_defs
|
||||
;; regardless of the change.
|
||||
(setq abbrev-file-name (expand-file-name "abbrev_defs" user-emacs-directory))
|
||||
|
||||
(setq save-abbrevs 'silently)
|
||||
|
||||
;;; dabbrev
|
||||
|
||||
(setq dabbrev-upcase-means-case-search t)
|
||||
(setq dabbrev-ignored-buffer-modes
|
||||
'(archive-mode image-mode docview-mode tags-table-mode pdf-view-mode))
|
||||
|
||||
;;; Load post init
|
||||
(minimal-emacs-load-user-init "post-init.el")
|
||||
|
||||
(provide 'init)
|
||||
|
||||
;;; init.el ends here
|
||||
|
||||
Reference in New Issue
Block a user