Last active
May 5, 2021 19:43
-
-
Save Dima-369/14f1d5c53fdcce083e95aab6c92fbada to your computer and use it in GitHub Desktop.
Old avy config (with tuned avy-goto-char-timer-own which restarts on no matches like on typos) in Emacs Lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; this should better be handled via (advice-add) | |
(defun avy-handler-default (char) | |
"The default handler for a bad CHAR." | |
(let (dispatch) | |
(cond ((setq dispatch (assoc char avy-dispatch-alist)) | |
(unless (eq avy-style 'words) | |
(setq avy-action (cdr dispatch))) | |
(throw 'done 'restart)) | |
((memq char avy-escape-chars) | |
(setq avy-cancelled-via-escape t) | |
;; exit silently | |
(throw 'done 'abort)) | |
((eq char ??) | |
(avy-show-dispatch-help) | |
(throw 'done 'restart)) | |
((mouse-event-p char) | |
(signal 'user-error (list "Mouse event not handled" char))) | |
(t | |
(message "No such candidate: %s, hit `C-g' to quit." | |
(if (characterp char) (string char) char)))))) | |
(defun avy-goto-char-timer-own-inner (p) | |
;; avy-cancelled-via-escape does not work, but the restart is nice on typos | |
(setq avy-cancelled-via-escape nil) | |
(call-interactively #'avy-goto-char-timer) | |
(when (and | |
(not avy-cancelled-via-escape) | |
(= p (point))) | |
(avy-goto-char-timer-own-inner p))) | |
(defun avy-goto-char-timer-own () | |
(interactive) | |
(lc-record-change) | |
(avy-goto-char-timer-own-inner (point))) | |
;; only using (avy-goto-char-timer-own) | |
(use-package avy | |
:config | |
(setq | |
avy-style 'de-bruijn | |
avy-background t | |
avy-timeout-seconds 0.51 | |
avy-keys '( | |
?o ?e ?u ?h ?t ?n ; home row for Programmer Dvorak | |
?c | |
?d | |
?f | |
?g | |
?i | |
?j | |
?k | |
?m | |
?p | |
?q | |
?r | |
?v | |
?w | |
?z))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment