summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-27 19:04:16 +0000
committerjao <jao@gnu.org>2022-01-27 19:05:15 +0000
commit0b8f339d25300909b77b15945b309f5931253120 (patch)
tree5d947f4f1beb873824e8896db9edb292ea5d97f4
parent317f90a036c996bce5bed5cb15f606e8fd8f8a09 (diff)
downloadelibs-0b8f339d25300909b77b15945b309f5931253120.tar.gz
elibs-0b8f339d25300909b77b15945b309f5931253120.tar.bz2
clean-ups for avy/link-hint
-rw-r--r--attic/misc.org19
-rw-r--r--completion.org52
-rw-r--r--notmuch.org22
3 files changed, 47 insertions, 46 deletions
diff --git a/attic/misc.org b/attic/misc.org
index b9fdbfb..11f6162 100644
--- a/attic/misc.org
+++ b/attic/misc.org
@@ -1014,3 +1014,22 @@
;; pdf-view-next-line-or-next-page))
;; (advice-add f :after #'jao--refresh))
#+end_src
+* link-hint for w3m
+ #+begin_src emacs-lisp
+ (defun jao-link-hint--notmuch-next-url (&optional bound)
+ (link-hint--next-property 'w3m-href-anchor bound))
+
+ (defun jao-link-hint--notmuch-url-at-point ()
+ (get-text-property (point) 'w3m-href-anchor))
+
+ (link-hint-define-type 'notmuch-w3m-url
+ :next #'jao-link-hint--notmuch-next-url
+ :at-point-p #'jao-link-hint--notmuch-url-at-point
+ :vars '(notmuch-show-mode)
+ :open #'browse-url
+ :open-multiple t
+ :copy #'kill-new)
+
+ (push 'link-hint-notmuch-w3m-url link-hint-types)
+
+ #+end_src
diff --git a/completion.org b/completion.org
index bd5f1b3..c907a93 100644
--- a/completion.org
+++ b/completion.org
@@ -507,7 +507,6 @@
* avy and link hints
[[https://karthinks.com/software/avy-can-do-anything/][Avy can do anything | Karthinks]]
#+begin_src emacs-lisp
-
(use-package avy
:ensure t
:init (setq avy-style 'pre
@@ -517,21 +516,6 @@
:config
- (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 (("s-j" . avy-goto-char-timer)))
-
- (use-package link-hint
- :ensure t
- :init (setq link-hint-avy-style 'pre)
-
- :config
-
(defun avy-embark-act (pt)
"Use Embark to act on the completion at PT."
(save-excursion
@@ -544,40 +528,16 @@
(let ((unread-command-events '(?\;)))
(link-hint-open-link)))
- (defun jao-link-hint--notmuch-next-part (&optional bound)
- (when-let (p (next-single-property-change (point) :notmuch-part nil bound))
- (and (< p (or bound (point-max))) p)))
-
- (defun jao-link-hint--notmuch-part-p ()
- (and (get-text-property (point) :notmuch-part)
- (when-let (b (button-at (point))) (button-label b))))
-
- (link-hint-define-type 'notmuch-part
- :next #'jao-link-hint--notmuch-next-part
- :at-point-p #'jao-link-hint--notmuch-part-p
- :vars '(notmuch-show-mode)
- :open #'push-button
- :open-message "Toggled"
- :open-multiple t)
-
- (defun jao-link-hint--notmuch-next-url (&optional bound)
- (link-hint--next-property 'w3m-href-anchor bound))
-
- (defun jao-link-hint--notmuch-url-at-point ()
- (get-text-property (point) 'w3m-href-anchor))
+ :bind (("s-j" . avy-goto-char-timer)))
- (link-hint-define-type 'notmuch-w3m-url
- :next #'jao-link-hint--notmuch-next-url
- :at-point-p #'jao-link-hint--notmuch-url-at-point
- :vars '(notmuch-show-mode)
- :open #'browse-url
- :open-multiple t
- :copy #'kill-new)
+ (use-package link-hint
+ :ensure t
+ :init (setq link-hint-avy-style 'pre)
- (push 'link-hint-notmuch-part link-hint-types)
- (push 'link-hint-notmuch-w3m-url link-hint-types)
+ :config
:bind (("C-l" . link-hint-open-link)
("C-S-l" . recenter-top-bottom)))
#+end_src
+* link hints
diff --git a/notmuch.org b/notmuch.org
index a0fb99f..d433ecb 100644
--- a/notmuch.org
+++ b/notmuch.org
@@ -591,3 +591,25 @@
(with-eval-after-load "notmuch-hello"
(define-key notmuch-hello-mode-map "f" #'jao-consult-notmuch-folder))
#+end_src
+* link hint
+ #+begin_src emacs-lisp
+ (with-eval-after-load "link-hint"
+ (defun jao-link-hint--notmuch-next-part (&optional bound)
+ (when-let (p (next-single-property-change (point) :notmuch-part nil bound))
+ (and (< p (or bound (point-max))) p)))
+
+ (defun jao-link-hint--notmuch-part-p ()
+ (and (get-text-property (point) :notmuch-part)
+ (when-let (b (button-at (point))) (button-label b))))
+
+ (link-hint-define-type 'notmuch-part
+ :next #'jao-link-hint--notmuch-next-part
+ :at-point-p #'jao-link-hint--notmuch-part-p
+ :vars '(notmuch-show-mode)
+ :open #'push-button
+ :open-message "Toggled"
+ :open-multiple t)
+
+ (push 'link-hint-notmuch-part link-hint-types))
+
+ #+end_src