0

I admit it, I use tabbar. It is a bit quirky but it works for me. There is just one thing I really tried very hard to solve but it was not possible. I think mainly because a lot of people don't use tabbar so there is not so much information out there.

Below is my tabbar config, the grouping was stolen from some other init.el but it is exactly what I need. The problem is that as soon as I click on diary (a user buffer without stars) or *Packages* buffer (an emacs-buffer) the tabbar disappears. I think this is because of the different nature of diary and *Packages* buffer. Now to solve this I would like the buffers to be excluded from the groups below or put in a separate group. I have no skill in coding, I tried my best but a solution is beyond me. I hope someone could help.

#+BEGIN_SRC emacs-lisp
(use-package tabbar
:ensure t
:config
(setq tabbar-buffer-groups-function 'tabbar-buffer-groups)
(setq tabbar-background-color "black")
(setq tabbar-use-images nil)
(tabbar-mwheel-mode -1)
(tabbar-mode)
(defun tabbar-buffer-groups ()
  "Return the list of group names the current buffer belongs to.
This function is a custom function for tabbar-mode's tabbar-buffer-groups.
This function group all buffers into 3 groups:
Those Dired, those user buffer, and those emacs buffer.
Emacs buffer are those starting with “*”."
  (list
   (cond
    ((string-equal "*" (substring (buffer-name) 0 1))
     "Emacs Buffer"
     )
    ((eq major-mode 'dired-mode)
     "Dired"
     )
    (t
     "User Buffer"
     )
    ))))
#+END_SRC
1

The tabbar disappears because the major mode of diary and Packages (and completion, and ...) buffers use the header-line. You can view the tabbar with M-x tabbar-local-mode.

A solution for putting these buffers in another group:

(defun tabbar-buffer-groups ()
  (list
   (cond
    ((or (string-equal "diary" (buffer-name)) (string-equal "*Packages*" (buffer-name)))
     "Diary or package"
     )
    ((string-equal "*" (substring (buffer-name) 0 1))
     "Emacs Buffer"
     )
    ((eq major-mode 'dired-mode)
     "Dired"
     )
    (t
     "User Buffer"
     )
    )))

Here my tabbar configuration: https://github.com/djangoliv/conf/blob/master/init.org#tabbar for more inspiration.

  • This is not gold, this is platinum. Thanks for the info with the header-line. With that info I found out about the variable diary-header-line-flag . After setting it to nil using customize it didn't show up anymore. The standard diary header line is useless. For some reason this parameter is the only variable that I need to set using customize. When i set it using my configuration.org it's too late. Either init.el or customize.el or it will be displayed anyway. – Jens Lange Oct 21 '16 at 1:37
  • After hours using my master lisp skills I managed to remove diary from your code and get it working without it. I don't need to group diary out anymore since it now plays fine inside the user-buffer group. Compared to diary Packages has a useful header-line which means a separate group makes sense for me there even if it's only one buffer. Thanks again and I will have a look at your init too.There is always something interesting to find looking at other peoples init. – Jens Lange Oct 21 '16 at 1:43

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.