Subject: bug#36193: 26.2; 'set-window-scroll-bars' setting doesn't take effect in emacsclient session

From: martin rudalics <[email-masked]>
Date: Wed, 19 Jun 2019 11:14:04 +0200

>> That is if I evaluate with emacs -Q
 >>    (set-window-scroll-bars (minibuffer-window) 0 nil)
 >> and then type M-x, I get the scroll bars back just as you do.
 >
 > The behaviour is different in my case: when I use
 > 'after-make-frame-functions' as in the snippet in my second message,

This one, I suppose

(defun hide-minibuffer-scrollbar (frame)
   (with-selected-frame frame
     (set-window-scroll-bars (minibuffer-window) 0 nil)))

(if (daemonp)
     (add-hook 'after-make-frame-functions #'hide-minibuffer-scrollbar) ; Only for client sessions
   (set-window-scroll-bars (minibuffer-window) 0 nil))

 > the
 > scroll bar persists after doing M-x. If I evaluate
 >    (set-window-scroll-bars (minibuffer-window) 0 nil)
 > in a running session, they are displayed only as long as the minibuffer is
 > active, and then they are turned off again.

Since I never use emacsclient I can't tell and have no idea how this
is supposed to work.  It could be caused by this part in minibuf.c

   if ((noninteractive
        /* In case we are running as a daemon, only do this before
	  detaching from the terminal.  */
        || (IS_DAEMON && DAEMON_RUNNING))
       && NILP (Vexecuting_kbd_macro))
     {
       val = read_minibuf_noninteractive (prompt, expflag, defalt);
       return unbind_to (count, val);
     }

which avoids saving and restoring the window configuration and thus
removing the scroll bar when restoring.

Maybe someone else can clarify how this is supposed to work.

In a normal session the scroll bar gets removed after M-x is done so
apparently restoring the old window configuration also removes the
scroll bar.

martin