diff --git a/README.md b/README.md index 7bdae22..54b76d9 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,6 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's - [How to enable the menu-bar, the tool-bar, dialogs, the contextual menu, and tooltips?](#how-to-enable-the-menu-bar-the-tool-bar-dialogs-the-contextual-menu-and-tooltips) - [Customizations: Packages (post-init.el)](#customizations-packages-post-initel) - [Optimization: Native Compilation](#optimization-native-compilation) - - [Automatic removal of trailing whitespace on save](#automatic-removal-of-trailing-whitespace-on-save) - [How to activate recentf, savehist, saveplace, and auto-revert?](#how-to-activate-recentf-savehist-saveplace-and-auto-revert) - [Activating autosave](#activating-autosave) - [auto-save-mode (Prevent data loss in case of crashes)](#auto-save-mode-prevent-data-loss-in-case-of-crashes) @@ -66,6 +65,7 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's - [Configuring Vertico, Consult, and Embark](#configuring-vertico-consult-and-embark) - [Code folding](#code-folding) - [Changing the default theme](#changing-the-default-theme) + - [Automatic removal of trailing whitespace on save](#automatic-removal-of-trailing-whitespace-on-save) - [Enhancing undo/redo](#enhancing-undoredo) - [Configuring Vim keybindings using Evil?](#configuring-vim-keybindings-using-evil) - [Configuring LSP Servers with Eglot (built-in)](#configuring-lsp-servers-with-eglot-built-in) @@ -221,6 +221,8 @@ Native compilation enhances Emacs performance by converting Elisp code into nati ;; 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. + (push "/init.el" compile-angel-excluded-files) + (push "/early-init.el" compile-angel-excluded-files) (push "/pre-init.el" compile-angel-excluded-files) (push "/post-init.el" compile-angel-excluded-files) (push "/pre-early-init.el" compile-angel-excluded-files) @@ -233,40 +235,6 @@ Native compilation enhances Emacs performance by converting Elisp code into nati (compile-angel-on-load-mode)) ``` -### Automatic removal of trailing whitespace on save - -**Trailing whitespace** refers to any spaces or tabs that appear after the last non-whitespace character on a line. These characters have no semantic value and can lead to unnecessary diffs in version control, inconsistent formatting, or visual clutter. Removing them improves code clarity and consistency. - -The **stripspace** Emacs package provides `stripspace-local-mode`, a minor mode that automatically removes trailing whitespace and blank lines at the end of the buffer when saving. - -To enable **stripspace** and automatically delete trailing whitespace, add the following configuration to `~/.emacs.d/post-init.el`: -```elisp -(use-package stripspace - :ensure t - :defer t - :commands stripspace-local-mode - - ;; Enable for prog-mode-hook, text-mode-hook, conf-mode-hook - :hook ((prog-mode . stripspace-local-mode) - (text-mode . stripspace-local-mode) - (conf-mode . stripspace-local-mode)) - - :custom - ;; The `stripspace-only-if-initially-clean' option: - ;; - nil to always delete trailing whitespace. - ;; - Non-nil to only delete whitespace when the buffer is clean initially. - ;; (The initial cleanliness check is performed when `stripspace-local-mode' - ;; is enabled.) - (stripspace-only-if-initially-clean nil) - - ;; Enabling `stripspace-restore-column' preserves the cursor's column position - ;; even after stripping spaces. This is useful in scenarios where you add - ;; extra spaces and then save the file. Although the spaces are removed in the - ;; saved file, the cursor remains in the same position, ensuring a consistent - ;; editing experience without affecting cursor placement. - (stripspace-restore-column t)) -``` - ### How to activate recentf, savehist, saveplace, and auto-revert? The recentf, savehist, saveplace, and auto-revert built-in packages are already configured by *minimal-emacs.d*. All you need to do is activate them by adding the following to `~/.emacs.d/post-init.el`: @@ -600,6 +568,40 @@ If you're interested in exploring third-party Emacs themes, consider the followi - `doom-themes` (available on MELPA): An extensive collection of high-quality, visually appealing themes for Emacs, designed to offer a sleek and modern aesthetic, while drawing inspiration from popular community themes. - `tomorrow-night-deepblue-theme` (available on MELPA): A beautiful deep blue variant of the Tomorrow Night theme, which is renowned for its elegant color palette. It features a deep blue background color that creates a calming atmosphere. This theme is a great choice for those who miss the blue themes that were trendy a few years ago. (The theme was inspired by classic text editors such as QuickBASIC, RHIDE, and Turbo Pascal, as well as tools such as Midnight Commander.) +### Automatic removal of trailing whitespace on save + +**Trailing whitespace** refers to any spaces or tabs that appear after the last non-whitespace character on a line. These characters have no semantic value and can lead to unnecessary diffs in version control, inconsistent formatting, or visual clutter. Removing them improves code clarity and consistency. + +The [stripspace](https://github.com/jamescherti/stripspace.el) Emacs package provides `stripspace-local-mode`, a minor mode that automatically removes trailing whitespace and blank lines at the end of the buffer when saving. + +To enable **stripspace** and automatically delete trailing whitespace, add the following configuration to `~/.emacs.d/post-init.el`: +```elisp +(use-package stripspace + :ensure t + :defer t + :commands stripspace-local-mode + + ;; Enable for prog-mode-hook, text-mode-hook, conf-mode-hook + :hook ((prog-mode . stripspace-local-mode) + (text-mode . stripspace-local-mode) + (conf-mode . stripspace-local-mode)) + + :custom + ;; The `stripspace-only-if-initially-clean' option: + ;; - nil to always delete trailing whitespace. + ;; - Non-nil to only delete whitespace when the buffer is clean initially. + ;; (The initial cleanliness check is performed when `stripspace-local-mode' + ;; is enabled.) + (stripspace-only-if-initially-clean nil) + + ;; Enabling `stripspace-restore-column' preserves the cursor's column position + ;; even after stripping spaces. This is useful in scenarios where you add + ;; extra spaces and then save the file. Although the spaces are removed in the + ;; saved file, the cursor remains in the same position, ensuring a consistent + ;; editing experience without affecting cursor placement. + (stripspace-restore-column t)) +``` + ### Enhancing undo/redo The undo-fu package is a lightweight wrapper around Emacs' built-in undo system, providing more convenient undo/redo functionality while preserving access to the full undo history. The undo-fu-session package complements undo-fu by enabling the saving and restoration of undo history across Emacs sessions, even after restarting.