Subject: bug#78896: 29.4; display-time-mode breaks minibuffer in emacsclient

From: Juri Linkov <[email-masked]>
Date: Fri, 27 Jun 2025 09:57:06 +0300

> I confirm that everything works without problems with:
>
> ```
> ;; min-init.el
> (require 'tab-bar)
> (add-to-list 'tab-bar-format 'tab-bar-format-global 'append)
> (display-time-mode 1)
> (add-hook 'server-after-make-frame-hook 'toggle-frame-tab-bar)
> ```

Here is the patch that also allows using the original recipe:

```
;; min-init.el
(require 'tab-bar)
(tab-bar-mode)
(add-to-list 'tab-bar-format 'tab-bar-format-global 'append)
(display-time-mode -1)
```

This patch instructs tab-bar-mode to ignore daemon's initial frame:

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 306fed34e40..7dc39086044 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -280,11 +280,13 @@ tab-bar--update-tab-bar-lines
     (dolist (frame frame-lst)
       (unless (or (frame-parameter frame 'tab-bar-lines-keep-state)
                   (and (eq auto-resize-tab-bars 'grow-only)
-                       (> (frame-parameter frame 'tab-bar-lines) 1)))
+                       (> (frame-parameter frame 'tab-bar-lines) 1))
+                  ;; Don't enable tab-bar in daemon's initial frame.
+                  (and (daemonp) (not (frame-parameter frame 'client))))
         (set-frame-parameter frame 'tab-bar-lines
                              (tab-bar--tab-bar-lines-for-frame frame)))))
   ;; Update `default-frame-alist'
-  (when (eq frames t)
+  (when (and (eq frames t) (not (daemonp)))
     (setq default-frame-alist
           (cons (cons 'tab-bar-lines
                       (if (and tab-bar-mode (eq tab-bar-show t)) 1 0))
@@ -600,7 +602,11 @@ toggle-frame-tab-bar
 or if you want to disable the tab bar individually on each
 new frame when the global `tab-bar-mode' is enabled, by using
 
-  (add-hook \\='after-make-frame-functions #\\='toggle-frame-tab-bar)"
+  (add-hook \\='after-make-frame-functions #\\='toggle-frame-tab-bar)
+
+Or when starting Emacs in daemon mode:
+
+  (add-hook \\='server-after-make-frame-hook #\\='toggle-frame-tab-bar)"
   (interactive)
   (set-frame-parameter frame 'tab-bar-lines
                        (if (> (frame-parameter frame 'tab-bar-lines) 0) 0 1))