Function: semantic-idle-breadcrumbs--format-innermost-first

semantic-idle-breadcrumbs--format-innermost-first is a byte-compiled function defined in idle.el.gz.

Signature

(semantic-idle-breadcrumbs--format-innermost-first TAG-LIST &optional MAX-LENGTH)

Documentation

Format TAG-LIST placing the innermost tag first, separated from its parents.

If MAX-LENGTH is non-nil, the innermost tag is shortened.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/idle.el.gz
(defun semantic-idle-breadcrumbs--format-innermost-first
  (tag-list &optional max-length)
  "Format TAG-LIST placing the innermost tag first, separated from its parents.
If MAX-LENGTH is non-nil, the innermost tag is shortened."
  (let* (;; Separate and format remaining tags. Calculate length of
	 ;; resulting string.
	 (rest-tags       (butlast tag-list))
	 (rest-format     (if rest-tags
			      (concat
			       " | "
			       (semantic-idle-breadcrumbs--format-linear
				rest-tags))
			    ""))
	 (rest-length     (length rest-format))
	 ;; Format innermost tag and calculate length of resulting
	 ;; string.
	 (inner-format    (semantic-idle-breadcrumbs--format-tag
			   (car (last tag-list))
			   #'semantic-format-tag-prototype))
	 (inner-length    (length inner-format))
	 ;; Calculate complete length and shorten string for innermost
	 ;; tag if MAX-LENGTH is non-nil and the complete string is
	 ;; too long.
	 (complete-length (+ inner-length rest-length))
	 (inner-short     (if (and max-length
				   (<= complete-length max-length))
			      inner-format
			    (concat (substring
				     inner-format
				     0
				     (- inner-length
					(- complete-length max-length)
					4))
				    " ..."))))
    ;; Concat both parts.
    (concat inner-short rest-format))
  )