From 280b40cd8a46b325768f757ae9b50064524a46e1 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 13 Sep 2022 14:31:59 +0200 Subject: [PATCH] Enable undo in eww buffers * lisp/net/eww.el (eww-render): Enable undo after rendering. This allows using `undo' in text input boxes. (eww-setup-buffer): Disable undo before rendering (bug#57750). * lisp/net/shr.el (shr-image-fetched): Inhibit undo tracking. --- lisp/net/eww.el | 8 ++++++-- lisp/net/shr.el | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 6ed0719eca6..35e5bdd7342 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -626,7 +626,10 @@ The renaming scheme is performed in accordance with (setq eww-history-position 0) (and last-coding-system-used (set-buffer-file-coding-system last-coding-system-used)) - (run-hooks 'eww-after-render-hook))) + (run-hooks 'eww-after-render-hook) + ;; Enable undo again so that undo works in text input + ;; boxes. + (setq buffer-undo-list nil))) (kill-buffer data-buffer)))) (defun eww-parse-headers () @@ -928,7 +931,8 @@ The renaming scheme is performed in accordance with ;; May be set later if there's a next/prev link. (setq-local multi-isearch-next-buffer-function nil) (unless (eq major-mode 'eww-mode) - (eww-mode))) + (eww-mode)) + (buffer-disable-undo)) (defun eww-current-url nil "Return URI of the Web page the current EWW buffer is visiting." diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 248faeb223c..a06978d9ce0 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1019,6 +1019,8 @@ the mouse click event." (widen) (let ((alt (buffer-substring start end)) (properties (text-properties-at start)) + ;; We don't want to record these changes. + (buffer-undo-list t) (inhibit-read-only t)) (delete-region start end) (goto-char start) -- 2.39.2