Update comments
This commit is contained in:
@@ -19,11 +19,11 @@
|
|||||||
(defvar minimal-emacs-ui-features '()
|
(defvar minimal-emacs-ui-features '()
|
||||||
"List of user interface features to disable in minimal Emacs setup.
|
"List of user interface features to disable in minimal Emacs setup.
|
||||||
This variable holds a list Emacs UI features that can be enabled:
|
This variable holds a list 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.)
|
||||||
- `dialogs`: Enables both file dialogs and dialog boxes.
|
- dialogs (Enables both file dialogs and dialog boxes.)
|
||||||
- `tooltips`: Enables tooltips.")
|
- tooltips (Enables tooltips.)")
|
||||||
|
|
||||||
(defvar minimal-emacs-frame-title-format "%b – Emacs"
|
(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.")
|
||||||
@@ -31,39 +31,40 @@ 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 (* 16 1024 1024)
|
(defvar minimal-emacs-gc-cons-threshold (* 32 1024 1024)
|
||||||
"The value of `gc-cons-threshold' after Emacs startup.")
|
"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--restore-gc-cons-threshold'.")
|
||||||
|
|
||||||
|
(defvar minimal-emacs-inhibit-redisplay-during-startup nil
|
||||||
|
"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.
|
||||||
|
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-optimize-file-name-handler-alist t
|
||||||
|
"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.
|
||||||
|
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 t
|
(defvar minimal-emacs-package-initialize-and-refresh t
|
||||||
"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
|
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-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-optimize-file-name-handler-alist t)
|
|
||||||
|
|
||||||
(defvar minimal-emacs-disable-mode-line-during-startup t
|
|
||||||
"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
|
(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.")
|
||||||
|
|
||||||
@@ -289,6 +290,19 @@ this stage of initialization."
|
|||||||
|
|
||||||
;;; Performance: Disable mode-line during startup
|
;;; Performance: Disable mode-line during startup
|
||||||
|
|
||||||
|
(when (and minimal-emacs-disable-mode-line-during-startup
|
||||||
|
(not (daemonp))
|
||||||
|
(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
|
||||||
|
(setq mode-line-format nil))))
|
||||||
|
|
||||||
|
;;; Restore values
|
||||||
|
|
||||||
(defun minimal-emacs--startup-load-user-init-file (fn &rest args)
|
(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."
|
"Advice to reset `mode-line-format'. FN and ARGS are the function and args."
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
@@ -306,18 +320,8 @@ this stage of initialization."
|
|||||||
(setq-default mode-line-format (get 'mode-line-format
|
(setq-default mode-line-format (get 'mode-line-format
|
||||||
'initial-value))))))
|
'initial-value))))))
|
||||||
|
|
||||||
(when (and minimal-emacs-disable-mode-line-during-startup
|
|
||||||
(not (daemonp))
|
|
||||||
(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
|
|
||||||
(setq mode-line-format nil)))
|
|
||||||
(advice-add 'startup--load-user-init-file :around
|
(advice-add 'startup--load-user-init-file :around
|
||||||
#'minimal-emacs--startup-load-user-init-file))
|
#'minimal-emacs--startup-load-user-init-file)
|
||||||
|
|
||||||
;;; UI elements
|
;;; UI elements
|
||||||
|
|
||||||
@@ -344,15 +348,16 @@ this stage of initialization."
|
|||||||
(when (bound-and-true-p tool-bar-mode)
|
(when (bound-and-true-p tool-bar-mode)
|
||||||
(funcall 'tool-bar-setup))))
|
(funcall 'tool-bar-setup))))
|
||||||
|
|
||||||
(unless (daemonp)
|
(when (and (not (daemonp))
|
||||||
(unless noninteractive
|
(not noninteractive))
|
||||||
(when (fboundp 'tool-bar-setup)
|
(when (fboundp 'tool-bar-setup)
|
||||||
;; Temporarily override the tool-bar-setup function to prevent it from
|
;; Temporarily override the tool-bar-setup function to prevent it from
|
||||||
;; running during the initial stages of startup
|
;; running during the initial stages of startup
|
||||||
(advice-add 'tool-bar-setup :override #'ignore)
|
(advice-add 'tool-bar-setup :override #'ignore)
|
||||||
|
|
||||||
(advice-add 'startup--load-user-init-file :after
|
(advice-add 'startup--load-user-init-file :after
|
||||||
#'minimal-emacs--setup-toolbar))))
|
#'minimal-emacs--setup-toolbar)))
|
||||||
|
|
||||||
(unless (memq 'tool-bar minimal-emacs-ui-features)
|
(unless (memq 'tool-bar minimal-emacs-ui-features)
|
||||||
(push '(tool-bar-lines . 0) default-frame-alist)
|
(push '(tool-bar-lines . 0) default-frame-alist)
|
||||||
(setq tool-bar-mode nil))
|
(setq tool-bar-mode nil))
|
||||||
|
|||||||
38
init.el
38
init.el
@@ -178,8 +178,7 @@
|
|||||||
(setq auto-save-no-message t)
|
(setq auto-save-no-message t)
|
||||||
|
|
||||||
;; Do not auto-disable auto-save after deleting large chunks of
|
;; Do not auto-disable auto-save after deleting large chunks of
|
||||||
;; text. The purpose of auto-save is to provide a failsafe, and
|
;; text.
|
||||||
;; disabling it contradicts this objective.
|
|
||||||
(setq auto-save-include-big-deletions t)
|
(setq auto-save-include-big-deletions t)
|
||||||
|
|
||||||
(setq auto-save-list-file-prefix
|
(setq auto-save-list-file-prefix
|
||||||
@@ -206,8 +205,7 @@
|
|||||||
|
|
||||||
;;; recentf
|
;;; recentf
|
||||||
|
|
||||||
;; `recentf' is an that maintains a list of recently accessed files, making it
|
;; `recentf' is an that maintains a list of recently accessed files.
|
||||||
;; easier to reopen files you have worked on recently.
|
|
||||||
(setq recentf-max-saved-items 300) ; default is 20
|
(setq recentf-max-saved-items 300) ; default is 20
|
||||||
(setq recentf-max-menu-items 15)
|
(setq recentf-max-menu-items 15)
|
||||||
(setq recentf-auto-cleanup (if (daemonp) 300 'never))
|
(setq recentf-auto-cleanup (if (daemonp) 300 'never))
|
||||||
@@ -217,8 +215,7 @@
|
|||||||
|
|
||||||
;;; saveplace
|
;;; saveplace
|
||||||
|
|
||||||
;; `save-place-mode' enables Emacs to remember the last location within a file
|
;; Enables Emacs to remember the last location within a file upon reopening.
|
||||||
;; upon reopening.
|
|
||||||
(setq save-place-file (expand-file-name "saveplace" user-emacs-directory))
|
(setq save-place-file (expand-file-name "saveplace" user-emacs-directory))
|
||||||
(setq save-place-limit 600)
|
(setq save-place-limit 600)
|
||||||
|
|
||||||
@@ -254,25 +251,20 @@
|
|||||||
|
|
||||||
;;; Scrolling
|
;;; Scrolling
|
||||||
|
|
||||||
;; Enables faster scrolling through unfontified regions. This may result in
|
;; Enables faster scrolling. This may result in brief periods of inaccurate
|
||||||
;; brief periods of inaccurate syntax highlighting immediately after scrolling,
|
;; syntax highlighting, which should quickly self-correct.
|
||||||
;; which should quickly self-correct.
|
|
||||||
(setq fast-but-imprecise-scrolling t)
|
(setq fast-but-imprecise-scrolling t)
|
||||||
|
|
||||||
;; Move point to top/bottom of buffer before signaling a scrolling error.
|
;; Move point to top/bottom of buffer before signaling a scrolling error.
|
||||||
(setq scroll-error-top-bottom t)
|
(setq scroll-error-top-bottom t)
|
||||||
|
|
||||||
;; Keeps screen position if the scroll command moved it vertically out of the
|
;; Keep screen position if scroll command moved it vertically out of the window.
|
||||||
;; window.
|
|
||||||
(setq scroll-preserve-screen-position t)
|
(setq scroll-preserve-screen-position t)
|
||||||
|
|
||||||
;; Emacs spends excessive time recentering when the cursor moves more than N
|
;; If `scroll-conservatively' is set above 100, the window is never
|
||||||
;; lines past the window edges (N is the value of `scroll-conservatively'). This
|
;; automatically recentered, which decreases the time spend recentering.
|
||||||
;; can be slow in larger files. If `scroll-conservatively' is set above 100, the
|
|
||||||
;; window is never automatically recentered.
|
|
||||||
(setq scroll-conservatively 101)
|
(setq scroll-conservatively 101)
|
||||||
|
|
||||||
;; Reduce cursor lag by:
|
|
||||||
;; 1. Preventing automatic adjustments to `window-vscroll' for long lines.
|
;; 1. Preventing automatic adjustments to `window-vscroll' for long lines.
|
||||||
;; 2. Resolving the issue of random half-screen jumps during scrolling.
|
;; 2. Resolving the issue of random half-screen jumps during scrolling.
|
||||||
(setq auto-window-vscroll nil)
|
(setq auto-window-vscroll nil)
|
||||||
@@ -319,9 +311,8 @@
|
|||||||
;; Avoid automatic frame resizing when adjusting settings.
|
;; Avoid automatic frame resizing when adjusting settings.
|
||||||
(setq global-text-scale-adjust-resizes-frames nil)
|
(setq global-text-scale-adjust-resizes-frames nil)
|
||||||
|
|
||||||
;; This controls how long Emacs will blink to show the deleted pairs with
|
;; A longer delay can be annoying as it causes a noticeable pause after each
|
||||||
;; `delete-pair'. A longer delay can be annoying as it causes a noticeable pause
|
;; deletion, disrupting the flow of editing.
|
||||||
;; after each deletion, disrupting the flow of editing.
|
|
||||||
(setq delete-pair-blink-delay 0.03)
|
(setq delete-pair-blink-delay 0.03)
|
||||||
|
|
||||||
(setq-default left-fringe-width 8)
|
(setq-default left-fringe-width 8)
|
||||||
@@ -427,9 +418,8 @@
|
|||||||
(setq apropos-do-all t)
|
(setq apropos-do-all t)
|
||||||
|
|
||||||
;; Fixes #11: Prevents help command completion from triggering autoload.
|
;; 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
|
||||||
;; Loading additional files for completion can slow down help commands
|
;; unintentionally execute initialization code from some libraries.
|
||||||
;; and may unintentionally execute initialization code from some libraries.
|
|
||||||
(setq help-enable-completion-autoload nil)
|
(setq help-enable-completion-autoload nil)
|
||||||
(setq help-enable-autoload nil)
|
(setq help-enable-autoload nil)
|
||||||
(setq help-enable-symbol-autoload nil)
|
(setq help-enable-symbol-autoload nil)
|
||||||
@@ -449,9 +439,7 @@
|
|||||||
(setq eglot-report-progress nil) ; Prevent Eglot minibuffer spam
|
(setq eglot-report-progress nil) ; Prevent Eglot minibuffer spam
|
||||||
|
|
||||||
;; Eglot optimization: Disable `eglot-events-buffer' to maintain consistent
|
;; Eglot optimization: Disable `eglot-events-buffer' to maintain consistent
|
||||||
;; performance in long-running Emacs sessions. By default, it retains 2,000,000
|
;; performance in long-running Emacs sessions.
|
||||||
;; 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))
|
(setq eglot-events-buffer-config '(:size 0 :format full))
|
||||||
|
|
||||||
;;; Flymake
|
;;; Flymake
|
||||||
|
|||||||
Reference in New Issue
Block a user