]> git.eshelyaron.com Git - emacs.git/commitdiff
Speed up shr-insert slightly
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 22 Sep 2020 14:02:37 +0000 (16:02 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 22 Sep 2020 14:02:42 +0000 (16:02 +0200)
* lisp/net/shr.el (shr-insert): Speed up regularising spaces --
the vast majority of the spaces are already OK, so transforming
" " to " " just takes time.

lisp/net/shr.el

index efa1dba9536f34d05dadf743407a0023f987f2de..88e691752ab2b70cad2d14ca7bf7c18b7cc81e63 100644 (file)
@@ -678,8 +678,11 @@ size, and full-buffer size."
          (goto-char start)
          (when (looking-at "[ \t\n\r]+")
            (replace-match "" t t))
-         (while (re-search-forward "[ \t\n\r]+" nil t)
+         (while (re-search-forward "[\t\n\r]+" nil t)
            (replace-match " " t t))
+         (goto-char start)
+          (while (re-search-forward "  +" nil t)
+            (replace-match " " t t))
           (shr--translate-insertion-chars)
          (goto-char (point-max)))
        ;; We may have removed everything we inserted if it was just