Function: htmlize-buffer-substring-no-invisible

htmlize-buffer-substring-no-invisible is a byte-compiled function defined in htmlize.el.

Signature

(htmlize-buffer-substring-no-invisible BEG END)

Source Code

;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
(defun htmlize-buffer-substring-no-invisible (beg end)
  ;; Like buffer-substring-no-properties, but don't copy invisible
  ;; parts of the region.  Where buffer-substring-no-properties
  ;; mandates an ellipsis to be shown, htmlize-ellipsis is inserted.
  (let ((pos beg)
        visible-list invisible show last-show next-change)
    ;; Iterate over the changes in the `invisible' property and filter
    ;; out the portions where it's non-nil, i.e. where the text is
    ;; invisible.
    (while (< pos end)
      (setq invisible (get-char-property pos 'invisible)
            next-change (htmlize-next-change pos 'invisible end)
            show (htmlize-decode-invisibility-spec invisible))
      (cond ((eq show t)
             (push (htmlize-get-text-with-display pos next-change)
                   visible-list))
            ((and (eq show 'ellipsis)
                  (not (eq last-show 'ellipsis)))
             ;; Conflate successive ellipses.
             (push htmlize-ellipsis visible-list)))
      (setq pos next-change last-show show))
    (htmlize-concat (nreverse visible-list))))