manateelazycat / awesome-tab

Emacs package to provide out-of-the-box configuration to use tabs.
383 stars 38 forks source link

awesometab-hide does not work for readonly buffers #59

Closed dschaehi closed 5 years ago

dschaehi commented 5 years ago

Thanks for the great library. I really enjoy using the tabs. I have one small issue though: I've set the awesome-hide-tab function to hide all buffers starting with a . But it looks like read-only buffers still show tabs starting with a , such as the *Agenda Commands* buffer when I call org-agenda in org-mode or the *NeoTree* buffer when I call neotree. Can this problem be solved? The following is my awesome-hide-tab function.

(defun awesome-tab-hide-tab (x)
    (let ((name (format "%s" x)))
      (or
       (string-prefix-p "*" name)
       (string-prefix-p "COMMIT_EDITMSG" name)
       (and (string-prefix-p "magit" name)
            (not (file-name-extension name))))))
manateelazycat commented 5 years ago

When you finish rule of hide tab, please restart Emacs re-rest, rule should be apply after restart Emacs.

dschaehi commented 5 years ago

The rules work for most of the cases, for examples the *Messages* or the *scratch* buffers do not show any tabs. But *Agenda Commands* or *NeoTree* show tabs. So the rules sometimes work and sometimes don't. Could you check, whether M-x org-agenda shows a tab in your case, when you use the above rule?

dschaehi commented 5 years ago

I found the solution: the names of the buffers I mentioned previously actually start with a space, i.e., _*NeoTree* and _*Agenda Commands*" where _ means a space here. Emacs handles buffers whose names start with a space specially (see here) and does not show the space in the tabs. I only had to add a new rule (string-prefix-p " *" name) to hide those buffers.

pieterdd commented 5 years ago

For future reference of people coming in through Google: had a similar problem with *which-key*, whose name also started with a space I never noticed.

My solution:

(defun awesome-tab-hide-tab (x)
  (let ((name (format "%s" x)))
    (or
     (string-prefix-p "*" name)
     (string-prefix-p " *" name)
     )
    )
)