From d8e60ed296861200283772db606ad72d9b9fae8a Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 26 Oct 2021 21:57:43 +0100 Subject: link-hints improvements (dictionary action) --- completion.org | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'completion.org') diff --git a/completion.org b/completion.org index 41331e1..1e0bb4b 100644 --- a/completion.org +++ b/completion.org @@ -324,6 +324,10 @@ (require 'embark-consult))) #+end_src +*** dict + #+begin_src emacs-lisp + (define-key embark-identifier-map "D" #'dictionary-search) + #+end_src *** org targets #+begin_src emacs-lisp (declare-function org-link-any-re "ol") @@ -441,7 +445,7 @@ (add-to-list 'embark-keymap-alist '(spotify-search-item . spotify-item-keymap))) #+end_src -* avy link hints +* avy and link hints [[https://karthinks.com/software/avy-can-do-anything/][Avy can do anything | Karthinks]] #+begin_src emacs-lisp @@ -460,6 +464,13 @@ (embark-act))) (add-to-list 'avy-dispatch-alist '(?\; . avy-embark-act)) + (defun avy-dictionary-act (pt) + "Use dictionary lookup to act on the completion at PT." + (save-excursion + (goto-char pt) + (dictionary-lookup-definition))) + (add-to-list 'avy-dispatch-alist '(?d . avy-dictionary-act)) + :bind ("C-c a" . avy-goto-char-timer)) (use-package link-hint @@ -479,7 +490,7 @@ (defun jao-link-hint--notmuch-part-p () (and (get-text-property (point) :notmuch-part) - (button-label (button-at (point))))) + (when-let (b (button-at (point))) (button-label b)))) (link-hint-define-type 'notmuch-part :next #'jao-link-hint--notmuch-next-part -- cgit v1.2.3