Subject: Re: bug#70049: 30.0.50; (server-running-p) in mode line freezes emacs

From: Eli Zaretskii <[email-masked]>
Date: Thu, 28 Mar 2024 13:46:01 +0200

> Date: Thu, 28 Mar 2024 11:45:16 +0100
> From: "Pedro A. Aranda" <[email-masked]>
> 
> Place the following file as init.el in a directory (e.g. ~/.demacs.d)
> 
> 
> ---- cut here ----
> ;; Mode line settings
> 
> (defun server-running-indicator()
>    (when (server-running-p) "S "))
> ;;  (unless (null server-process) "S "))
> 
> ;; (setq-default mode-line-right-align-edge 'right-fringe)
> (setq-default mode-line-format
>                (list
>                       '(:eval (propertize (server-running-indicator)
>                                           'face 'mode-line-buffer-id))
> 
>                       mode-line-modified
>                       " "
>                       mode-line-buffer-identification
>                       " "
>                       mode-line-position))
> ---- cut here ----
> 
> run emacs as
> /usr/bin/emacs --init-directory ~/.demacs.d
> 
> On the emacs window, click on the lower left corner and resize it with
> the mouse. No hangs are observed.
> 
> Now, active server-mode with
> M-x server-mode
> 
> Try again to resize the emacs window with the mouse. Emacs freezes.

I seem to be unable to reproduce this.

Does the freeze happen only if you resize the frame?  What if you just
drag the mode line to resize the window?

And when you say "freezes", does it mean Emacs uses 100% of a CPU's
execution unit, or does it mean it waits for something doing nothing?

Btw, in general, having arbitrary expressions in mode-line's :eval
form might definitely cause problems, since the mode line is called by
redisplay.