Skip to content

Commit bcf911c

Browse files
spdawsonbbatsov
authored andcommitted
feat(customisation): Make hippie-expand configuration optional
Add a new `prelude-hippie-expand` user option, so that integration with `hippie-expand` can optionally be disabled. This is enabled by default, but it can be useful to turn this off -- for example, if one wishes instead to use Emacs' `dabbrev` for dynamic expansion.
1 parent e9bf78d commit bcf911c

File tree

6 files changed

+31
-13
lines changed

6 files changed

+31
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [#1421](https://github.com/bbatsov/prelude/issues/1421): Make it possible to configure the TypeScript format action using `prelude-ts-format-action`.
1717
- [#1354](https://github.com/bbatsov/prelude/issues/1354): Remove default `C--` and `C-+` keybindings to increase/decrease the font size.
1818
- Add `prelude-projectile` user option, allowing Projectile integration to be disabled.
19+
- Add `prelude-hippie-expand` user option, allowing hippie-expand support to be disabled.
1920

2021
### Changes
2122

core/prelude-custom.el

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ Only modes that don't derive from `prog-mode' should be listed here."
127127
:type 'boolean
128128
:group 'prelude)
129129

130+
(defcustom prelude-hippie-expand t
131+
"Non-nil values enable Prelude's hippie-expand support."
132+
:type 'boolean
133+
:group 'prelude)
134+
130135
(provide 'prelude-custom)
131136

132137
;;; prelude-custom.el ends here

core/prelude-editor.el

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,17 @@
5959
(global-auto-revert-mode t)
6060

6161
;; hippie expand is dabbrev expand on steroids
62-
(setq hippie-expand-try-functions-list '(try-expand-dabbrev
63-
try-expand-dabbrev-all-buffers
64-
try-expand-dabbrev-from-kill
65-
try-complete-file-name-partially
66-
try-complete-file-name
67-
try-expand-all-abbrevs
68-
try-expand-list
69-
try-expand-line
70-
try-complete-lisp-symbol-partially
71-
try-complete-lisp-symbol))
62+
(when prelude-hippie-expand
63+
(setq hippie-expand-try-functions-list '(try-expand-dabbrev
64+
try-expand-dabbrev-all-buffers
65+
try-expand-dabbrev-from-kill
66+
try-complete-file-name-partially
67+
try-complete-file-name
68+
try-expand-all-abbrevs
69+
try-expand-list
70+
try-expand-line
71+
try-complete-lisp-symbol-partially
72+
try-complete-lisp-symbol)))
7273

7374
;; smart tab behavior - indent or complete
7475
(setq tab-always-indent 'complete)

core/prelude-global-keybindings.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@
8181
;; Activate occur easily inside isearch
8282
(define-key isearch-mode-map (kbd "C-o") 'isearch-occur)
8383

84-
;; use hippie-expand instead of dabbrev
85-
(global-set-key (kbd "M-/") 'hippie-expand)
84+
(when prelude-hippie-expand
85+
;; use hippie-expand instead of dabbrev
86+
(global-set-key (kbd "M-/") 'hippie-expand))
8687

8788
;; replace buffer-menu with ibuffer
8889
(global-set-key (kbd "C-x C-b") 'ibuffer)

core/prelude-mode.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
(define-key map (kbd "s-m l") 'magit-log-buffer-file)
8585
(define-key map (kbd "s-m b") 'magit-blame)
8686
;; misc
87-
(define-key map (kbd "s-/") 'hippie-expand))
87+
(when prelude-hippie-expand
88+
(define-key map (kbd "s-/") 'hippie-expand)))
8889
(easy-menu-define prelude-mode-menu map
8990
"Prelude's menu."
9091
'("Prelude"

docs/configuration.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ interaction. To disable this, add the following to your config.
185185
(setq prelude-projectile nil)
186186
```
187187

188+
### Disable hippie-expand
189+
190+
By default, Prelude configures `hippie-expand` as a replacement for Emacs' default `dabbrev`. To disable this
191+
behaviour, add the following to your config.
192+
193+
``` emacs-lisp
194+
(setq prelude-hippie-expand nil)
195+
```
196+
188197
### Configuration per file or directory
189198

190199
Some of these settings (those that don't need to be pre-loaded) can also be set

0 commit comments

Comments
 (0)