Function: hfy-compile-face-map

hfy-compile-face-map is a byte-compiled function defined in htmlfontify.el.gz.

Signature

(hfy-compile-face-map)

Documentation

Compile and return a hfy-facemap-assoc for the current buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/htmlfontify.el.gz
;; remember to generate 'synthetic' </span> entries -
;; emacs copes by just having a stack of styles in effect
;; and only using the top one: html has a more simplistic approach -
;; we have to explicitly end a style, there's no way of temporarily
;; overriding it w. another one... (afaik)
(defun hfy-compile-face-map ()
;; no need for special <a> version.
;; IME hyperlinks don't get underlined, esp when you htmlfontify a whole
;; source tree, so the <a> version is needed -- v
;; Fix-me: save table for multi-buffer
  "Compile and return a `hfy-facemap-assoc' for the current buffer."
  ;;(message "hfy-compile-face-map");;DBUG
  (let* ((pt         (point-min))
         (pt-narrow  (save-restriction (widen) (point-min)))
         (offset     (- pt pt-narrow))
         (fn         nil)
         (map        nil)
         (prev-tag   nil)) ;; t   if the last tag-point was a span-start
                           ;; nil if it was a span-stop
    (save-excursion
      (goto-char pt)
      (while (< pt (point-max))
        (if (setq fn (hfy-face-at pt))
            (progn (if prev-tag (push (cons pt-narrow 'end) map))
                   (push (cons pt-narrow fn) map)
                   (setq prev-tag t))
          (if prev-tag (push (cons pt-narrow 'end) map))
          (setq prev-tag nil))
        (setq pt (next-char-property-change pt))
        (setq pt-narrow (+ offset pt)))
      (if (and map (not (eq 'end (cdar map))))
          (push (cons (1+ (- (point-max) (point-min))) 'end) map)))
    (if (hfy-opt 'merge-adjacent-tags) (hfy-merge-adjacent-spans map) map)))