emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Freeze with specific evaluation in the modeline


From: Nicolas P. Rougier (gmail)
Subject: Re: Freeze with specific evaluation in the modeline
Date: Tue, 03 Sep 2024 20:13:15 +0200

On Tue 03 Sep 2024 at 17:17, Eli Zaretskii <eliz@gnu.org> wrote:

> It isn't a loop, it's infinite recursion.  window-in-direction calls
> posn-at-point, which calls display_mode_line, which again evaluates
> the form, which calls window-in-direction...
> 
> Just don't do this, is all I can say.  I don't see a way of protecting
> against this without disabling useful features of :eval.  Emacs gives
> you enough rope to hang yourself, but don't hang yourself.  The
> variant below avoids infinite recursion, perhaps at a price of losing
> accuracy in some corner cases:
> 
>   (setq mode-line-format
>         '(:eval (let (mode-line-format)
>                  (if (window-in-direction 'down) "yes" "no"))))
> 
> The :eval feature is inherently dangerous.  The documentation of :eval
> already warns about one possible danger of getting infinite recursion,
> I will try to find a way to add this caveat as well.

Thanks for the answer. I'll try your work-around.

What I'm trying to do is to have vertical spacing between windows and my
first idea was of course to use window-divider-mode. But even with a
single window, the mode adds a bottom spacing due to the presence of the
minibuffer window (I think), even though (window-in-direction 'down)
reports no window in such configuration. My second idea was then to use
the mode line as a (dynamic) separator.

Nicolas

-- 
Nicolas P. Rougier —— www.labri.fr/perso/nrougier
Institute of Neurodegenerative Diseases, Bordeaux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]