Function: semantic-mode-line-update

semantic-mode-line-update is a byte-compiled function defined in util-modes.el.gz.

Signature

(semantic-mode-line-update)

Documentation

Update mode line format of Semantic minor modes.

Only minor modes that are locally enabled are shown in the mode line.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/util-modes.el.gz
(defun semantic-mode-line-update ()
  "Update mode line format of Semantic minor modes.
Only minor modes that are locally enabled are shown in the mode line."
  (setq semantic-minor-modes-format nil)
  (dolist (x semantic-minor-mode-alist)
    (setq minor-mode-alist (delq (assq (car x) minor-mode-alist)
                                 minor-mode-alist)))
  (when semantic-update-mode-line
    (let ((locals '()))
      ;; Select the minor modes that aren't enabled globally and who
      ;; have a non-empty "name".
      (dolist (x semantic-minor-mode-alist)
        (unless (or (memq (car x) semantic-init-hook)
                    (not (string-match "^[ ]*\\(.+\\)" (cadr x))))
          (push (list (car x) (concat "/" (match-string 1 (cadr x)))) locals)))
      ;; Then build the format spec.
      (when locals
        (let ((prefix (if (string-match "^[ ]*\\(.+\\)"
                                        semantic-mode-line-prefix)
                          (match-string 1 semantic-mode-line-prefix)
                        "S")))
          (setq semantic-minor-modes-format
                `((:eval (if (or ,@(mapcar #'car locals))
                             ,(concat " " prefix)))))
          ;; It would be easier to just put `locals' inside
          ;; semantic-minor-modes-format, but then things like
          ;; mode-line-minor-mode-help can't find the right major mode
          ;; any more.  So instead, we carefully put the minor modes
          ;; in minor-mode-alist.
          (let* ((elem (or (assq 'semantic-minor-modes-format
                                 minor-mode-alist)
                           ;; FIXME: This entry is meaningless for
                           ;; mode-line-minor-mode-help.
                           '(semantic-minor-modes-format
                           semantic-minor-modes-format)))
                 (tail (or (memq elem minor-mode-alist)
                           (setq minor-mode-alist
                                 (cons elem minor-mode-alist)))))
            (setcdr tail (nconc locals (cdr tail)))))))))