Replacing ace-link with link-hint

As it seems to do the same thing, but has slightly more link refs.
This commit is contained in:
Howard Abrams 2022-04-29 10:28:11 -07:00
parent e025c0d31a
commit 7900ed9564
3 changed files with 48 additions and 16 deletions

View file

@ -889,7 +889,6 @@ Let's make Info behave a little more VI-like:
:straight (:type built-in) :straight (:type built-in)
:general :general
(:states 'normal :keymaps 'Info-mode-map (:states 'normal :keymaps 'Info-mode-map
"o" 'ace-link-info
"B" 'Info-bookmark-jump "B" 'Info-bookmark-jump
"Y" 'org-store-link "Y" 'org-store-link
"H" 'Info-history-back "H" 'Info-history-back
@ -1013,6 +1012,27 @@ While I grew up on =Control S=, I am liking the /mental model/ associated with t
:bind ("<f18>" . avy-goto-char-timer)) :bind ("<f18>" . avy-goto-char-timer))
#+END_SRC #+END_SRC
*Note:* The links should be shorter near the point as opposed to starting from the top of the window. *Note:* The links should be shorter near the point as opposed to starting from the top of the window.
** Link Hint, the Link Jumper
I originally appreciated [[https://github.com/abo-abo/ace-link][ace-link]] to work with hyperlinks on Org, EWW and Info pages, however, the [[https://github.com/noctuid/link-hint.el][link-hint]] project works with more types of links:
#+BEGIN_SRC emacs-lisp
(use-package link-hint
:bind
("s-o" . link-hint-open-link)
("C-c l o" . link-hint-open-link)
("C-c l c" . link-hint-copy-link)
:general
(:states 'normal :keymaps 'eww-mode-map
"o" 'link-hint-open-link)
(:states 'normal :keymaps 'Info-mode-map
"o" 'link-hint-open-link)
:config
(evil-define-key '(normal) global-map
"gl" #'link-hint-open-link
"gL" #'link-hint-copy-link))
#+END_SRC
** Miscellaneous Keys ** Miscellaneous Keys
I really appreciated the [[https://github.com/benma/visual-regexp.el][visual-regexp package]]: I really appreciated the [[https://github.com/benma/visual-regexp.el][visual-regexp package]]:
@ -1384,7 +1404,6 @@ Web pages look pretty good with EWW, but I'm having difficulty getting it to ren
:general :general
(:states 'normal :keymaps 'eww-mode-map (:states 'normal :keymaps 'eww-mode-map
"o" 'ace-link-eww
"B" 'eww-list-bookmarks "B" 'eww-list-bookmarks
"Y" 'eww-copy-page-url "Y" 'eww-copy-page-url
"H" 'eww-back-url "H" 'eww-back-url
@ -1397,11 +1416,31 @@ Web pages look pretty good with EWW, but I'm having difficulty getting it to ren
"q" 'eww-buffer-kill)) "q" 'eww-buffer-kill))
#+END_SRC #+END_SRC
And let's get [[https://github.com/abo-abo/ace-link][ace-link]] to work with EWW and Info pages: This function allows Imenu to offer HTML headings in EWW buffers, which is especially helpful for navigating long, technical documents.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package ace-link (use-package eww
:config :config
(ace-link-setup-default)) (defun unpackaged/imenu-eww-headings ()
"Return alist of HTML headings in current EWW buffer for Imenu.
Suitable for `imenu-create-index-function'."
(let ((faces '(shr-h1 shr-h2 shr-h3 shr-h4 shr-h5 shr-h6 shr-heading)))
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(cl-loop for next-pos = (next-single-property-change (point) 'face)
while next-pos
do (goto-char next-pos)
for face = (get-text-property (point) 'face)
when (cl-typecase face
(list (cl-intersection face faces))
(symbol (member face faces)))
collect (cons (buffer-substring (point-at-bol) (point-at-eol)) (point))
and do (forward-line 1))))))
:hook (eww-mode .
(lambda ()
(setq-local imenu-create-index-function #'unpackaged/imenu-eww-headings))))
#+END_SRC #+END_SRC
*** Get Pocket *** Get Pocket
The [[https://github.com/alphapapa/pocket-reader.el][pocket-reader]] project connects to the [[https://getpocket.com/en/][Get Pocket]] service. The [[https://github.com/alphapapa/pocket-reader.el][pocket-reader]] project connects to the [[https://getpocket.com/en/][Get Pocket]] service.

View file

@ -37,10 +37,10 @@ While I would like to share the /status/ of my reads, so ...
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package elfeed (use-package elfeed
:after (link-hint)
:config :config
(setq elfeed-db-directory "~/dropbox/.elfeed/") (setq elfeed-db-directory "~/dropbox/.elfeed/")
(evil-define-key 'normal elfeed-show-mode-map (kbd "b") 'elfeed-show-visit) (evil-define-key 'normal elfeed-show-mode-map (kbd "b") 'elfeed-show-visit)
(evil-define-key 'normal elfeed-show-mode-map (kbd "o") 'ace-link)
(evil-define-key 'normal elfeed-show-mode-map (kbd "n") 'elfeed-show-next) (evil-define-key 'normal elfeed-show-mode-map (kbd "n") 'elfeed-show-next)
(evil-define-key 'normal elfeed-show-mode-map (kbd "p") 'elfeed-show-prev) (evil-define-key 'normal elfeed-show-mode-map (kbd "p") 'elfeed-show-prev)
(evil-define-key 'normal elfeed-show-mode-map (kbd "y") 'elfeed-show-yank) (evil-define-key 'normal elfeed-show-mode-map (kbd "y") 'elfeed-show-yank)
@ -51,6 +51,9 @@ While I would like to share the /status/ of my reads, so ...
(evil-define-key 'normal elfeed-search-mode-map (kbd "u") 'elfeed-update) (evil-define-key 'normal elfeed-search-mode-map (kbd "u") 'elfeed-update)
(evil-define-key 'normal elfeed-search-mode-map (kbd "U") 'elfeed-unjam) (evil-define-key 'normal elfeed-search-mode-map (kbd "U") 'elfeed-unjam)
;; This is why this package depends on link-hint:
(evil-define-key 'normal elfeed-show-mode-map (kbd "o") 'link-hint-open-link)
;; And let's make the Space pull of my general leader: ;; And let's make the Space pull of my general leader:
(general-unbind elfeed-show-mode-map "SPC") (general-unbind elfeed-show-mode-map "SPC")
(general-unbind elfeed-search-mode-map "SPC") (general-unbind elfeed-search-mode-map "SPC")

View file

@ -464,7 +464,6 @@ Bindings specific to org files:
"I" '("insert id" . org-id-get-create) "I" '("insert id" . org-id-get-create)
"l" '("insert link" . org-insert-link) "l" '("insert link" . org-insert-link)
"N" '("store link" . org-store-link) "N" '("store link" . org-store-link)
"o" '("goto link" . ace-link-org)
"P" '("set property" . org-set-property) "P" '("set property" . org-set-property)
"q" '("set tags" . org-set-tags-command) "q" '("set tags" . org-set-tags-command)
"t" '("todo" . org-todo) "t" '("todo" . org-todo)
@ -512,15 +511,6 @@ Bindings specific to org files:
"n e" '("element" . org-narrow-to-element) "n e" '("element" . org-narrow-to-element)
"n w" '("widen" . widen)) "n w" '("widen" . widen))
#+END_SRC #+END_SRC
Oh, and we'll use [[https://github.com/abo-abo/ace-link][ace-link]] for jumping:
#+BEGIN_SRC emacs-lisp
(use-package ace-link
:after org
:config
(define-key org-mode-map (kbd "s-o") 'ace-link-org))
#+END_SRC
* Supporting Packages * Supporting Packages
** Exporters ** Exporters
Limit the number of exporters to the ones that I would use: Limit the number of exporters to the ones that I would use: