Skip to content

Commit

Permalink
Add prelude-undo-tree custom variable (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryukinix authored Jan 20, 2025
1 parent 3c74db9 commit 7ab5023
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* Replace prelude-go backend with `lsp` instead of unmaintained tools.
* Use `rust-analyzer` as language server for prelude-rust and provide nicer syntax highlighting with `tree-sitter`.
* Use `js2-mode` for Node.js specific `.cjs` and `.mjs` extensions.
* Add `prelude-undo-tree` custom variable: allows user disable
undo-tree integration. Enabled by default to maintain backward-compatibility.

### Bugs fixed

Expand Down
5 changes: 5 additions & 0 deletions core/prelude-custom.el
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ or desktop environments that make heavy use of them."
:type 'boolean
:group 'prelude)

(defcustom prelude-undo-tree t
"Non-nil values enable Prelude's undo-tree integration."
:type 'boolean
:group 'prelude)

(defcustom prelude-clean-whitespace-on-save t
"Cleanup whitespace from file before it's saved.
Will only occur if `prelude-whitespace' is also enabled."
Expand Down
22 changes: 14 additions & 8 deletions core/prelude-editor.el
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,20 @@ indent yanked text (with prefix arg don't indent)."
;; enable Prelude's keybindings
(prelude-mode t)

;; supercharge your undo/redo with undo-tree
(require 'undo-tree)
;; autosave the undo-tree history
(setq undo-tree-history-directory-alist
`((".*" . ,temporary-file-directory)))
(setq undo-tree-auto-save-history t)
(global-undo-tree-mode)
(diminish 'undo-tree-mode)
(defun prelude-maybe-enable-undo-tree ()
"Enable `undo-tree' if `prelude-undo-tree' is not nil."
(when prelude-undo-tree
;; supercharge your undo/redo with undo-tree
(require 'undo-tree)
;; autosave the undo-tree history
(setq undo-tree-history-directory-alist
`((".*" . ,temporary-file-directory)))
(setq undo-tree-auto-save-history t)
(global-undo-tree-mode)
(diminish 'undo-tree-mode)))


(prelude-maybe-enable-undo-tree)

;; enable winner-mode to manage window configurations
(winner-mode +1)
Expand Down

0 comments on commit 7ab5023

Please sign in to comment.