Use embark-dwim instead of goto-addr

This commit is contained in:
Gerard Vermeulen 2022-04-20 05:35:28 +02:00
parent 2c6c7f9170
commit 5412a8c482

View File

@ -878,10 +878,16 @@ Listing [[lst:configure-orderless]] configures [[info:orderless#Company][orderle
:CUSTOM_ID: sec:embark-configuration :CUSTOM_ID: sec:embark-configuration
:END: :END:
Listing [[lst:configure-embark]] configures =embark= key bindings: type for instance Listing [[lst:configure-embark]] configures =embark= key bindings:
{{{kbd(C-x C-h)}}} or {{{kbd(C-c C-h)}}} that the initialization 1. Except for highlighting of email and web URLs, =embark-dwim= englobes the
src_emacs-lisp{(setq prefix-help-command #'embark-prefix-help-command)} enables functionality of src_emacs-lisp{(find-library "goto-addr")} that activates
minibuffer help after a prefix key. mail and web URLs to turn them into clickable buttons. Since =embark-dwim=
acts on a superset of target types, it renders =goto-addr= superfluous. See:
1. [[info:emacs#Goto Address mode][Goto Address mode (info)]].
2. [[info:embark#The default action on a target][The default (embark-dwim) action on a target (info)]].
2. The initialization src_emacs-lisp{(setq prefix-help-command
#'embark-prefix-help-command)} enables minibuffer help after a prefix key as
typing {{{kbd(C-x C-h)}}} or {{{kbd(C-c C-h)}}} shows.
#+caption[Configure =embark=]: #+caption[Configure =embark=]:
#+caption: Configure =embark=. #+caption: Configure =embark=.
@ -3445,42 +3451,6 @@ Listing [[lst:configure-browse-url]] configures =browse-url=.
(add-hook 'eww-after-render-hook #'eww-rename-buffer)) (add-hook 'eww-after-render-hook #'eww-rename-buffer))
#+end_src #+end_src
*** [[info:emacs#Goto Address mode][Goto address mode (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:goto-address-mode
:END:
Listing [[lst:configure-goto-address-mode]]:
1. Enables =goto-address-prog-mode= for programming modes and
=goto-address-mode= for a selection of other modes.
2. Defines a function to toggle =goto-address-prog-mode= for programming modes
and =goto-address-mode= for other modes.
3. Binds {{{kbd(C-c C-o)}}} to =goto-address-at-point= in
=goto-address-highlight-keymap=.
#+caption[Configure =goto-address-mode=]:
#+caption: Configure =goto-address-mode=.
#+name: lst:configure-goto-address-mode
#+begin_src emacs-lisp
(when (cl-every #'fboundp '(goto-address-mode goto-address-prog-mode))
(defun toggle-goto-address-dwim-mode ()
"Toggle `goto-address-mode' or `goto-address-prog-mode' smartly.
In case of `prog-mode', toggle the latter, else the former."
(interactive)
(if (derived-mode-p 'prog-mode)
(call-interactively #'goto-address-prog-mode)
(call-interactively #'goto-address-mode)))
(dolist (hook '(eshell-mode-hook shell-mode-hook org-mode-hook))
(add-hook hook #'goto-address-mode))
(add-hook 'prog-mode-hook #'goto-address-prog-mode)
(with-eval-after-load 'goto-addr
(define-key goto-address-highlight-keymap
(kbd "C-c C-o") #'goto-address-at-point)))
#+end_src
*** [[https://en.wikipedia.org/wiki/Media_type#Mailcap][Mailcap]] *** [[https://en.wikipedia.org/wiki/Media_type#Mailcap][Mailcap]]
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: sec:mailcap :CUSTOM_ID: sec:mailcap