From 9fc291ff0e511a1e39a52d64f2f51c1e0b4ee4b2 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Sat, 8 Mar 2025 09:29:14 -0500 Subject: [PATCH 1/5] Remove duplicate setting: native-comp-jit-compilation --- early-init.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/early-init.el b/early-init.el index f43d019..c6f9168 100644 --- a/early-init.el +++ b/early-init.el @@ -266,7 +266,7 @@ minimalistic appearance during startup.") (native-comp-available-p)) ;; Activate `native-compile' (setq native-comp-jit-compilation t - native-comp-deferred-compilation t ; Obsolete since Emacs 29.1 + native-comp-deferred-compilation t package-native-compile t) ;; Deactivate the `native-compile' feature if it is not available (setq features (delq 'native-compile features))) @@ -276,7 +276,6 @@ minimalistic appearance during startup.") (or minimal-emacs-debug 'silent)) (setq native-comp-verbose (if minimal-emacs-debug 1 0) native-comp-debug (if minimal-emacs-debug 1 0)) -(setq native-comp-jit-compilation t) (setq native-comp-warning-on-missing-source minimal-emacs-debug) (setq debug-on-error minimal-emacs-debug From 58b10227f6ecd9fc13eaf5c6df15e8e89d6b8bd9 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Sat, 8 Mar 2025 09:31:22 -0500 Subject: [PATCH 2/5] Group Native Compilation and Byte Compilation setq --- early-init.el | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/early-init.el b/early-init.el index c6f9168..897a00d 100644 --- a/early-init.el +++ b/early-init.el @@ -271,18 +271,15 @@ minimalistic appearance during startup.") ;; Deactivate the `native-compile' feature if it is not available (setq features (delq 'native-compile features))) -;; Suppress compiler warnings and don't inundate users with their popups. -(setq native-comp-async-report-warnings-errors - (or minimal-emacs-debug 'silent)) -(setq native-comp-verbose (if minimal-emacs-debug 1 0) +(setq native-comp-warning-on-missing-source minimal-emacs-debug + native-comp-async-report-warnings-errors (or minimal-emacs-debug 'silent) + native-comp-verbose (if minimal-emacs-debug 1 0) native-comp-debug (if minimal-emacs-debug 1 0)) -(setq native-comp-warning-on-missing-source minimal-emacs-debug) -(setq debug-on-error minimal-emacs-debug - jka-compr-verbose minimal-emacs-debug) - -(setq byte-compile-warnings minimal-emacs-debug) -(setq byte-compile-verbose minimal-emacs-debug) +(setq debug-on-error minimal-emacs-debug) +(setq jka-compr-verbose minimal-emacs-debug) +(setq byte-compile-warnings minimal-emacs-debug + byte-compile-verbose minimal-emacs-debug) ;;; UI elements From f6ccac0ac53d53cc1db93267926578b495b76b73 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Sat, 8 Mar 2025 09:32:53 -0500 Subject: [PATCH 3/5] Expand the coverage of debug-on-error to include more code --- early-init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/early-init.el b/early-init.el index 897a00d..928b1c0 100644 --- a/early-init.el +++ b/early-init.el @@ -73,6 +73,7 @@ minimalistic appearance during startup.") ;; Prefer loading newer compiled files (setq load-prefer-newer t) +(setq debug-on-error minimal-emacs-debug) (defvar minimal-emacs--success nil) (defvar minimal-emacs--stage "early-init.el") @@ -276,7 +277,6 @@ minimalistic appearance during startup.") native-comp-verbose (if minimal-emacs-debug 1 0) native-comp-debug (if minimal-emacs-debug 1 0)) -(setq debug-on-error minimal-emacs-debug) (setq jka-compr-verbose minimal-emacs-debug) (setq byte-compile-warnings minimal-emacs-debug byte-compile-verbose minimal-emacs-debug) From eb4495f0633031c34096475718df4123eea4a5f2 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Sat, 8 Mar 2025 09:34:14 -0500 Subject: [PATCH 4/5] Modify use-package-expand-minimally using minimal-emacs-debug --- early-init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/early-init.el b/early-init.el index 928b1c0..dfea2f0 100644 --- a/early-init.el +++ b/early-init.el @@ -333,7 +333,7 @@ minimalistic appearance during startup.") ;; 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-expand-minimally (not minimal-emacs-debug)) (setq use-package-minimum-reported-time (if minimal-emacs-debug 0 0.1)) (setq use-package-verbose minimal-emacs-debug) From b885979496e81753350bc032a45bc6f474ff3b30 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Sat, 8 Mar 2025 10:15:03 -0500 Subject: [PATCH 5/5] Update README.md --- README.md | 50 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 52f748f..e6f1029 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's - [Code folding](#code-folding) - [Changing the default theme](#changing-the-default-theme) - [Configuring vterm](#configuring-vterm) + - [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) - [Session Management](#session-management) @@ -522,6 +523,38 @@ To configure `emacs-vterm`, add the following to `~/.emacs.d/post-init.el`: (Note that the `emacs-vterm` Emacs package requires compilation of its C components, which includes the gcc compiler and the `libvterm` library. On Debian or Ubuntu systems, the necessary packages can be installed with: `sudo apt-get install build-essential libvterm-dev libtool-bin cmake`) +### 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. + +The default undo system in Emacs has two main issues that undo-fu fixes: + +1. **Redo requires two steps**: To redo an action after undoing, you need to press a key twice, which can be annoying and inefficient. +2. **Accidental over-redo**: When redoing, it's easy to go too far back, past the point where you started the undo, which makes it hard to return to the exact state you wanted to restore. + +To install and configure these packages, add the following to `~/.emacs.d/post-init.el`: +```emacs-lisp +;; The undo-fu package is a lightweight wrapper around Emacs' built-in undo +;; system, providing more convenient undo/redo functionality. +(use-package undo-fu + :defer t + :commands (undo-fu-only-undo + undo-fu-only-redo + undo-fu-only-redo-all + undo-fu-disable-checkpoint) + :config + (global-unset-key (kbd "C-z")) + (global-set-key (kbd "C-z") 'undo-fu-only-undo) + (global-set-key (kbd "C-S-z") 'undo-fu-only-redo)) + +;; The undo-fu-session package complements undo-fu by enabling the saving +;; and restoration of undo history across Emacs sessions, even after restarting. +(use-package undo-fu-session + :defer t + :commands undo-fu-session-global-mode + :hook (after-init . undo-fu-session-global-mode)) +``` + ### Configuring Vim keybindings using Evil? Configuring Vim keybindings in Emacs can greatly enhance your editing efficiency if you are accustomed to Vim's modal editing style. Add the following to `~/.emacs.d/post-init.el` to set up Evil mode: @@ -530,10 +563,12 @@ Configuring Vim keybindings in Emacs can greatly enhance your editing efficiency ;; evil-want-keybinding must be declared before Evil and Evil Collection (setq evil-want-keybinding nil) +;; Vim emulation (use-package evil :ensure t :init - (setq evil-undo-system 'undo-fu) + ;; Uncomment the following if you are using undo-fu + ;; (setq evil-undo-system 'undo-fu) (setq evil-want-integration t) (setq evil-want-keybinding nil) :custom @@ -548,22 +583,11 @@ Configuring Vim keybindings in Emacs can greatly enhance your editing efficiency :config (evil-collection-init)) -(use-package undo-fu - :ensure t - :commands (undo-fu-only-undo - undo-fu-only-redo - undo-fu-only-redo-all - undo-fu-disable-checkpoint)) - -(use-package undo-fu-session - :ensure t - :config - (undo-fu-session-global-mode)) - ``` You can also use the [vim-tab-bar](https://github.com/jamescherti/vim-tab-bar.el) Emacs package to `~/.emacs.d/post-init.el` to give the built-in Emacs tab-bar a style similar to Vim's tabbed browsing interface: ``` emacs-lisp +;; Give Emacs tab-bar a style similar to Vim's (use-package vim-tab-bar :ensure t :commands vim-tab-bar-mode