diff --git a/ace-link.el b/ace-link.el index 70d1721..ca303bf 100644 --- a/ace-link.el +++ b/ace-link.el @@ -648,6 +648,32 @@ call at PT." (push (point) candidates)))) (nreverse candidates))) +;;*`ace-link-button' +(defun ace-link--button-collect () + "Return a list of button positions." + (let (candidates pt) + (save-excursion + (goto-char (window-start)) + (setq pt (point)) + (when-let ((first-button (forward-button 0 nil nil t))) + (setq pt (point)) + (push (point) candidates)) + (while (and (forward-button 1 nil nil t) + (> (point) pt)) + (setq pt (point)) + (push (point) candidates))) + (nreverse candidates))) + +;;;###autoload +(defun ace-link-button () + "Open or go to a visible button." + (interactive) + (let ((res (avy-with ace-link-button + (avy-process + (ace-link--button-collect) + (avy--style-fn avy-style))))) + (push-button res))) + ;;* `ace-link-org' ;;;###autoload (defun ace-link-org () @@ -1053,6 +1079,8 @@ call at PT." '(ace-link-sldb . pre)) (add-to-list 'avy-styles-alist '(ace-link-slime-xref . pre)) + (add-to-list 'avy-styles-alist + '(ace-link-button . pre)) (add-to-list 'avy-styles-alist '(ace-link-slime-inspector . pre)) (eval-after-load "xref" @@ -1091,6 +1119,9 @@ call at PT." (eval-after-load "indium-debugger" `(progn (define-key indium-debugger-frames-mode-map ,key 'ace-link-indium-debugger-frames))) + (eval-after-load "dictionary" + `(progn + (define-key dictionary-mode-map ,key 'ace-link-button))) (eval-after-load "cider-inspector" `(progn (define-key cider-inspector-mode-map ,key 'ace-link-cider-inspector))))