unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69516: 30.0.50; fontify newline and end of headlines in shr
@ 2024-03-02 23:31 StrawberryTea
       [not found] ` <handler.69516.B.170942231022491.ack@debbugs.gnu.org>
  2024-03-03  6:56 ` bug#69516: 30.0.50; fontify newline and end of headlines in shr Eli Zaretskii
  0 siblings, 2 replies; 3+ messages in thread
From: StrawberryTea @ 2024-03-02 23:31 UTC (permalink / raw)
  To: 69516

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.

StrawberryTea





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-03  6:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-02 23:31 bug#69516: 30.0.50; fontify newline and end of headlines in shr StrawberryTea
     [not found] ` <handler.69516.B.170942231022491.ack@debbugs.gnu.org>
2024-03-03  4:02   ` bug#69516: Acknowledgement (30.0.50; fontify newline and end of headlines in shr) StrawberryTea
2024-03-03  6:56 ` bug#69516: 30.0.50; fontify newline and end of headlines in shr Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).