Skip to content

Commit 7ab5023

Browse files
authored
Add prelude-undo-tree custom variable (#1428)
1 parent 3c74db9 commit 7ab5023

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* Replace prelude-go backend with `lsp` instead of unmaintained tools.
2525
* Use `rust-analyzer` as language server for prelude-rust and provide nicer syntax highlighting with `tree-sitter`.
2626
* Use `js2-mode` for Node.js specific `.cjs` and `.mjs` extensions.
27+
* Add `prelude-undo-tree` custom variable: allows user disable
28+
undo-tree integration. Enabled by default to maintain backward-compatibility.
2729

2830
### Bugs fixed
2931

core/prelude-custom.el

+5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ or desktop environments that make heavy use of them."
6666
:type 'boolean
6767
:group 'prelude)
6868

69+
(defcustom prelude-undo-tree t
70+
"Non-nil values enable Prelude's undo-tree integration."
71+
:type 'boolean
72+
:group 'prelude)
73+
6974
(defcustom prelude-clean-whitespace-on-save t
7075
"Cleanup whitespace from file before it's saved.
7176
Will only occur if `prelude-whitespace' is also enabled."

core/prelude-editor.el

+14-8
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,20 @@ indent yanked text (with prefix arg don't indent)."
358358
;; enable Prelude's keybindings
359359
(prelude-mode t)
360360

361-
;; supercharge your undo/redo with undo-tree
362-
(require 'undo-tree)
363-
;; autosave the undo-tree history
364-
(setq undo-tree-history-directory-alist
365-
`((".*" . ,temporary-file-directory)))
366-
(setq undo-tree-auto-save-history t)
367-
(global-undo-tree-mode)
368-
(diminish 'undo-tree-mode)
361+
(defun prelude-maybe-enable-undo-tree ()
362+
"Enable `undo-tree' if `prelude-undo-tree' is not nil."
363+
(when prelude-undo-tree
364+
;; supercharge your undo/redo with undo-tree
365+
(require 'undo-tree)
366+
;; autosave the undo-tree history
367+
(setq undo-tree-history-directory-alist
368+
`((".*" . ,temporary-file-directory)))
369+
(setq undo-tree-auto-save-history t)
370+
(global-undo-tree-mode)
371+
(diminish 'undo-tree-mode)))
372+
373+
374+
(prelude-maybe-enable-undo-tree)
369375

370376
;; enable winner-mode to manage window configurations
371377
(winner-mode +1)

0 commit comments

Comments
 (0)