5

I want to install tab bar to see buffer names at the top and jump between them with Ctrl-Up/Down. Yes, I know that some people doesn't recommend it for emacs, but I don't agree with them - I do like ido but I like tabs too.

Anyway, when I open most obvious source on emacswiki, it gives me link to sourceforge saying that it is outdated and if I want the newer version I should look at debian packages. I'm not a debian user, know nothing about their package manager and it sounds strange that such popular package is updated only by developers of some distribution (not emacs dev).

However I have found this package also on melpa, where according to the version number (20140316.600) it was updated this year, so relatively new. But if I click (in melpa) on "Homepage" it redirects me to git page where there is yet another different "last commit" date (even newer!). To add to the mess git once again refers to different site, this time back to emacswiki, but it is written in such a way that I'm not sure if git version is a fork of emacswiki ones or they are the same and both the fork of aquamacs.

Can anyone shed light which version is the current one, say official? Or is it that there are only random patches here and there done by random people and none of package is official?

  • So is your question how to install tabbar? Or is your question whether there is an official repository with the most recent version? – nispio Oct 09 '14 at 23:00
  • The second. I believe if there is official repo usually there is also enough information there how to technically install it. I just don't want to put "random snippet from google" into .emacs. – WeSenseASoulInSearchOfAnswers Oct 09 '14 at 23:13
  • "Official source repository" is not always synonymous with "best package documentation." Maybe you could modify your question to ask for one thing or the other instead of assuming that they are the same question. – nispio Oct 10 '14 at 00:36

5 Answers5

2

After going around, I found that david holm (https://github.com/dholm/tabbar) version is the latest and also both el-get and Melpa are pointing to this repository.

So I suggest using that version. I just installed with el-get with out a problem. Though I seems to have different behavior than I expected (bug?).

kindahero
  • 528
  • 4
  • 11
  • 1
    This repository is not the “official” tabbar repository. It just happens to be the most recent fork from the official Aquamacs source. –  Oct 10 '14 at 10:34
2

This is how I do it:

(use-package tabbar
  :ensure t
  :bind
  ("<C-S-iso-lefttab>" . tabbar-backward)
  ("<C-tab>" . tabbar-forward)

  :config
  (set-face-attribute
   'tabbar-button nil
   :box '(:line-width 1 :color "gray19"))

  (set-face-attribute
   'tabbar-selected nil
   :foreground "orange"
   :background "gray19"
   :box '(:line-width 1 :color "gray19"))

  (set-face-attribute
   'tabbar-unselected nil
   :foreground "gray75"
   :background "gray25"
   :box '(:line-width 1 :color "gray19"))

  (set-face-attribute
   'tabbar-highlight nil
   :foreground "black"
   :background "orange"
   :underline nil
   :box '(:line-width 1 :color "gray19" :style nil))

  (set-face-attribute
   'tabbar-modified nil
   :foreground "orange red"
   :background "gray25"
   :box '(:line-width 1 :color "gray19"))

  (set-face-attribute
   'tabbar-selected-modified nil
   :foreground "orange red"
   :background "gray19"
   :box '(:line-width 1 :color "gray19"))

  (custom-set-variables
   '(tabbar-separator (quote (0.2))))

  ;; Change padding of the tabs
  ;; we also need to set separator to avoid overlapping tabs by highlighted tabs
  ;; (custom-set-variables
  ;;  '(tabbar-separator (quote (1.0))))
  (defun tabbar-buffer-tab-label (tab)
    "Return a label for TAB.
  That is, a string used to represent it on the tab bar."
    (let ((label  (if tabbar--buffer-show-groups
                      (format " [%s] " (tabbar-tab-tabset tab))
                    (format " %s " (tabbar-tab-value tab)))))
      ;; Unless the tab bar auto scrolls to keep the selected tab
      ;; visible, shorten the tab label to keep as many tabs as possible
      ;; in the visible area of the tab bar.
      (if tabbar-auto-scroll-flag
          label
        (tabbar-shorten
         label (max 1 (/ (window-width)
                         (length (tabbar-view
                                  (tabbar-current-tabset)))))))))

  (defun px-tabbar-buffer-select-tab (event tab)
    "On mouse EVENT, select TAB."
    (let ((mouse-button (event-basic-type event))
          (buffer (tabbar-tab-value tab)))
      (cond
       ((eq mouse-button 'mouse-2) (with-current-buffer buffer (kill-buffer)))
       ((eq mouse-button 'mouse-3) (pop-to-buffer buffer t))
       (t (switch-to-buffer buffer)))
      (tabbar-buffer-show-groups nil)))

  (defun px-tabbar-buffer-help-on-tab (tab)
    "Return the help string shown when mouse is onto TAB."
    (if tabbar--buffer-show-groups
        (let* ((tabset (tabbar-tab-tabset tab))
               (tab (tabbar-selected-tab tabset)))
          (format "mouse-1: switch to buffer %S in group [%s]"
                  (buffer-name (tabbar-tab-value tab)) tabset))
      (format "\
mouse-1: switch to %S\n\
mouse-2: kill %S\n\
mouse-3: Open %S in another window"
              (buffer-name (tabbar-tab-value tab))
              (buffer-name (tabbar-tab-value tab))
              (buffer-name (tabbar-tab-value tab)))))

  (defun px-tabbar-buffer-groups ()
    "Sort tab groups."
    (list (cond ((or
                  (eq major-mode 'dired-mode)
                  (string-equal "*" (substring (buffer-name) 0 1))) "emacs")
                (t "user"))))
  (setq tabbar-help-on-tab-function 'px-tabbar-buffer-help-on-tab
        tabbar-select-tab-function 'px-tabbar-buffer-select-tab
        tabbar-buffer-groups-function 'px-tabbar-buffer-groups)

  :init
  (tabbar-mode 1))
yPhil
  • 963
  • 5
  • 22
1

If you like tabs, have a look at elscreen. Here is Github link. I like it better than tabbar, once upone a time when I was still using tabs.

Here is a random screenshot of Elscreen, taken from this SO question.

Tu Do
  • 6,772
  • 20
  • 39
  • +1 for a screenshot! Being new to emacs, I see a lot of preference for a thousand words instead of a picture. – Dean Feb 23 '16 at 04:05
1

The “official” tabbar package is maintained as part of Aquamacs and is not available independently. A standalone variant is kept at https://github.com/dholm/tabbar/ and occasionally, but infrequently updated from Aquamacs upstream. It is not however maintained independently.

If you'd like to use tabbar in GNU Emacs, this is your best bet currently. Generally you can safely follow whatever MELPA currently considers the best source, even if you don't actually install from MELPA, since both the MELPA maintainers and independent package maintainers typically do a very good job at keeping MELPA up to date.

However, be aware that there is no official and maintained GNU Emacs package of tabbar, so you may sooner or later experience breakage and issues. Also, tabbar is not a particularly good fit for the classic GNU Emacs user interface.

In other words, if you like tabbars, then use Aquamacs.

Wilfred Hughes
  • 6,890
  • 2
  • 29
  • 59
1

Time has passed and tab-bar-mode is now officially part of emacs (since version 27.1). You can enable it with M-x tab-bar-mode. Here is the manual.

Kaligule
  • 319
  • 3
  • 10