Function: speedbar-trim-words-tag-hierarchy
speedbar-trim-words-tag-hierarchy is a byte-compiled function defined
in speedbar.el.gz.
Signature
(speedbar-trim-words-tag-hierarchy LST)
Documentation
Trim all words in a tag hierarchy.
Base trimming information on word separators, and group names. Argument LST is the list of tags to trim.
Source Code
;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-trim-words-tag-hierarchy (lst)
"Trim all words in a tag hierarchy.
Base trimming information on word separators, and group names.
Argument LST is the list of tags to trim."
(let ((newlst nil)
(sublst nil)
(trim-prefix nil)
(trim-chars 0)
(trimlst nil))
(while lst
(if (speedbar-generic-list-group-p (car-safe lst))
(setq newlst (cons (car lst) newlst))
(setq sublst (cons (car lst) sublst)))
(setq lst (cdr lst)))
;; Get the prefix to trim by. Make sure that we don't trim
;; off silly pieces, only complete understandable words.
(setq trim-prefix (speedbar-try-completion "" sublst)
newlst (nreverse newlst))
(if (or (= (length sublst) 1)
(not trim-prefix)
(not (string-match "\\(\\w+\\W+\\)+" trim-prefix)))
(append newlst (nreverse sublst))
(setq trim-prefix (substring trim-prefix (match-beginning 0)
(match-end 0)))
(setq trim-chars (length trim-prefix))
(while sublst
(setq trimlst (cons
(cons (substring (car (car sublst)) trim-chars)
(cdr (car sublst)))
trimlst)
sublst (cdr sublst)))
;; Put the lists together
(append newlst trimlst))))