diff options
author | Case Duckworth | 2021-12-17 18:30:41 -0600 |
---|---|---|
committer | Case Duckworth | 2021-12-17 18:30:41 -0600 |
commit | 347008024ac3c671570309e4379a1079271124e5 (patch) | |
tree | 932c8c321c59f8c456cd4d64a0342db362b82e2d | |
parent | Add minibuffer stuff (diff) | |
download | emacs-347008024ac3c671570309e4379a1079271124e5.tar.gz emacs-347008024ac3c671570309e4379a1079271124e5.zip |
Advise vertico
-rw-r--r-- | init.el | 2 | ||||
-rw-r--r-- | lisp/+vertico.el | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/init.el b/init.el index ff686a5..1c4d8e7 100644 --- a/init.el +++ b/init.el | |||
@@ -755,9 +755,11 @@ See also `crux-reopen-as-root-mode'." | |||
755 | :repo "minad/vertico" | 755 | :repo "minad/vertico" |
756 | :files ("*" "extensions/*" | 756 | :files ("*" "extensions/*" |
757 | (:exclude ".git")))) | 757 | (:exclude ".git")))) |
758 | (:also-load +vertico) | ||
758 | (:option resize-mini-windows 'grow-only | 759 | (:option resize-mini-windows 'grow-only |
759 | vertico-count-format nil | 760 | vertico-count-format nil |
760 | vertico-cycle t) | 761 | vertico-cycle t) |
762 | (advice-add 'vertico-next :around '+vertico-ding-wrap) | ||
761 | (when (boundp 'native-comp-deferred-compilation-deny-list) | 763 | (when (boundp 'native-comp-deferred-compilation-deny-list) |
762 | (add-to-list 'native-comp-deferred-compilation-deny-list "vertico")) | 764 | (add-to-list 'native-comp-deferred-compilation-deny-list "vertico")) |
763 | (vertico-mode +1) | 765 | (vertico-mode +1) |
diff --git a/lisp/+vertico.el b/lisp/+vertico.el new file mode 100644 index 0000000..4adde3d --- /dev/null +++ b/lisp/+vertico.el | |||
@@ -0,0 +1,16 @@ | |||
1 | ;;; +vertico.el -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; Code: | ||
4 | |||
5 | ;; https://old.reddit.com/r/emacs/comments/rbmfwk/weekly_tips_tricks_c_thread/hof7rz7/ | ||
6 | ;; Add this advice to `vertico-next'. | ||
7 | ;; Takes care of `vertico-previous' as well, since it calls `vertico-next'. | ||
8 | (defun +vertico-ding-wrap (origin &rest args) | ||
9 | "ADVICE to wrap `vertico-next': ding when wrapping." | ||
10 | (let ((beg-index vertico--index)) | ||
11 | (apply origin args) | ||
12 | (unless (eq 1 (abs (- beg-index vertico--index))) | ||
13 | (ding)))) | ||
14 | |||
15 | (provide '+vertico) | ||
16 | ;;; +vertico.el ends here | ||