Function: majutsu-diff--color-words--token-anchors

majutsu-diff--color-words--token-anchors is a natively compiled function defined in majutsu-diff.el.

Signature

(majutsu-diff--color-words--token-anchors TOKEN-SPANS NON-TOKEN-SPANS)

Documentation

Return alist mapping non-token offsets to TOKEN-SPANS.

Each entry is (OFFSET . (SPAN...)) with SPAN = (START . END) in buffer order.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-diff.el
(defun majutsu-diff--color-words--token-anchors (token-spans non-token-spans)
  "Return alist mapping non-token offsets to TOKEN-SPANS.
Each entry is (OFFSET . (SPAN...)) with SPAN = (START . END) in buffer order."
  (let (anchors)
    (dolist (span token-spans)
      (let* ((start (car span))
             (offset (or (majutsu-diff--color-words--span-stream-offset
                          start non-token-spans)
                         0))
             (cell (assoc offset anchors)))
        (if cell
            (setcdr cell (cons span (cdr cell)))
          (push (cons offset (list span)) anchors))))
    (dolist (cell anchors)
      (setcdr cell (nreverse (cdr cell))))
    (nreverse anchors)))