Function: breadcrumb--summarize

breadcrumb--summarize is a natively compiled function defined in breadcrumb.el.

Signature

(breadcrumb--summarize CRUMBS CUTOFF SEPARATOR)

Documentation

Return a string that summarizes CRUMBS, a list of strings.

"Summarization" consists of truncating some CRUMBS to 1
character. Rightmost members of CRUMBS are summarized last. Members with a breadcrumb-dont-shorten are never truncated. Aim for a return string that is at most CUTOFF characters long. Join the crumbs with SEPARATOR.

Source Code

;; Defined in /nix/store/3gd3jzhj3g7mbwy1i3w6ci5d2md9d8r2-emacs-packages-deps/share/emacs/site-lisp/elpa/breadcrumb-1.0.1/breadcrumb.el
(defun bc--summarize (crumbs cutoff separator)
  "Return a string that summarizes CRUMBS, a list of strings.
\"Summarization\" consists of truncating some CRUMBS to 1
character.  Rightmost members of CRUMBS are summarized last.
Members with a `breadcrumb-dont-shorten' are never truncated.
Aim for a return string that is at most CUTOFF characters long.
Join the crumbs with SEPARATOR."
  (let ((rcrumbs
         (cl-loop
          for available = (- cutoff used)
          for (c . more) on (reverse crumbs)
          for seplen = (if more (length separator) 0)
          for shorten-p = (unless (get-text-property 0 'bc-dont-shorten c)
                            (> (+ (length c) seplen) available))
          for toadd = (if shorten-p (substring c 0 1) c)
          sum (+ (length toadd) seplen) into used
          collect toadd)))
    (string-join (reverse rcrumbs) separator)))