]> git.eshelyaron.com Git - emacs.git/commitdiff
; Attempt to unbreak 'shr-indent'
authorEshel Yaron <me@eshelyaron.com>
Thu, 22 Aug 2024 07:24:41 +0000 (09:24 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 22 Aug 2024 07:24:41 +0000 (09:24 +0200)
lisp/net/shr.el

index b9ac9f0c8c0354989d8359b2e61573107bdd2c2e..d80d6b370f63bbab89f006a333b29d491b360668 100644 (file)
@@ -1057,10 +1057,12 @@ When `shr-fill-text' is nil, only indent."
          ;; of the current face, like (N . width).  That way, the
          ;; indentation is calculated correctly when using
          ;; `text-scale-adjust'.
-         `(space :width (,(if-let ((font (font-at (1- (point))))
-                                   (info (query-font font)))
-                              (/ (float shr-indentation) (aref info 7))
-                            shr-indentation)
+         `(space :width (,(/ (float shr-indentation)
+                             (if-let (((eq (window-buffer) (current-buffer)))
+                                      (font (font-at (1- (point))))
+                                      (info (query-font font)))
+                                 (aref info 7)
+                               (string-pixel-width " ")))
                          . width))))
       (put-text-property start (+ (point) prefix)
                          'shr-prefix-length (+ prefix (- (point) start))))))