Function: tab-bar--define-keys

tab-bar--define-keys is a byte-compiled function defined in tab-bar.el.gz.

Signature

(tab-bar--define-keys)

Documentation

Install key bindings for switching between tabs if the user has configured them.

Source Code

;; Defined in /usr/src/emacs/lisp/tab-bar.el.gz
(defun tab-bar--define-keys ()
  "Install key bindings for switching between tabs if the user has configured them."
  (when tab-bar-select-tab-modifiers
    (global-set-key (vector (append tab-bar-select-tab-modifiers (list ?0)))
                    'tab-recent)
    (dotimes (i 8)
      (global-set-key (vector (append tab-bar-select-tab-modifiers
                                      (list (+ i 1 ?0))))
                      'tab-bar-select-tab))
    (global-set-key (vector (append tab-bar-select-tab-modifiers (list ?9)))
                    'tab-last))
  ;; Don't override user customized key bindings
  (unless (global-key-binding [(control tab)])
    (global-set-key [(control tab)] 'tab-next))
  (unless (global-key-binding [(control shift tab)])
    (global-set-key [(control shift tab)] 'tab-previous))
  (unless (global-key-binding [(control shift iso-lefttab)])
    (global-set-key [(control shift iso-lefttab)] 'tab-previous))

  ;; Replace default value with a condition that supports displaying
  ;; global-mode-string in the tab bar instead of the mode line.
  (when (and (memq 'tab-bar-format-global tab-bar-format)
             (member '(global-mode-string ("" global-mode-string))
                     mode-line-misc-info))
    (setf (alist-get 'global-mode-string mode-line-misc-info)
          '(("" (:eval (if (and tab-bar-mode
                                (memq 'tab-bar-format-global
                                      tab-bar-format))
                           "" global-mode-string)))))))