From 347008024ac3c671570309e4379a1079271124e5 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 17 Dec 2021 18:30:41 -0600 Subject: Advise vertico --- init.el | 2 ++ lisp/+vertico.el | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 lisp/+vertico.el 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'." :repo "minad/vertico" :files ("*" "extensions/*" (:exclude ".git")))) + (:also-load +vertico) (:option resize-mini-windows 'grow-only vertico-count-format nil vertico-cycle t) + (advice-add 'vertico-next :around '+vertico-ding-wrap) (when (boundp 'native-comp-deferred-compilation-deny-list) (add-to-list 'native-comp-deferred-compilation-deny-list "vertico")) (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 @@ +;;; +vertico.el -*- lexical-binding: t; -*- + +;;; Code: + +;; https://old.reddit.com/r/emacs/comments/rbmfwk/weekly_tips_tricks_c_thread/hof7rz7/ +;; Add this advice to `vertico-next'. +;; Takes care of `vertico-previous' as well, since it calls `vertico-next'. +(defun +vertico-ding-wrap (origin &rest args) + "ADVICE to wrap `vertico-next': ding when wrapping." + (let ((beg-index vertico--index)) + (apply origin args) + (unless (eq 1 (abs (- beg-index vertico--index))) + (ding)))) + +(provide '+vertico) +;;; +vertico.el ends here -- cgit 1.4.1-21-gabe81