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

* bug#69516: Acknowledgement (30.0.50; fontify newline and end of headlines in shr)
       [not found] ` <handler.69516.B.170942231022491.ack@debbugs.gnu.org>
@ 2024-03-03  4:02   ` StrawberryTea
  0 siblings, 0 replies; 3+ messages in thread
From: StrawberryTea @ 2024-03-03  4:02 UTC (permalink / raw)
  To: 69516

As a follow-up to my previous message, this is the correct code to
reproduce the issue:

;; Bootstrap straight
(defvar bootstrap-version)

(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
                                    'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'org)

(require 'org)
(load-theme 'leuven t)

(dolist (face '(org-level-1 org-level-2 org-level-3 org-level-4 org-level-5
                org-level-6 org-level-7 org-level-8))
  (set-face-attribute face nil :extend t))

(setq org-fontify-whole-heading-line t)
(scratch-buffer)
(org-mode)
(insert "* Headline 1\n Hello
* Headline 1\nHello\n")
(run-at-time 1 0 #'org-cycle-global)
(run-at-time 2 0 #'org-cycle-global)
(run-at-time 3 0 #'org-cycle-global)

help-debbugs@gnu.org (GNU bug Tracking System) writes:

> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
>  bug-gnu-emacs@gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 69516@debbugs.gnu.org.
>
> Please do not send mail to help-debbugs@gnu.org unless you wish
> to report a problem with the Bug-tracking system.





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

* bug#69516: 30.0.50; fontify newline and end of headlines in shr
  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  6:56 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2024-03-03  6:56 UTC (permalink / raw)
  To: StrawberryTea; +Cc: 69516

severity 69516 wishlist
thanks

> From: StrawberryTea <look@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.





^ 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).