GNU bug report logs - #69516
30.0.50; fontify newline and end of headlines in shr

Previous Next

Package: emacs;

Reported by: StrawberryTea <look <at> strawberrytea.xyz>

Date: Sat, 2 Mar 2024 23:32:01 UTC

Severity: wishlist

Found in version 30.0.50

Full log


Message #13 received at control <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: StrawberryTea <look <at> strawberrytea.xyz>
Cc: 69516 <at> debbugs.gnu.org
Subject: Re: bug#69516: 30.0.50; fontify newline and end of headlines in shr
Date: Sun, 03 Mar 2024 08:56:16 +0200
severity 69516 wishlist
thanks

> From: StrawberryTea <look <at> strawberrytea.xyz>
> Date: Sat, 02 Mar 2024 17:31:07 -0600
> 
> Hello Emacs developers,
> 
> As you know, I love extending my headline backgrounds to the end of the
> window. However, shr.el does not do this, understandably because shr.el
> was written before the :extend keyword was added.
> 
> The following patch hacks around this:
> 
> modified   lisp/net/shr.el
> @@ -990,16 +990,21 @@ shr-fontize-dom
> ;; Add face to the region, but avoid putting the font properties on
> ;; blank text at the start of the line, and the newline at the end, to
> ;; avoid ugliness.
>  (defun shr-add-font (start end type)
> +    (when (memq type '(shr-h1 shr-h2 shr-h3 shr-h4 shr-h5 shr-h6))
> +      (insert "\n")
> +      (setq end (1+ end)))
>    (save-excursion
>      (goto-char start)
>      (while (< (point) end)
>        (when (bolp)
>          (skip-chars-forward " "))
> -      (add-face-text-property (point) (min (line-end-position) end) type t)
> +      (add-face-text-property (point) end type t)
>        (if (< (line-end-position) end)
>            (forward-line 1)
>          (goto-char end)))))
> 
> But this is a hack, and I would like to see a proper fix in Emacs.

Thanks.  Patches for this are welcome, but I think this should be an
optional feature, given that we have lived without it for such a long
time.




This bug report was last modified 1 year and 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.