branch: elpa/htmlize
commit a4569e3392f37491e0e3e0d466f9b41270eafe21
Author: Hrvoje Niksic <[email protected]>
Commit: Hrvoje Niksic <[email protected]>
Correctly handle :inherit specifying a list of faces.
---
NEWS | 6 ++++++
htmlize.el | 27 ++++++++++++++++++++-------
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/NEWS b/NEWS
index 0a984ac..ea488a8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
htmlize NEWS -- history of user-visible changes.
+* Changes in htmlize 1.45
+
+** Correctly handle :inherit specifying a list of faces. (This bug
+would cause an error in AUX TeX buffers.)
+
+
* Changes in htmlize 1.44
** Faces specified in the `face' property are now prioritized the same
diff --git a/htmlize.el b/htmlize.el
index de22383..1ed0356 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -1072,13 +1072,26 @@ If no rgb.txt file is found, return nil."
(defun htmlize-face-size (face)
;; The size (height) of FACE, taking inheritance into account.
;; Only works in Emacs 21 and later.
- (let ((size-list
- (loop
- for f = face then (face-attribute f :inherit)
- until (or (not f) (eq f 'unspecified))
- for h = (face-attribute f :height)
- collect (if (eq h 'unspecified) nil h))))
- (reduce 'htmlize-merge-size (cons nil size-list))))
+ (let* ((face-list (list face))
+ (head face-list)
+ (tail face-list))
+ (while head
+ (let ((inherit (face-attribute (car head) :inherit)))
+ (cond ((listp inherit)
+ (setcdr tail (copy-list inherit))
+ (setq tail (last tail)))
+ ((eq inherit 'unspecified))
+ (t
+ (setcdr tail (list inherit))
+ (setq tail (cdr tail)))))
+ (pop head))
+ (message "%s" face-list)
+ (let ((size-list
+ (loop
+ for f in face-list
+ for h = (face-attribute f :height)
+ collect (if (eq h 'unspecified) nil h))))
+ (reduce 'htmlize-merge-size (cons nil size-list)))))
(defun htmlize-face-css-name (face)
;; Generate the css-name property for the given face. Emacs places