Function: TeX-overlay-prioritize

TeX-overlay-prioritize is a byte-compiled function defined in tex.el.

Signature

(TeX-overlay-prioritize START END)

Documentation

Calculate a priority for an overlay extending from START to END.

The calculated priority is lower than the minimum of priorities of surrounding overlays and higher than the maximum of enclosed overlays.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-overlay-prioritize (start end)
  "Calculate a priority for an overlay extending from START to END.
The calculated priority is lower than the minimum of priorities
of surrounding overlays and higher than the maximum of enclosed
overlays."
  (let (outer-priority inner-priority ov-priority)
    (dolist (ov (overlays-in start end))
      (when (or (eq (overlay-get ov 'category) 'TeX-fold)
                (overlay-get ov 'preview-state))
        (setq ov-priority (overlay-get ov 'priority))
        (if (>= (overlay-start ov) start)
            (setq inner-priority (max ov-priority (or inner-priority
                                                      ov-priority)))
          (setq outer-priority (min ov-priority (or outer-priority
                                                    ov-priority))))))
    (cond ((and inner-priority (not outer-priority))
           (+ inner-priority TeX-overlay-priority-step))
          ((and (not inner-priority) outer-priority)
           (/ outer-priority 2))
          ((and inner-priority outer-priority)
           (+ (/ (- outer-priority inner-priority) 2) inner-priority))
          (t TeX-overlay-priority-step))))