fixing doom config for eww browsing

This commit is contained in:
2025-06-23 22:03:01 -07:00
parent 18b7782847
commit 8e042b02ac

View File

@@ -1,6 +1,7 @@
;;(setq fancy-splash-image "~/.config/doom/splash.png")
;;; -*- lexical-binding: t; -*-
;; Clean up starting screen
;; (setq fancy-splash-image "~/.config/doom/splash.png")
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-shortmenu)
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-banner)
(remove-hook '+doom-dashboard-functions #'doom-dashboard-widget-footer)
@@ -28,8 +29,8 @@
;; Font configuration
(set-face-attribute 'default nil :font "Monospace" :height 170)
(set-face-attribute 'fixed-pitch nil :font "Monospace" :height 170)
(set-face-attribute 'variable-pitch nil :font "ETBembo" :height 170)
(set-face-attribute 'fixed-pitch nil :font "Monospace" :height 1.0)
(set-face-attribute 'variable-pitch nil :font "ETBembo" :height 1.0)
(defun opal/org-font-setup ()
;; Replace list hyphen with dot
@@ -155,6 +156,14 @@
(setq org-agenda-include-diary t)
(setq diary-file "~/sync/org/diary")
(require 'org-tempo)
(dolist (template '(("sh" . "src shell")
("el" . "src emacs-lisp")
("cl" . "src lisp")
("sql" . "src sql")
("py" . "src python")))
(add-to-list 'org-structure-template-alist template))
;; Init org font setup
(opal/org-font-setup))
@@ -172,28 +181,19 @@
(use-package visual-fill-column
:hook (org-mode . opal/org-mode-visual-fill))
;; Load languages for babel code blocks.
(with-eval-after-load 'org
(use-package! ob
:after org
:config
;; Enable support for these code block languages
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(lisp . t)
(python . t)
(sql . t)))
;; Support correct font/highlighting for conf-unix blocks
(push '("conf-unix" . conf-unix) org-src-lang-modes))
(with-eval-after-load 'org
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("cl" . "src lisp"))
(add-to-list 'org-structure-template-alist '("sql" . "src sql"))
(add-to-list 'org-structure-template-alist '("py" . "src python")))
;; Programming
(setq geiser-guile-binary "/usr/bin/guile3.0")
;; Playing youtube videos via mpv/yt-dlp/emms
(defun opal/play-yt-url-at-point ()
"Play YT link under point with EMMS/MPV/yt-dlp."
@@ -234,11 +234,10 @@
(("C-c e" . elfeed))
:config
;; Ensure faces are set after elfeed has loaded
(with-eval-after-load 'elfeed
(set-face-attribute 'elfeed-search-filter-face nil :inherit 'variable-pitch :height 200)
;; Monospace fonts are necessary for text/column alignment in the *elfeed-search* buffer
(set-face-attribute 'elfeed-search-title-face nil :inherit 'fixed-pitch :height 200)
(set-face-attribute 'elfeed-search-feed-face nil :inherit 'fixed-pitch :height 200))
(set-face-attribute 'elfeed-search-filter-face nil :inherit 'variable-pitch :height 200)
;; Monospace fonts are necessary for text/column alignment in the *elfeed-search* buffer
(set-face-attribute 'elfeed-search-title-face nil :inherit 'fixed-pitch :height 200)
(set-face-attribute 'elfeed-search-feed-face nil :inherit 'fixed-pitch :height 200)
;; Set variable-pitch face for article fonts in the *elfeed-entry* buffer
(add-hook 'elfeed-show-mode-hook
@@ -282,26 +281,35 @@
(global-set-key (kbd "C-c w") #'eww)
(global-set-key (kbd "C-c f") #'elfeed-goodies/show-link-hint)
(use-package eww
:config
(setq browse-url-browser-function 'eww-browse-url)
(defun +opal--eww-fix-fonts-h ()
"Fix fonts, wrapping, and scaling for EWW buffers."
(visual-line-mode 1)
(setq-local face-remapping-alist
'((default variable-pitch default)
(shr-text variable-pitch default)
(shr-link variable-pitch default)
(shr-strong variable-pitch default)
(fixed-pitch fixed-pitch default)
(variable-pitch variable-pitch default)))
(text-scale-set 1))
;; Set eww webpage title in the modeline bar instead of just *eww*
(setq eww-auto-rename-buffer 'title)
(use-package! eww
:init
(setq browse-url-browser-function #'eww-browse-url
eww-auto-rename-buffer 'title
reddit-proxy "https://eddrit.com"
eww-url-transformers '(eww-remove-tracking
opal/eww-reddit-redirect
opal/eww-twitter-redirect
opal/eww-x-redirect)
shr-use-fonts nil
shr-fill-text nil)
;; Set privacy respecting proxies
(setq reddit-proxy "https://eddrit.com")
;; Redirect reddit links to privacy respecting frontends.
(setq eww-url-transformers
'(eww-remove-tracking
opal/eww-reddit-redirect
opal/eww-twitter-redirect
opal/eww-x-redirect))
;; Make sure eww opens in it's own buffer
(after! eww
(set-popup-rule! "^\\*eww\\*" :ignore t)))
(set-popup-rule! "^\\*eww" :ignore t))
:hook (eww-mode . +opal--eww-fix-fonts-h))
;; Since I sometimes write notes in two languages, guess-language will allow for multiple language
;; spelling checks to be done in a single buffer.
@@ -315,23 +323,49 @@
guess-language-min-paragraph-length 45)
:diminish guess-language-mode)
(setq geiser-guile-binary "/usr/bin/guile3.0")
(defun opal/nov-mode-setup ()
"Configure fonts for nov.el."
(variable-pitch-mode 1) ; Enable variable-pitch-mode
(visual-line-mode 1) ; Enable line wrapping at word boundaries
"Configure fonts and layout for nov.el."
(variable-pitch-mode 1)
(visual-line-mode 1)
(setq visual-fill-column-width 150
visual-fill-column-center-text t
line-spacing 0.2)
(visual-fill-column-mode 1))
(add-hook 'nov-mode-hook 'opal/nov-mode-setup)
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
(use-package! nov
:mode ("\\.epub\\'" . nov-mode)
:hook (nov-mode . opal/nov-mode-setup))
(setq +lookup-dictionary-prefer-offline t)
(setq dictionary-server "dict.org")
(setq browse-url-generic-program "librewolf")
(setq browse-url-browser-function 'browse-url-generic)
(use-package! tramp
:defer t
:init
;; TRAMP optimizations
;; See: https://coredumped.dev/2025/06/18/making-tramp-go-brrrr
;; Set core TRAMP behavior before it loads
(setq remote-file-name-inhibit-locks t
remote-file-name-inhibit-auto-save-visited t
tramp-use-scp-direct-remote-copying t
tramp-copy-size-limit (* 1024 1024) ;; 1MB
tramp-verbose 2
magit-tramp-pipe-stty-settings 'pty)
:config
;; Enable async remote process copying
(connection-local-set-profile-variables
'remote-direct-async-process
'((tramp-direct-async-process . t)))
(connection-local-set-profiles
'(:application tramp :protocol "scp")
'remote-direct-async-process)
;; Prevent compile mode from disabling SSH ControlMaster
(with-eval-after-load 'compile
(remove-hook 'compilation-mode-hook
#'tramp-compile-disable-ssh-controlmaster-options)))