mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
feat(emacs): shr faces
This commit is contained in:
parent
ce2b447f15
commit
8a82a52ed0
2 changed files with 62 additions and 34 deletions
|
|
@ -802,7 +802,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
|||
"f" 'helpful-function
|
||||
"k" 'helpful-key
|
||||
"v" 'helpful-variable
|
||||
"o" 'helpful-symbol)
|
||||
"o" 'helpful-symbol
|
||||
"i" 'info)
|
||||
|
||||
(general-define-key
|
||||
:keymaps 'help-map
|
||||
|
|
@ -1019,7 +1020,7 @@ influence of C1 on the result."
|
|||
(message "Install JetBrainsMono Nerd Font!")))
|
||||
|
||||
(when (display-graphic-p)
|
||||
(set-face-attribute 'variable-pitch nil :family "Cantarell" :height 120))
|
||||
(set-face-attribute 'variable-pitch nil :family "Cantarell" :height 1.0))
|
||||
|
||||
(use-package ligature
|
||||
:straight (:host github :repo "mickeynp/ligature.el")
|
||||
|
|
@ -1602,7 +1603,7 @@ Returns (<buffer> . <workspace-index>) or nil."
|
|||
:init
|
||||
(add-hook 'prog-mode-hook #'copilot-mode)
|
||||
:config
|
||||
(setq copilot-node-executable "/home/pavel/.conda/envs/general/bin/node")
|
||||
(setq copilot-node-executable "/home/pavel/.conda/envs/traject/bin/node")
|
||||
(general-define-key
|
||||
:keymaps 'company-active-map
|
||||
"<backtab>" #'my/copilot-tab)
|
||||
|
|
@ -5547,6 +5548,18 @@ ENTRY is an instance of `elfeed-entry'."
|
|||
(interactive)
|
||||
(setq-local shr-use-fonts (not shr-use-fonts)))
|
||||
|
||||
(defface my/shr-face
|
||||
`((t :inherit variable-pitch
|
||||
:foreground ,(doom-color 'dark-blue)))
|
||||
"Default face for shr rendering.")
|
||||
|
||||
(defun my/shr-insert-around (fun &rest args)
|
||||
(let ((shr-current-font (or shr-current-font 'my/shr-face)))
|
||||
(apply fun args)))
|
||||
|
||||
(with-eval-after-load 'shr
|
||||
(advice-add #'shr-insert :around #'my/shr-insert-around))
|
||||
|
||||
(my-leader-def "aw" 'eww)
|
||||
(my/persp-add-rule
|
||||
eww-mode 2 "browser")
|
||||
|
|
@ -5751,22 +5764,20 @@ ENTRY is an instance of `elfeed-entry'."
|
|||
|
||||
(advice-add #'Man-update-manpage :before #'my/man-fix-width)
|
||||
|
||||
(use-package devdocs
|
||||
(use-package devdocs-browser
|
||||
:straight t
|
||||
:commands (devdocs-install devdocs-lookup)
|
||||
:config
|
||||
(general-define-key
|
||||
:keymaps 'devdocs-mode-map
|
||||
:states '(normal)
|
||||
"H" #'devdocs-go-back
|
||||
"L" #'devdocs-go-forward
|
||||
"o" #'devdocs-lookup
|
||||
"[" #'devdocs-previous-page
|
||||
"]" #'devdocs-next-page)
|
||||
:init
|
||||
(my-leader-def
|
||||
"he" #'devdocs-lookup
|
||||
"hE" #'devdocs-install))
|
||||
:infix "hd"
|
||||
"" '(:wk "devdocs")
|
||||
"d" #'devdocs-browser-open
|
||||
"o" #'devdocs-browser-open-in
|
||||
"i" #'devdocs-browser-install-doc
|
||||
"n" #'devdocs-browser-uninstall-doc
|
||||
"o" #'devdocs-browser-download-offline-data
|
||||
"O" #'devdocs-browser-remove-offline-data
|
||||
"u" #'devdocs-browser-upgrade-all-docs
|
||||
"r" #'devdocs-browser-update-docs))
|
||||
|
||||
(use-package sx
|
||||
:straight t
|
||||
|
|
|
|||
53
Emacs.org
53
Emacs.org
|
|
@ -1308,7 +1308,8 @@ As I use =C-h= to switch buffers, I moved the help to =SPC-h= with the code belo
|
|||
"f" 'helpful-function
|
||||
"k" 'helpful-key
|
||||
"v" 'helpful-variable
|
||||
"o" 'helpful-symbol)
|
||||
"o" 'helpful-symbol
|
||||
"i" 'info)
|
||||
|
||||
(general-define-key
|
||||
:keymaps 'help-map
|
||||
|
|
@ -1647,7 +1648,7 @@ To make the icons work (e.g. in the Doom Modeline), run =M-x all-the-icons-insta
|
|||
*** Other fonts
|
||||
#+begin_src emacs-lisp
|
||||
(when (display-graphic-p)
|
||||
(set-face-attribute 'variable-pitch nil :family "Cantarell" :height 120))
|
||||
(set-face-attribute 'variable-pitch nil :family "Cantarell" :height 1.0))
|
||||
#+end_src
|
||||
*** Ligatures
|
||||
Ligature setup for the JetBrainsMono font.
|
||||
|
|
@ -2412,7 +2413,7 @@ A general-purpose package to run formatters on files. While the most popular for
|
|||
:init
|
||||
(add-hook 'prog-mode-hook #'copilot-mode)
|
||||
:config
|
||||
(setq copilot-node-executable "/home/pavel/.conda/envs/general/bin/node")
|
||||
(setq copilot-node-executable "/home/pavel/.conda/envs/traject/bin/node")
|
||||
(general-define-key
|
||||
:keymaps 'company-active-map
|
||||
"<backtab>" #'my/copilot-tab)
|
||||
|
|
@ -7853,12 +7854,30 @@ Emacs built-in web browser. +I wonder if anyone actually uses it.+
|
|||
|
||||
I use it occasionally to open links in elfeed.
|
||||
|
||||
Toggle using fonts in buffer:
|
||||
#+begin_src emacs-lisp
|
||||
(defun my/toggle-shr-use-fonts ()
|
||||
"Toggle the shr-use-fonts variable in buffer"
|
||||
(interactive)
|
||||
(setq-local shr-use-fonts (not shr-use-fonts)))
|
||||
#+end_src
|
||||
|
||||
Setting the default font.
|
||||
#+begin_src emacs-lisp
|
||||
(defface my/shr-face
|
||||
`((t :inherit variable-pitch
|
||||
:foreground ,(doom-color 'dark-blue)))
|
||||
"Default face for shr rendering.")
|
||||
|
||||
(defun my/shr-insert-around (fun &rest args)
|
||||
(let ((shr-current-font (or shr-current-font 'my/shr-face)))
|
||||
(apply fun args)))
|
||||
|
||||
(with-eval-after-load 'shr
|
||||
(advice-add #'shr-insert :around #'my/shr-insert-around))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(my-leader-def "aw" 'eww)
|
||||
(my/persp-add-rule
|
||||
eww-mode 2 "browser")
|
||||
|
|
@ -8138,26 +8157,24 @@ Of course, Emacs can also display man and info pages.
|
|||
(advice-add #'Man-update-manpage :before #'my/man-fix-width)
|
||||
#+end_src
|
||||
*** devdocs.io
|
||||
Finally, there is also an Emacs plugin for [[https://devdocs.io][devdocs.io]].
|
||||
There is a package called =devdocs= that does more or less the same, but I like =devdocs-browser= more because it uses =eww=.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package devdocs
|
||||
(use-package devdocs-browser
|
||||
:straight t
|
||||
:commands (devdocs-install devdocs-lookup)
|
||||
:config
|
||||
(general-define-key
|
||||
:keymaps 'devdocs-mode-map
|
||||
:states '(normal)
|
||||
"H" #'devdocs-go-back
|
||||
"L" #'devdocs-go-forward
|
||||
"o" #'devdocs-lookup
|
||||
"[" #'devdocs-previous-page
|
||||
"]" #'devdocs-next-page)
|
||||
:init
|
||||
(my-leader-def
|
||||
"he" #'devdocs-lookup
|
||||
"hE" #'devdocs-install))
|
||||
#+end_src
|
||||
:infix "hd"
|
||||
"" '(:wk "devdocs")
|
||||
"d" #'devdocs-browser-open
|
||||
"o" #'devdocs-browser-open-in
|
||||
"i" #'devdocs-browser-install-doc
|
||||
"n" #'devdocs-browser-uninstall-doc
|
||||
"o" #'devdocs-browser-download-offline-data
|
||||
"O" #'devdocs-browser-remove-offline-data
|
||||
"u" #'devdocs-browser-upgrade-all-docs
|
||||
"r" #'devdocs-browser-update-docs))
|
||||
#+End_src
|
||||
*** StackExchange
|
||||
[[https://github.com/vermiculus/sx.el][sx.el]] is a StackExchange client for Emacs.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue