[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/htmlize 83f2745 035/134: Simplify loop, noticing that over
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/htmlize 83f2745 035/134: Simplify loop, noticing that overlay-faces is invariant throughout the loop. |
Date: |
Sat, 7 Aug 2021 09:17:01 -0400 (EDT) |
branch: elpa/htmlize
commit 83f2745769d58f14438e1f46c92d06f44e56b3b4
Author: Hrvoje Niksic <hniksic@gmail.com>
Commit: Hrvoje Niksic <hniksic@gmail.com>
Simplify loop, noticing that overlay-faces is invariant throughout the loop.
---
htmlize.el | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/htmlize.el b/htmlize.el
index 589c41a..f3a13f6 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -314,24 +314,19 @@ output.")
(defun htmlize-overlay-faces-at (pos)
(delq nil (mapcar (lambda (o) (overlay-get o 'face)) (overlays-at pos))))
(defun htmlize-next-face-change (pos &optional limit)
- ;; It is insufficient to call (htmlize-next-change pos 'face
- ;; limit) because it skips over entire overlays that specify the
- ;; `face' property, although the overlay contains smaller text
- ;; property runs that also specify `face'. The Emacs display
- ;; engine merges faces from all sources, and so must we.
+ ;; (htmlize-next-change pos 'face limit) would skip over entire
+ ;; overlays that specify the `face' property, even when they
+ ;; contain smaller text properties that also specify `face'.
+ ;; Emacs display engine merges those faces, and so must we.
(or limit
(setq limit (point-max)))
(let ((next-prop (next-single-property-change pos 'face nil limit))
- (overlay-faces (htmlize-overlay-faces-at pos))
- next-pos next-overlay-faces)
- (loop
- do (setq next-pos (next-overlay-change pos))
- until (>= next-pos next-prop)
- do (setq next-overlay-faces (htmlize-overlay-faces-at next-pos))
- while (equal overlay-faces next-overlay-faces)
- do (setq pos next-pos
- overlay-faces next-overlay-faces))
- (min next-pos next-prop))))
+ (overlay-faces (htmlize-overlay-faces-at pos)))
+ (while (progn
+ (setq pos (next-overlay-change pos))
+ (and (< pos next-prop)
+ (equal overlay-faces (htmlize-overlay-faces-at pos)))))
+ (min pos next-prop))))
(t
(error "htmlize requires next-single-property-change or \
next-single-char-property-change")))
- [nongnu] elpa/htmlize 28aeeb3 015/134: Version 1.12., (continued)
- [nongnu] elpa/htmlize 28aeeb3 015/134: Version 1.12., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 8b35e1a 018/134: Version 1.28., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize ce12545 013/134: Version 1.0., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize b9e708c 006/134: Version 0.50., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 57e99e0 016/134: Version 1.16., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize f0cd7a7 019/134: Version 1.34., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 2a42b1a 020/134: Version 1.36., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize d562fb4 031/134: Extract the code that massages buffer substring into HTML in a separate function., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize a763320 029/134: Tweak comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 9f0ffec 034/134: Don't treat an overlay that specifies `face' as a block., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 83f2745 035/134: Simplify loop, noticing that overlay-faces is invariant throughout the loop.,
ELPA Syncer <=
- [nongnu] elpa/htmlize 179f267 036/134: Bump version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 06e9a88 037/134: Make the header package.el compatible, ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize aa7969b 038/134: Bump version., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize c0bea5b 040/134: Don't use the old name x-color-values., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 11e675b 041/134: Get rid of a silly warning., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 3dfd7c9 044/134: Insert multiple runs having the same fstruct-list with the same HTML markup., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize cbbbc47 045/134: Kill htmlbuf in case of error., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 98c2c97 046/134: Update the copyright year., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize b95dd46 047/134: Fix docstring and indent., ELPA Syncer, 2021/08/07
- [nongnu] elpa/htmlize 143baca 048/134: Fix the `font' method., ELPA Syncer, 2021/08/07