Function: TeX-set-mode-name

TeX-set-mode-name is a byte-compiled function defined in tex.el.

Signature

(TeX-set-mode-name &optional CHANGED LOCAL RESET)

Documentation

Build and set the mode name.

The base mode name will be concatenated with indicators for helper modes where appropriate.

If CHANGED is non-nil, it indicates which global mode may have changed so that all corresponding buffers without a local value might get their name updated. A value of t will thus update all buffer names.

If LOCAL is non-nil and CHANGED is buffer-local, only a local change has been performed and only the local name is to be updated.

If RESET is non-nil, TeX-command-next is reset to TeX-command-default(var)/TeX-command-default(fun) in updated buffers.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-set-mode-name (&optional changed local reset)
  "Build and set the mode name.
The base mode name will be concatenated with indicators for
helper modes where appropriate.

If CHANGED is non-nil, it indicates which global mode
may have changed so that all corresponding buffers
without a local value might get their name updated.
A value of t will thus update all buffer names.

If LOCAL is non-nil and CHANGED is buffer-local, only
a local change has been performed and only the local
name is to be updated.

If RESET is non-nil, `TeX-command-next' is reset to
`TeX-command-default' in updated buffers."
  (if (and changed
           (not (and local (local-variable-p changed (current-buffer)))))
      (dolist (buffer (buffer-list))
        (and (local-variable-p 'TeX-mode-p buffer)
             (not (local-variable-p changed buffer))
             (with-current-buffer buffer (TeX-set-mode-name nil nil reset))))
    (if TeX-mode-p
        (let ((trailing-flags
               (concat
                (and (boundp 'TeX-fold-mode) TeX-fold-mode "F")
                (and (boundp 'LaTeX-math-mode) LaTeX-math-mode "M")
                (and TeX-PDF-mode "P")
                (and TeX-interactive-mode "I")
                (and TeX-source-correlate-mode "S"))))
          (setq mode-name (concat TeX-base-mode-name
                                  (when (> (length trailing-flags) 0)
                                    (concat "/" trailing-flags))))
          (when reset
            (TeX-process-set-variable (TeX-master-file)
                                      'TeX-command-next TeX-command-default)
            (TeX-process-set-variable (TeX-region-file)
                                      'TeX-command-next TeX-command-default))
          (set-buffer-modified-p (buffer-modified-p))))))