mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-11 19:45:25 +03:00
feat(emacs): advise shr-urlify
This commit is contained in:
parent
a346ca3176
commit
5e0d3dc8e2
2 changed files with 44 additions and 7 deletions
|
|
@ -5553,16 +5553,32 @@ ENTRY is an instance of `elfeed-entry'."
|
||||||
(setq-local shr-use-fonts (not shr-use-fonts)))
|
(setq-local shr-use-fonts (not shr-use-fonts)))
|
||||||
|
|
||||||
(defface my/shr-face
|
(defface my/shr-face
|
||||||
`((t :inherit variable-pitch
|
`((t :inherit variable-pitch))
|
||||||
:foreground ,(doom-color 'dark-blue)))
|
|
||||||
"Default face for shr rendering.")
|
"Default face for shr rendering.")
|
||||||
|
|
||||||
|
(my/use-doom-colors
|
||||||
|
(my/shr-face :foreground (doom-color 'blue)))
|
||||||
|
|
||||||
(defun my/shr-insert-around (fun &rest args)
|
(defun my/shr-insert-around (fun &rest args)
|
||||||
(let ((shr-current-font (or shr-current-font 'my/shr-face)))
|
(let ((shr-current-font (or shr-current-font 'my/shr-face)))
|
||||||
(apply fun args)))
|
(apply fun args)))
|
||||||
|
|
||||||
|
(defun my/shr-urlify-around (fun start url &optional title)
|
||||||
|
(funcall fun start url title)
|
||||||
|
(let ((faces (get-text-property start 'face)))
|
||||||
|
(put-text-property
|
||||||
|
start (point)
|
||||||
|
'face
|
||||||
|
(mapcar
|
||||||
|
(lambda (face)
|
||||||
|
(if (eq face 'my/shr-face)
|
||||||
|
'variable-pitch
|
||||||
|
face))
|
||||||
|
(if (sequencep faces) faces (list faces))))))
|
||||||
|
|
||||||
(with-eval-after-load 'shr
|
(with-eval-after-load 'shr
|
||||||
(advice-add #'shr-insert :around #'my/shr-insert-around))
|
(advice-add #'shr-insert :around #'my/shr-insert-around)
|
||||||
|
(advice-add #'shr-urlify :around #'my/shr-urlify-around))
|
||||||
|
|
||||||
(my-leader-def "aw" 'eww)
|
(my-leader-def "aw" 'eww)
|
||||||
(my/persp-add-rule
|
(my/persp-add-rule
|
||||||
|
|
|
||||||
29
Emacs.org
29
Emacs.org
|
|
@ -1970,7 +1970,8 @@ References:
|
||||||
(setq lsp-headerline-breadcrumb-enable nil)
|
(setq lsp-headerline-breadcrumb-enable nil)
|
||||||
(setq lsp-modeline-code-actions-enable nil)
|
(setq lsp-modeline-code-actions-enable nil)
|
||||||
(setq lsp-modeline-diagnostics-enable nil)
|
(setq lsp-modeline-diagnostics-enable nil)
|
||||||
(add-to-list 'lsp-language-id-configuration '(svelte-mode . "svelte")))
|
(add-to-list 'lsp-language-id-configuration '(svelte-mode . "svelte"))
|
||||||
|
(setq lsp-javascript-display-inlay-hints t))
|
||||||
|
|
||||||
(use-package lsp-ui
|
(use-package lsp-ui
|
||||||
:straight t
|
:straight t
|
||||||
|
|
@ -1979,6 +1980,10 @@ References:
|
||||||
(setq lsp-ui-doc-delay 2)
|
(setq lsp-ui-doc-delay 2)
|
||||||
(setq lsp-ui-sideline-show-hover nil))
|
(setq lsp-ui-sideline-show-hover nil))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+RESULTS:
|
||||||
|
: t
|
||||||
|
|
||||||
**** Integrations
|
**** Integrations
|
||||||
The only integration left now is treemacs.
|
The only integration left now is treemacs.
|
||||||
|
|
||||||
|
|
@ -7869,16 +7874,32 @@ Toggle using fonts in buffer:
|
||||||
Setting the default font.
|
Setting the default font.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defface my/shr-face
|
(defface my/shr-face
|
||||||
`((t :inherit variable-pitch
|
`((t :inherit variable-pitch))
|
||||||
:foreground ,(doom-color 'dark-blue)))
|
|
||||||
"Default face for shr rendering.")
|
"Default face for shr rendering.")
|
||||||
|
|
||||||
|
(my/use-doom-colors
|
||||||
|
(my/shr-face :foreground (doom-color 'blue)))
|
||||||
|
|
||||||
(defun my/shr-insert-around (fun &rest args)
|
(defun my/shr-insert-around (fun &rest args)
|
||||||
(let ((shr-current-font (or shr-current-font 'my/shr-face)))
|
(let ((shr-current-font (or shr-current-font 'my/shr-face)))
|
||||||
(apply fun args)))
|
(apply fun args)))
|
||||||
|
|
||||||
|
(defun my/shr-urlify-around (fun start url &optional title)
|
||||||
|
(funcall fun start url title)
|
||||||
|
(let ((faces (get-text-property start 'face)))
|
||||||
|
(put-text-property
|
||||||
|
start (point)
|
||||||
|
'face
|
||||||
|
(mapcar
|
||||||
|
(lambda (face)
|
||||||
|
(if (eq face 'my/shr-face)
|
||||||
|
'variable-pitch
|
||||||
|
face))
|
||||||
|
(if (sequencep faces) faces (list faces))))))
|
||||||
|
|
||||||
(with-eval-after-load 'shr
|
(with-eval-after-load 'shr
|
||||||
(advice-add #'shr-insert :around #'my/shr-insert-around))
|
(advice-add #'shr-insert :around #'my/shr-insert-around)
|
||||||
|
(advice-add #'shr-urlify :around #'my/shr-urlify-around))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue