From d64f8d37cca20bfaa538dca592de0f5e3fb60ebb Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Sun, 19 May 2024 09:29:27 -0700 Subject: [PATCH] Scroll by paragraphs in EWW I often highlight the paragraph I'm reading in Firefox, but this is even better. --- ha-applications.org | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ha-applications.org b/ha-applications.org index 709946e..59c38e0 100644 --- a/ha-applications.org +++ b/ha-applications.org @@ -408,6 +408,13 @@ Web pages look pretty good with EWW, but I'm having difficulty getting it to ren (interactive (list (read-string "Name: " (plist-get eww-data :title)))) (rename-buffer (format "*eww: %s*" name) t)) + (defun ha-eww-better-scroll (prefix) + (interactive "^p") + (forward-paragraph prefix) + ;; (recenter) ... if you want the cursor in the center, + ;; otherwise, this puts the paragraph at the top of window: + (recenter-top-bottom 0)) + (major-mode-hydra-define eww-mode nil ("Browser" (("G" eww-browse "Browse") @@ -441,7 +448,8 @@ Web pages look pretty good with EWW, but I'm having difficulty getting it to ren :general (:states 'normal :keymaps 'eww-mode-map - "q" 'bury-buffer) + "q" 'bury-buffer + "J" 'ha-eww-better-scroll) (:states 'normal :keymaps 'eww-buffers-mode-map "q" 'bury-buffer)) #+end_src