diff options
author | jao <jao@gnu.org> | 2021-11-03 03:38:53 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-11-03 03:38:53 +0000 |
commit | ee9789c061998abb810974d1a27ef90026db8eba (patch) | |
tree | 6bce095a5f69de54b0d739c2e4b83b7c0d6ebba0 /eww.org | |
parent | da63d0e99d1a3dda4457a8e4c285f3a834e26b7c (diff) | |
download | elibs-ee9789c061998abb810974d1a27ef90026db8eba.tar.gz elibs-ee9789c061998abb810974d1a27ef90026db8eba.tar.bz2 |
experimenting with eww as main browser again
Diffstat (limited to 'eww.org')
-rw-r--r-- | eww.org | 46 |
1 files changed, 33 insertions, 13 deletions
@@ -68,13 +68,10 @@ (seq-map (lambda (b) (with-current-buffer b (let ((tl (or (plist-get eww-data :title) "")) - (url (or (eww-current-url) "<no url>"))) + (url (or (eww-current-url) (buffer-name)))) (propertize (if (string-blank-p tl) url tl) 'buffer b 'url url)))) - (seq-filter (lambda (b) - (eq 'eww-mode - (buffer-local-value 'major-mode b))) - (buffer-list)))))) + (seq-filter #'jao-www--buffer-p (buffer-list)))))) (jao-consult-add-buffer-source 'jao-eww-buffer-source "Web" ?e)) #+end_src * Images @@ -109,10 +106,6 @@ (interactive) (jao-eww-reopen t)) #+end_src -* eww-lnum - #+begin_src emacs-lisp - (use-package eww-lnum :ensure t) - #+end_src * Sessions #+begin_src emacs-lisp (use-package jao-eww-session @@ -127,7 +120,9 @@ (eww-download-directory jao-sink-dir) (eww-header-line-format nil) (eww-form-checkbox-selected-symbol "☒") - (eww-search-prefix "https://search.brave.com/search?q=") + (eww-auto-rename-buffer 'title) + (eww-buffer-name-length 180) + ;; (eww-search-prefix "https://search.brave.com/search?q=") (shr-width nil) (shr-use-colors nil) (shr-use-fonts nil) @@ -141,11 +136,10 @@ :bind (:map eww-mode-map (("b" . eww-back-url) ("B" . eww-forward-url) - ("c" . jao-eww-copy-link) ("d" . eww-download) ("D" . jao-download) - ("f" . eww-lnum-follow) - ("F" . eww-lnum-universal) + ("f" . link-hint-open-link) + ("F" . embark-on-link) ("j" . jao-eww-visit-url-on-page) ("J" . jao-eww-jump-to-url-on-page) ("L" . eww-forward-url) @@ -161,7 +155,33 @@ ("q" . jao-eww-close) ("x" . jao-rss-subscribe) ("y" . jao-eww-copy-link) + ("\\" . eww-view-source) ("C-c C-w" . jao-eww-close) ("M-i" . eww-toggle-images)))) #+end_src +* Fixes for shr image rendering + #+begin_src emacs-lisp + (require 'shr) + + (defun jao-shr--kill-nl (p) + (save-excursion + (goto-char p) + (when (looking-at-p "\n") (delete-char 1)))) + + (defun jao-shr-tag-img (fn &rest args) + (let ((p (point))) + (prog1 (apply fn args) + (when (> (point) p) (jao-shr--kill-nl p))))) + + (defun jao-shr-insert (fn &rest args) + (let ((p (when (and (not (bolp)) + (get-text-property (1- (point)) 'image-url)) + (point)))) + (prog1 (apply fn args) + (when (and p (> (point) p)) (jao-shr--kill-nl p))))) + + (advice-add 'shr-tag-img :around #'jao-shr-tag-img) + (advice-add 'shr-insert :around #'jao-shr-insert) + + #+end_src |