From d7f5fcb5afccb68b3ffd11b32d9e7ff6914c5375 Mon Sep 17 00:00:00 2001 From: Thanh Date: Wed, 27 Nov 2024 21:39:57 -0700 Subject: [PATCH 1/2] add ace-link-button and use it in dictionary-mode --- ace-link.el | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ace-link.el b/ace-link.el index 70d1721..c719f7f 100644 --- a/ace-link.el +++ b/ace-link.el @@ -648,6 +648,31 @@ 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))) + +(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 +1078,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 +1118,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)))) From 2426146eda62911d1eabdb04a0abb59c0df3fd9e Mon Sep 17 00:00:00 2001 From: Thanh Vuong Date: Sat, 30 Nov 2024 21:53:40 -0700 Subject: [PATCH 2/2] add autoload --- ace-link.el | 1 + 1 file changed, 1 insertion(+) diff --git a/ace-link.el b/ace-link.el index c719f7f..ca303bf 100644 --- a/ace-link.el +++ b/ace-link.el @@ -664,6 +664,7 @@ call at PT." (push (point) candidates))) (nreverse candidates))) +;;;###autoload (defun ace-link-button () "Open or go to a visible button." (interactive)