Merge branch 'main' of https://github.com/jamescherti/minimal-emacs.d
This commit is contained in:
197
README.md
197
README.md
@@ -105,8 +105,10 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's
|
||||
- [Frequently asked questions](#frequently-asked-questions)
|
||||
- [Customizing Scroll Recentering](#customizing-scroll-recentering)
|
||||
- [How to display Emacs startup duration?](#how-to-display-emacs-startup-duration)
|
||||
- [How to get the latest version of all packages? (unstable)](#how-to-get-the-latest-version-of-all-packages-unstable)
|
||||
- [How to use MELPA stable?](#how-to-use-melpa-stable)
|
||||
- [How to load a local lisp file for machine-specific configurations?](#how-to-load-a-local-lisp-file-for-machine-specific-configurations)
|
||||
- [How to prevent Emacs from repeatedly performing native compilation on specific Elisp files](#how-to-prevent-emacs-from-repeatedly-performing-native-compilation-on-specific-elisp-files)
|
||||
- [How to load Emacs customizations?](#how-to-load-emacs-customizations)
|
||||
- [How to increase gc-cons-threshold?](#how-to-increase-gc-cons-threshold)
|
||||
- [How to prevent Emacs from loading .dir-locals.el files?](#how-to-prevent-emacs-from-loading-dir-localsel-files)
|
||||
@@ -116,7 +118,7 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's
|
||||
- [Why did the author develop minimal-emacs.d?](#why-did-the-author-develop-minimal-emacsd)
|
||||
- [How to keep minimal-emacs.d pre-\*.el and post-\*.el files in a separate directory?](#how-to-keep-minimal-emacsd-pre-el-and-post-el-files-in-a-separate-directory)
|
||||
- [How to make *minimal-emacs.d* install packages in the early-init phase instead of the init phase?](#how-to-make-minimal-emacsd-install-packages-in-the-early-init-phase-instead-of-the-init-phase)
|
||||
- [Comments from users](#comments-from-users)
|
||||
- [Testimonials from users](#testimonials-from-users)
|
||||
- [Minimal-emacs.d configurations from users](#minimal-emacsd-configurations-from-users)
|
||||
- [Features](#features)
|
||||
- [Author and license](#author-and-license)
|
||||
@@ -245,6 +247,7 @@ Native compilation enhances Emacs performance by converting Elisp code into nati
|
||||
;; Ensure adding the following compile-angel code at the very beginning
|
||||
;; of your `~/.emacs.d/post-init.el` file, before all other packages.
|
||||
(use-package compile-angel
|
||||
:demand t
|
||||
:ensure t
|
||||
:custom
|
||||
;; Set `compile-angel-verbose` to nil to suppress output from compile-angel.
|
||||
@@ -256,8 +259,9 @@ Native compilation enhances Emacs performance by converting Elisp code into nati
|
||||
;; files. If you choose to remove this push to `compile-angel-excluded-files'
|
||||
;; and compile your pre/post-init files, ensure you understand the
|
||||
;; implications and thoroughly test your code. For example, if you're using
|
||||
;; `use-package', you'll need to explicitly add `(require 'use-package)` at
|
||||
;; the top of your init file.
|
||||
;; the `use-package' macro, you'll need to explicitly add:
|
||||
;; (eval-when-compile (require 'use-package))
|
||||
;; at the top of your init file.
|
||||
(push "/init.el" compile-angel-excluded-files)
|
||||
(push "/early-init.el" compile-angel-excluded-files)
|
||||
(push "/pre-init.el" compile-angel-excluded-files)
|
||||
@@ -1291,6 +1295,20 @@ NOTE: `flyspell-mode` can become slow when using Aspell, especially with large b
|
||||
|
||||
To configure **flyspell**, add the following to `~/.emacs.d/post-init.el`:
|
||||
``` emacs-lisp
|
||||
;; The flyspell package is a built-in Emacs minor mode that provides
|
||||
;; on-the-fly spell checking. It highlights misspelled words as you type,
|
||||
;; offering interactive corrections. In text modes, it checks the entire buffer,
|
||||
;; while in programming modes, it typically checks only comments and strings. It
|
||||
;; integrates with external spell checkers like aspell, hunspell, or
|
||||
;; ispell to provide suggestions and corrections.
|
||||
;;
|
||||
;; NOTE: flyspell-mode can become slow when using Aspell, especially with large
|
||||
;; buffers or aggressive suggestion settings like --sug-mode=ultra. This
|
||||
;; slowdown occurs because Flyspell checks words dynamically as you type or
|
||||
;; navigate text, requiring frequent communication between Emacs and the
|
||||
;; external Aspell process. Each check involves sending words to Aspell and
|
||||
;; receiving results, which introduces overhead from process invocation and
|
||||
;; inter-process communication.
|
||||
(use-package ispell
|
||||
:ensure nil
|
||||
:commands (ispell ispell-minor-mode)
|
||||
@@ -1551,7 +1569,7 @@ To configure the *persist-text-scale* package, add the following to your `~/.ema
|
||||
|
||||
### Loading the custom.el file
|
||||
|
||||
**NOTE:** The author advises against loading `custom.el`. To disable it, set `custom-file` to the null device using `(setq custom-file null-device)`. Users are instead encouraged to define their configuration programmatically in files such as `post-init.el`. Maintaining configuration programmatically offers several advantages: it ensures reproducibility and facilitates version control. This makes it easier to understand, audit, and evolve the configuration over time.
|
||||
**NOTE:** The author advises against loading `custom.el`. Users are instead encouraged to define their configuration programmatically in files such as `post-init.el`. Maintaining configuration programmatically offers several advantages: it ensures reproducibility and facilitates version control. This makes it easier to understand, audit, and evolve the configuration over time.
|
||||
|
||||
In Emacs, customization variables modified via the UI (e.g., `M-x customize`) are typically stored in a separate file, commonly named `custom.el`. To ensure these settings are loaded during Emacs initialization, it is necessary to explicitly load this file if it exists. To accomplish this, add the following form to your `~/.emacs.d/post-init.el`:
|
||||
|
||||
@@ -1795,29 +1813,29 @@ And [add the Elpaca bootstrap code](https://github.com/progfolio/elpaca?tab=read
|
||||
|
||||
### Customizing Scroll Recentering
|
||||
|
||||
By default, minimal-emacs.d sets `scroll-conservatively` to `101`:
|
||||
By default, minimal-emacs.d sets `scroll-conservatively` to `20`:
|
||||
|
||||
```emacs-lisp
|
||||
(setq scroll-conservatively 101) ; Default minimal-emacs.d value
|
||||
(setq scroll-conservatively 20) ; Default minimal-emacs.d value
|
||||
```
|
||||
|
||||
A value of `101` minimizes screen movement and maintains point visibility with minimal adjustment, which many users find optimal for rapid navigation.
|
||||
This makes Emacs recenters the window when the cursor moves past `scroll-conservatively` lines beyond the window edge.
|
||||
|
||||
You can override this in your `post-init.el` file. Setting it to `0` forces Emacs to recenter the point aggressively, typically positioning it in the middle of the window:
|
||||
You can override this in your `post-init.el` file. Setting it to `0` forces Emacs to recenter the point aggressively, typically positioning it in the middle of the window (NOT RECOMMENDED):
|
||||
|
||||
```emacs-lisp
|
||||
(setq scroll-conservatively 0) ; NOT RECOMMENDED. SET IT TO 101 INSTEAD.
|
||||
(setq scroll-conservatively 0) ; NOT RECOMMENDED
|
||||
```
|
||||
|
||||
Although this offers more surrounding context, it results in frequent and pronounced screen movement, which can disrupt navigation. A value of `0` is generally discouraged unless this behavior is explicitly desired.
|
||||
|
||||
Most users prefer `101`. Some select `10` as a compromise:
|
||||
A value of `101` minimizes screen movement and maintains point visibility with minimal adjustment:
|
||||
|
||||
```emacs-lisp
|
||||
(setq scroll-conservatively 10) ; Note: You might prefer 101 over 10.
|
||||
(setq scroll-conservatively 101)
|
||||
```
|
||||
|
||||
A value of `10` permits occasional recentering for additional context but introduces more movement than `101`.
|
||||
The main drawback of `101` is that Emacs will avoid recentering almost entirely, only adjusting the window just enough to keep point visible at the very top or very bottom of the screen. Point can stick to the top or bottom edge of the window, giving you very little context above or below, which can make editing harder if you want surrounding lines visible.
|
||||
|
||||
### How to display Emacs startup duration?
|
||||
|
||||
@@ -1837,6 +1855,124 @@ Add the following to your `~/.emacs.d/pre-early-init.el` file:
|
||||
|
||||
(Alternatively, you may use the built-in `M-x emacs-init-time` command to obtain the startup duration. However, `emacs-init-time` does not account for the portion of the startup process that occurs after `after-init-time`.)
|
||||
|
||||
### How to get the latest version of all packages? (unstable)
|
||||
|
||||
By default, *minimal-emacs.d* is configured to prioritize packages from [GNU ELPA](https://elpa.gnu.org/) and [NonGNU ELPA](https://elpa.nongnu.org/) repositories over [MELPA](https://melpa.org/), ensuring greater stability.
|
||||
|
||||
If you prefer to obtain the latest packages from MELPA to access new features and improvements, you can adjust the priority so that Emacs `use-package` retrieves the newest versions from MELPA before consulting the stable GNU and NonGNU repositories. While MELPA packages are generally regarded as less stable, actual breakages are uncommon; over the past year, only a single package (package-lint) out of 146 packages in the author’s configuration experienced a brief disruption, which was quickly resolved.
|
||||
|
||||
Benefit:
|
||||
|
||||
* Ensures access to the **most recent package versions**, enabling early adoption of new features, performance improvements, and upstream bug fixes.
|
||||
* Prioritizing MELPA provides a **broader selection of cutting-edge packages**, including experimental or niche tools that may not yet exist in stable archives.
|
||||
|
||||
Drawback:
|
||||
|
||||
* Exposure to **potential instability**, as MELPA packages are often built from the latest commits without extensive regression testing.
|
||||
* May require **periodic maintenance**, such as resolving dependency conflicts or adapting to API changes in packages that evolve rapidly. (actual breakages are uncommon.)
|
||||
|
||||
To ensure that Emacs always installs or updates to the newest versions of all packages, add the following configuration to `~/.emacs.d/post-early-init.el`:
|
||||
|
||||
```elisp
|
||||
;; Obtain the latest packages from MELPA to access new features and
|
||||
;; improvements. While MELPA packages are generally regarded as less stable,
|
||||
;; actual breakages are uncommon; over the past year, only a single package
|
||||
;; (package-lint) out of 146 packages in the minimal-emacs.d author’s
|
||||
;; configuration experienced a brief disruption, which was quickly resolved.
|
||||
(setq package-archive-priorities '(("melpa" . 90)
|
||||
("gnu" . 70)
|
||||
("nongnu" . 60)
|
||||
("melpa-stable" . 50)))
|
||||
```
|
||||
|
||||
This setup prioritizes **MELPA** over the stable GNU and NonGNU repositories. When multiple archives provide the same package, Emacs will choose the version from the archive with the highest priority. As a result, you will consistently receive the latest available versions from MELPA while still having access to stable GNU and NonGNU packages when MELPA does not provide them.
|
||||
|
||||
In the event of a package breakage, you can direct Emacs to install a package from a specific repository. For instance, to ensure that *evil* and *evil-collection* are installed from *melpa-stable*, add the following configuration to `~/.emacs.d/post-early-init.el`:
|
||||
```elisp
|
||||
(setq package-pinned-packages
|
||||
'((evil . "melpa-stable")
|
||||
(evil-collection . "melpa-stable")))
|
||||
```
|
||||
|
||||
Here is a comprehensive `package-pinned-packages` configuration to guarantee that essential packages, such as **consult** or **corfu**, are retrieved from a stable repository, while all remaining packages are obtained from MELPA according to the `package-archive-priorities' priorities above:
|
||||
```elisp
|
||||
(setq package-pinned-packages
|
||||
'((annalist . "melpa-stable")
|
||||
(ansible-doc . "melpa-stable")
|
||||
(apheleia . "melpa-stable")
|
||||
(basic-mode . "melpa-stable")
|
||||
(consult-dir . "melpa-stable")
|
||||
(corfu-prescient . "melpa-stable")
|
||||
(dtrt-indent . "melpa-stable")
|
||||
(dumb-jump . "melpa-stable")
|
||||
(elisp-refs . "melpa-stable")
|
||||
(evil-collection . "melpa-stable")
|
||||
(f . "melpa-stable")
|
||||
(flymake-quickdef . "melpa-stable")
|
||||
(groovy-mode . "melpa-stable")
|
||||
(highlight-defined . "melpa-stable")
|
||||
(markdown-toc . "melpa-stable")
|
||||
(org-appear . "melpa-stable")
|
||||
(package-lint-flymake . "melpa-stable")
|
||||
(parent-mode . "melpa-stable")
|
||||
(php-mode . "melpa-stable")
|
||||
(prescient . "melpa-stable")
|
||||
(s . "melpa-stable")
|
||||
(tocus . "melpa-stable")
|
||||
(treesit-auto . "melpa-stable")
|
||||
(vertico-prescient . "melpa-stable")
|
||||
(visual-fill-column . "melpa-stable")
|
||||
(yasnippet-snippets . "melpa-stable")
|
||||
(ace-window . "gnu")
|
||||
(aggressive-indent . "gnu")
|
||||
(avy . "gnu")
|
||||
(cape . "gnu")
|
||||
(compat . "gnu")
|
||||
(consult . "gnu")
|
||||
(corfu . "gnu")
|
||||
(csv-mode . "gnu")
|
||||
(dash . "gnu")
|
||||
(diff-hl . "gnu")
|
||||
(diminish . "gnu")
|
||||
(easy-escape . "gnu")
|
||||
(embark . "gnu")
|
||||
(embark-consult . "gnu")
|
||||
(expand-region . "gnu")
|
||||
(gcmh . "gnu")
|
||||
(indent-bars . "gnu")
|
||||
(marginalia . "gnu")
|
||||
(modus-themes . "gnu")
|
||||
(orderless . "gnu")
|
||||
(org . "gnu")
|
||||
(rainbow-mode . "gnu")
|
||||
(transient . "gnu")
|
||||
(vertico . "gnu")
|
||||
(yasnippet . "gnu")
|
||||
(ztree . "gnu")
|
||||
(eat . "nongnu")
|
||||
(edit-indirect . "nongnu")
|
||||
(evil-visualstar . "nongnu")
|
||||
(exec-path-from-shell . "nongnu")
|
||||
(git-modes . "nongnu")
|
||||
(golden-ratio . "nongnu")
|
||||
(goto-chg . "nongnu")
|
||||
(gptel . "nongnu")
|
||||
(lua-mode . "nongnu")
|
||||
(magit . "nongnu")
|
||||
(markdown-mode . "nongnu")
|
||||
(package-lint . "nongnu")
|
||||
(page-break-lines . "nongnu")
|
||||
(paredit . "nongnu")
|
||||
(popup . "nongnu")
|
||||
(rainbow-delimiters . "nongnu")
|
||||
(undo-fu . "nongnu")
|
||||
(undo-fu-session . "nongnu")
|
||||
(wgrep . "nongnu")
|
||||
(with-editor . "nongnu")
|
||||
(ws-butler . "nongnu")
|
||||
(yaml-mode . "nongnu")))
|
||||
```
|
||||
|
||||
### How to use MELPA stable?
|
||||
|
||||
**Note: The minimal-emacs.d author does not recommend using MELPA Stable. Use MELPA instead, which is enabled by default in the minimal-emacs.d configuration.**
|
||||
@@ -1850,16 +1986,13 @@ Here are the key differences between **MELPA** (the default repository used in m
|
||||
If you prefer MELPA Stable over MELPA, you can add MELPA Stable and prioritize it. To ensure packages are fetched from MELPA Stable first, add the following configuration to `~/.emacs.d/post-early-init.el`:
|
||||
|
||||
```elisp
|
||||
;; Add melpa-stable to `package-archives'
|
||||
(push '("melpa-stable" . "https://stable.melpa.org/packages/") package-archives)
|
||||
|
||||
;; This change increases MELPA Stable priority to 70, above MELPA,
|
||||
;; ensuring that MELPA is preferred for package installations
|
||||
;; over MELPA Stable.
|
||||
(setq package-archive-priorities '(("gnu" . 99)
|
||||
(setq package-archive-priorities '(("gnu" . 90)
|
||||
("nongnu" . 80)
|
||||
("melpa-stable" . 70)
|
||||
("melpa" . 0)))
|
||||
("melpa" . 60)))
|
||||
```
|
||||
|
||||
### How to load a local lisp file for machine-specific configurations?
|
||||
@@ -1873,6 +2006,31 @@ This allows `local.el` to load, enabling custom configurations specific to the m
|
||||
|
||||
(Ensure that `local.el` is in the same directory as `post-init.el`.)
|
||||
|
||||
### How to prevent Emacs from repeatedly performing native compilation on specific Elisp files
|
||||
|
||||
In certain Emacs configurations, specific files may be recompiled repeatedly during startup.
|
||||
```elisp
|
||||
Compiling /snap/emacs/current/usr/share/emacs/lisp/org/org-loaddefs.el.gz...
|
||||
Compiling /snap/emacs/current/usr/share/emacs/etc/themes/modus-vivendi-theme.el...
|
||||
```
|
||||
|
||||
This behavior arises because Emacs performs native compilation on specific Elisp files, and in many scenarios, it is desirable to prevent compilation of files that fail during the process.
|
||||
|
||||
Emacs can be configured to bypass native compilation for files whose paths match a list of regular expression patterns by setting `native-comp-jit-compilation-deny-list`. For example:
|
||||
```elisp
|
||||
(let ((deny-list '("\\(?:[/\\\\]\\.dir-locals\\.el\\(?:\\.gz\\)?$\\)"
|
||||
"\\(?:[/\\\\]modus-vivendi-theme\\.el\\(?:\\.gz\\)?$\\)"
|
||||
"\\(?:[/\\\\][^/\\\\]+-loaddefs\\.el\\(?:\\.gz\\)?$\\)"
|
||||
"\\(?:[/\\\\][^/\\\\]+-autoloads\\.el\\(?:\\.gz\\)?$\\)")))
|
||||
(setq native-comp-jit-compilation-deny-list deny-list)
|
||||
;; Deprecated
|
||||
(with-no-warnings
|
||||
(setq native-comp-deferred-compilation-deny-list deny-list)
|
||||
(setq comp-deferred-compilation-deny-list deny-list)))
|
||||
```
|
||||
|
||||
This deny list instructs Emacs to bypass native compilation for files matching the specified patterns, preventing unnecessary or error-prone recompilation while permitting all other files to be compiled normally.
|
||||
|
||||
### How to load Emacs customizations?
|
||||
|
||||
To load customizations saved by Emacs (`M-x customize`), add the following code snippet to the `post-init.el` file. This ensures that the custom file, typically set to a separate file for user preferences, is loaded without errors or messages during startup:
|
||||
@@ -1979,13 +2137,14 @@ To install and load packages during the early-init phase, add the following to `
|
||||
|
||||
A drawback of using the early-init phase instead of init is that if a package fails (e.g, due to a network issue), no output will be displayed in the Emacs GUI. You will need to open a terminal to view Emacs's stdout for error messages.
|
||||
|
||||
### Comments from users
|
||||
### Testimonials from users
|
||||
|
||||
- [JamesBrickley (Shout out to this starter-kit: Minimal-Emacs )](https://www.reddit.com/r/emacs/comments/1epz7qn/shout_out_to_this_starterkit_minimalemacs/) appreciates that *minimal-emacs.d* provides an optimized *early-init.el* and *init.el* for fast startup times and sensible default settings. He highlights that the project includes all the essential configurations needed for a well-tuned Emacs setup, eliminating the need to sift through conflicting advice on topics like garbage collection optimization. While he has encountered similar settings before, he also discovered new optimizations he had not seen elsewhere.
|
||||
- [Brandon Schneider (skarekrow)](https://github.com/skarekrow): "...the minimal-emacs project is incredible. I love how documented it is as a beginner to learn from. Thank you for all the effort you've put into that and the other packages you maintain. It's a huge boon to new users."
|
||||
- [Brandon Schneider (skarekrow)](https://github.com/jamescherti/compile-angel.el/issues/5#issuecomment-3186187000): "...the minimal-emacs project is incredible. I love how documented it is as a beginner to learn from. Thank you for all the effort you've put into that and the other packages you maintain. It's a huge boon to new users."
|
||||
- [Leading_Ad6415 commented on Reddit](https://www.reddit.com/r/emacs/comments/1feaf37/comment/lmw7ijd/) that after switching to *minimal-emacs.d*, their configuration execution time decreased from 3 seconds to just 1 second by simply replacing their `init.el` and `early-init.el` files with those from the project.
|
||||
- [Another user commented on Reddit](https://www.reddit.com/r/emacs/comments/1feaf37/comment/lrsfd64/), highlighting how a minimal-emacs.d significantly enhanced their Emacs performance. They reported substantial startup time reductions on both their main machine (from ~2.25 to ~0.95 seconds) and an older laptop (from ~2.95 to ~1.27 seconds) while also experiencing a generally snappier performance within Emacs. The user expressed gratitude for the project, calling it fantastic.
|
||||
- [Cyneox commented on Reddit](https://www.reddit.com/r/emacs/comments/1gh687a/comment/lwdv18t/), expressing gratitude for the resource and sharing their experience. They mentioned it was their fourth attempt to set up a vanilla configuration and highlighted that they had been using the repository as a foundation for their customizations over the past few days. They appreciated the absence of unexplained behavior and the clear instructions on where to place files. The user reported successful testing on both Linux and macOS, noting that everything functioned smoothly, including in the terminal.
|
||||
- [Sebagabones](https://github.com/jamescherti/minimal-emacs.d/issues/77): "...let me say that I am loving minimal-emacs.d, it has been brilliant so far! :)"
|
||||
- [Mlepnos1984](https://www.reddit.com/r/emacs/comments/1lz181i/comment/n2yjj17/): "I give you an A+ on documentation, the readme is great!"
|
||||
- [rrajath](https://www.reddit.com/r/emacs/comments/1ihn2tv/comment/mb0ja8k/) has been using the minimal-emacs.d config for the past several months and loves it. His previous setup used to take around 4 seconds to load, but with minimal-emacs.d, it now loads in just 1 second.
|
||||
- [LionyxML](https://www.reddit.com/r/emacs/comments/1ihn2tv/comment/mb35t9y/) considers that *minimal-emacs.d* contains one of the best README files he has ever read. The author of *minimal-emacs.d* found his comment encouraging. Reading this README.md is highly recommended for anyone looking to start customizing their *minimal-emacs.d* configuration.
|
||||
|
||||
@@ -24,10 +24,14 @@
|
||||
|
||||
;;; Internal variables
|
||||
|
||||
(defvar minimal-emacs--backup-gc-cons-threshold gc-cons-threshold
|
||||
"Backup of the original value of `gc-cons-threshold' before startup.")
|
||||
;; Backup of `gc-cons-threshold' and `gc-cons-percentage' before startup.
|
||||
(defvar minimal-emacs--backup-gc-cons-threshold gc-cons-threshold)
|
||||
(defvar minimal-emacs--backup-gc-cons-percentage gc-cons-percentage)
|
||||
|
||||
;; Temporarily raise the garbage collection threshold to its maximum value.
|
||||
;; It will be restored later to controlled values.
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
(setq gc-cons-percentage 1.0)
|
||||
|
||||
;;; Variables
|
||||
|
||||
@@ -55,6 +59,10 @@ stored in `minimal-emacs-gc-cons-threshold'.")
|
||||
"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.
|
||||
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'.")
|
||||
|
||||
@@ -138,11 +146,11 @@ pre-early-init.el, and post-early-init.el.")
|
||||
(let ((init-file (expand-file-name filename
|
||||
minimal-emacs-user-directory)))
|
||||
(if (not minimal-emacs-load-compiled-init-files)
|
||||
(load init-file :no-error :no-message :nosuffix)
|
||||
(load init-file :no-error (not init-file-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 :no-message))))
|
||||
(load init-file :no-error (not init-file-debug)))))
|
||||
|
||||
(minimal-emacs-load-user-init "pre-early-init.el")
|
||||
|
||||
@@ -157,23 +165,26 @@ pre-early-init.el, and post-early-init.el.")
|
||||
|
||||
(setq garbage-collection-messages minimal-emacs-debug)
|
||||
|
||||
(defun minimal-emacs--restore-gc-cons-threshold ()
|
||||
"Restore `gc-cons-threshold' to `minimal-emacs-gc-cons-threshold'."
|
||||
(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))
|
||||
|
||||
(defun minimal-emacs--restore-gc ()
|
||||
"Restore garbage collection settings."
|
||||
(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)))
|
||||
(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-cons-threshold 105)
|
||||
(add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc 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)))
|
||||
(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
|
||||
|
||||
@@ -182,9 +193,7 @@ pre-early-init.el, and post-early-init.el.")
|
||||
(native-comp-available-p))
|
||||
(when minimal-emacs-setup-native-compilation
|
||||
;; Activate `native-compile'
|
||||
(setq native-comp-deferred-compilation t
|
||||
native-comp-jit-compilation t
|
||||
package-native-compile t))
|
||||
(setq package-native-compile t))
|
||||
;; Deactivate the `native-compile' feature if it is not available
|
||||
(setq features (delq 'native-compile features)))
|
||||
|
||||
@@ -470,16 +479,16 @@ this stage of initialization."
|
||||
(setq use-package-enable-imenu-support t)
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("gnu" . "https://elpa.gnu.org/packages/")
|
||||
("nongnu" . "https://elpa.nongnu.org/nongnu/")))
|
||||
("nongnu" . "https://elpa.nongnu.org/nongnu/")
|
||||
("melpa-stable" . "https://stable.melpa.org/packages/")))
|
||||
(setq package-archive-priorities '(("gnu" . 99)
|
||||
("nongnu" . 80)
|
||||
("melpa" . 70)))
|
||||
("melpa" . 70)
|
||||
("melpa-stable" . 50)))
|
||||
|
||||
;;; Load post-early-init.el
|
||||
(minimal-emacs-load-user-init "post-early-init.el")
|
||||
|
||||
(provide 'early-init)
|
||||
|
||||
;; Local variables:
|
||||
;; byte-compile-warnings: (not obsolete free-vars)
|
||||
;; End:
|
||||
|
||||
16
init.el
16
init.el
@@ -218,9 +218,7 @@
|
||||
(setq recentf-max-saved-items 300) ; default is 20
|
||||
(setq recentf-max-menu-items 15)
|
||||
(setq recentf-auto-cleanup 'mode)
|
||||
|
||||
;; Update recentf-exclude
|
||||
(setq recentf-exclude (list "^/\\(?:ssh\\|su\\|sudo\\)?:"))
|
||||
(setq recentf-exclude nil)
|
||||
|
||||
;;; saveplace
|
||||
|
||||
@@ -272,9 +270,10 @@
|
||||
;; Keep screen position if scroll command moved it vertically out of the window.
|
||||
(setq scroll-preserve-screen-position t)
|
||||
|
||||
;; If `scroll-conservatively' is set above 100, the window is never
|
||||
;; automatically recentered, which decreases the time spend recentering.
|
||||
(setq scroll-conservatively 101)
|
||||
;; Emacs recenters the window when the cursor moves past `scroll-conservatively'
|
||||
;; lines beyond the window edge. A value over 101 disables recentering; the
|
||||
;; default (0) is too eager. Here it is set to 20 for a balanced behavior.
|
||||
(setq scroll-conservatively 20)
|
||||
|
||||
;; 1. Preventing automatic adjustments to `window-vscroll' for long lines.
|
||||
;; 2. Resolving the issue of random half-screen jumps during scrolling.
|
||||
@@ -528,7 +527,8 @@
|
||||
(setq dabbrev-upcase-means-case-search t)
|
||||
|
||||
(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 tags-table-mode))
|
||||
|
||||
(setq dabbrev-ignored-buffer-regexps
|
||||
'(;; - Buffers starting with a space (internal or temporary buffers)
|
||||
@@ -549,8 +549,6 @@
|
||||
(minimal-emacs-load-user-init "post-init.el"))
|
||||
(setq minimal-emacs--success t)
|
||||
|
||||
(provide 'init)
|
||||
|
||||
;; Local variables:
|
||||
;; byte-compile-warnings: (not obsolete free-vars)
|
||||
;; End:
|
||||
|
||||
Reference in New Issue
Block a user