In Emacs 27.1, using tabbar. Trying to switch to tabs using numbers. Editing ~/.emacs with following lines doesn't switch tabs using C-1. Produces C-u 1 and so on. What is missing here? Any other comfortable option?

(require 'tabbar)
(global-set-key (kbd "C-1") 'tab-bar-select-tab 1) ; move to 1st tab
(global-set-key (kbd "C-2") 'tab-bar-select-tab 2) ; move to 2nd tab

global-set-key doesn't take 3 arguments.

(global-set-key (kbd "C-1") (lambda () (interactive) (tab-bar-select-tab 1)))

Or better yet:

(defun move-to-first-tab ()
  "Move to first tab."
  (tab-bar-select-tab 1))

(global-set-key (kbd "C-1") 'move-to-first-tab)
  • Thank you for info, and resolution.
    – msinfo
    Oct 5 '20 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.