summary refs log tree commit diff stats
path: root/lisp/+vertico.el
blob: d4fb3a367d58a4fe1989a8ec03c2e6b89ce9e22a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;;; +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))))

(defun +vertico-widen-or-complete ()
  (interactive)
  (if (or vertico-unobtrusive-mode
          vertico-flat-mode)
      (progn (vertico-unobtrusive-mode -1)
             (vertico-flat-mode -1))
    (call-interactively #'vertico-insert)))

(provide '+vertico)
;;; +vertico.el ends here