Open nixin72 opened 3 years ago
I'm aware of this. PR #122 should fix this, but I'm yet to review it.
Oh, my bad, I didn't see that! I looked at the open issues to see if there was anything about this, but didn't look for open PRs.
I'll switch to that branch in the meantime, thank you so much!
Please don't hesitate to tell the PR author about any problems that may arise!
Your client mode issue might be related to the daemon launching in the terminal. You could test that by reloading your init from the client. If that fixes it, you would only need to isolate the code that isn't initializing and put it in a function that evaluates when the client launches, e.g. emacsclient.exe -c -n -a "" -e '(your-custom-function).'
In other news, just now explore centaur-tabs. Is there a quick way I missed to gather select buffers into a group?
I also use emacsclient
and when I opened a new client centaur-tabs-set-bar
and centaur-tabs-show-navigation-buttons
didn't work. I ended solving it by enabling centaur-tabs-mode
on server-after-make-frame-hook
:
(add-hook 'server-after-make-frame-hook 'centaur-tabs-mode)
Hope this helps solving your issue!
I'm also having this issue. I've used your hook @vpcano and it doesn't work for me
I've updated #122 and it now works for me. CORRECTION: My issues, which do not include the issue described by OP, appear to be fixed by it.
If you start the daemon mode without display graphics, load centaur-tabs
, and then later connect with a frame that is display graphics capable, some faces may not have been setup correctly, though.
I don't think that is a centaur-tabs bug strictly speaking, but I'm not sure, so I haven't included the fix for that in my PR.
One way to work around that is to enable centaur-tabs
like this (somewhere in one's init.el
):
;; Enable centaur-tabs without faulty theming in daemon mode.
(if (not (daemonp))
(centaur-tabs-mode)
(defun centaur-tabs-daemon-mode (frame)
(unless (and (featurep 'centaur-tabs) (centaur-tabs-mode-on-p))
(run-at-time nil nil (lambda () (centaur-tabs-mode)))))
(add-hook 'after-make-frame-functions #'centaur-tabs-daemon-mode))
Note the run-at-time
with immediate timeout: Without that delay until "first idle", the faces may still be broken (and themes may look wrong).
I've updated #122 and ~it now works for me.~ CORRECTION: My issues, which do not include the issue described by OP, appear to be fixed by it.
If you start the daemon mode without display graphics, load
centaur-tabs
, and then later connect with a frame that is display graphics capable, some faces may not have been setup correctly, though. I don't think that is a centaur-tabs bug strictly speaking, but I'm not sure, so I haven't included the fix for that in my PR.One way to work around that is to enable
centaur-tabs
like this (somewhere in one'sinit.el
):;; Enable centaur-tabs without faulty theming in daemon mode. (if (not (daemonp)) (centaur-tabs-mode) (defun centaur-tabs-daemon-mode (frame) (unless (and (featurep 'centaur-tabs) (centaur-tabs-mode-on-p)) (run-at-time nil nil (lambda () (centaur-tabs-mode))))) (add-hook 'after-make-frame-functions #'centaur-tabs-daemon-mode))
Note the
run-at-time
with immediate timeout: Without that delay until "first idle", the faces may still be broken (and themes may look wrong).
Not work.
The problem is centaur-tabs-set-bar
, if it is left
, then the whole tab bar will be empty.
Besides I'm using Spaemacs, under
or over
will not work at all(https://github.com/ema2159/centaur-tabs/issues/86).
I confirm the bug as described by @c02y
I solved the problem by applying a "dirty hack", waiting for a fix. I added these lines of code to my init.el file (defun tdr/fix-centaur-tabs () (centaur-tabs-mode -1) (centaur-tabs-mode) (centaur-tabs-headline-match)
) (if (daemonp) (add-hook 'after-make-frame-functions (lambda (frame) (with-selected-frame frame (tdr/fix-centaur-tabs))) (tdr/fix-centaur-tabs)) )
Each time a new frame is ceated, centaur-tabs-mode is switched off and switched on again. No issue so far. I hope this may be useful to other users
As none of suggested hacks work for me, fix for this problem would be greatly appreciated. Thank you.
Well, the workaround that solved the issue for me was restarting centaur tabs all the times that I focus on an emacs window:
(defun tdr/fix-centaur-tabs ()
"Reset Centaur Tabs."
(centaur-tabs-mode -1) ; Disable Centaur Tabs
(centaur-tabs-mode 1) ; Re-enable Centaur Tabs
(centaur-tabs-headline-match)) ; Update tabs
(add-hook 'focus-in-hook 'tdr/fix-centaur-tabs)
Thanks @ramuyk , that snippet seems to work well, if I spot anything wrong I'll report here.
None of the above proposed solutions worked for me either. In case it helps anyone, the following snippet fixes the rendering issue and is compatible with emacs
and emacsclient
.
(use-package centaur-tabs
:custom
(centaur-tabs-style "bar")
(centaur-tabs-set-bar 'left)
;; other settings here
:init
(if (daemonp)
(add-hook 'server-after-make-frame-hook 'centaur-tabs-mode)
(add-hook 'after-init-hook 'centaur-tabs-mode))
)
The tricky thing is that, as in the sample configuration in the repo's README.org
, :demand
is needed so that the tabs are displayed after the frame is initialized. But, :demand
broke compatibility with emacsclient
for me. I encountered some other quirks too, but the TLDR is that the above snippet handled those quirks (for example, in emacs
, the scratch buffer icon would prematurely display the ELisp icon before updating to the Lisp Interaction icon), whereas previous attempts involving different combinations of :config
, :init
, and hooks broke compatibility with emacsclient
, emacs
, or both.
Lastly, note that I only needed the above workaround when centaur-tabs-set-bar
was set to 'left
. For 'over
or 'under
, a typical configuration such as below suffices:
(use-package centaur-tabs
:demand
:custom
(centaur-tabs-style "bar")
(centaur-tabs-set-bar 'over)
;; (x-underline-at-descent-line t) ;; for 'under
;; other settings here
:config
(centaur-tabs-mode)
)
I use
systemctl
to start an Emacs server running as a daemon, and then whenever I open Emacs I useemacsclient
. However, when I useemacsclient
, centaur-tabs doesn't seem to display properly.Without changing my config at all, here's centaur-tabs when using
And here's it using regular Emacs.
![image](https://user-images.githubusercontent.com/22285063/94752277-bb575400-0358-11eb-8868-a178de8f8697.png)
emacsclient
If I try disabling
centaur-tabs-mode
and re-enabling it, it doesn't make a difference, I just can't seem to get it to work usingemacsclient
.