From: Lars Magne Ingebrigtsen Date: Wed, 11 Feb 2015 04:34:07 +0000 (+1100) Subject: (shr-fill-line): Preserve background colours when indenting/folding. X-Git-Tag: emacs-25.0.90~2008^2~30 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e6929b0b8a3c4a10023f700c6121f9e0b182aa8a;p=emacs.git (shr-fill-line): Preserve background colours when indenting/folding. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7274c9da8f2..7ec017c94ec 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,7 @@ * net/shr.el (shr-insert): Make sure the space inserted has the right font (for width). + (shr-fill-line): Preserve background colours when indenting/folding. 2015-02-10 Lars Ingebrigtsen diff --git a/lisp/net/shr.el b/lisp/net/shr.el index a4320853fd1..7a93c3a043c 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -550,7 +550,12 @@ size, and full-buffer size." (point) 'shr-continuation-indentation)) start) (put-text-property (point) (1+ (point)) 'shr-indentation nil) - (shr-indent) + (let ((face (get-text-property (point) 'face)) + (background-start (point))) + (shr-indent) + (when face + (put-text-property background-start (point) 'face + `,(shr-face-background face)))) (setq start (point)) (setq shr-indentation (or continuation shr-indentation)) (shr-vertical-motion shr-internal-width) @@ -570,8 +575,13 @@ size, and full-buffer size." ;; Success; continue. (when (= (preceding-char) ?\s) (delete-char -1)) - (insert "\n") - (shr-indent) + (let ((face (get-text-property (point) 'face)) + (background-start (point))) + (insert "\n") + (shr-indent) + (when face + (put-text-property background-start (point) 'face + `,(shr-face-background face)))) (setq start (point)) (shr-vertical-motion shr-internal-width) (when (looking-at " $")