From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Nicolas P. Rougier (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Freeze with specific evaluation in the modeline Date: Tue, 03 Sep 2024 20:13:15 +0200 Message-ID: References: <87seuh4tvb.fsf@gmx.net> <86ed607rfb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="833"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stephen Berman , nicolas.rougier@inria.fr, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 04 04:23:11 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1slffq-000AYP-Ce for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Sep 2024 04:23:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slffB-0002I0-WE; Tue, 03 Sep 2024 22:22:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slY1q-0002f8-5o for emacs-devel@gnu.org; Tue, 03 Sep 2024 14:13:22 -0400 Original-Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1slY1o-0001QD-FC; Tue, 03 Sep 2024 14:13:21 -0400 Original-Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-42bbe908380so35395715e9.2; Tue, 03 Sep 2024 11:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725387197; x=1725991997; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=8J+H3uOrLwVygg2QXjn6GHvutWz0Ss6buvZuauds8A8=; b=Bsr58yF3KotTyT6BEBsgzKWIrtFUxZ8EGyaUQYLghIRoUZ3+ROJoLSDL/IwjMkFXVJ j19H3j5V9fTXUipTOZqTAbqseUJkzOk2P0GSAh86zUqL7KUkUI7auRDi2l+WZpa+v0ie /Ho8i5//LpDYgTxnh7smq02nuppLTgqkC7VsSCFTA5qrjnBHJ7nsRRtmw0dT7PnPtWyP 6MDXAFPjEu+4692xdy/+3Sb7bVBa7/JrL3lgh5PIxaQ19LysY7XpR0cO3QOtTHpnQwIU q7iIA+cDhEfmdWeRJCICcWgehjwn+GwHH0bFxnJpZ8y+9QxrRst5LyAP4iB/gVKRrHxa 8iXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725387197; x=1725991997; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8J+H3uOrLwVygg2QXjn6GHvutWz0Ss6buvZuauds8A8=; b=LNOQielpIa3JYBIVdeW28rO8xMgDB0ZzJH2p24rvN5OY5Jg7XqLP7nmUZxELKR7nPN 6fnOIhp6w0cCNr1gWfKt4mc4wd+Uh/EV26jKYndlon7ry95GDd2RL7umgCOcfESV4fSh Vha7teniLxfSv2W99+4fXht7SYASAGx+9YxN5DJbPU2UfwYn1LJFPU1NhRt9g6EBPZgp D7o0nUDGgrAES5cKqiAtf4tIkC6Y467dP4QNtwUEXtoTx8L/pY16JL9sCYdGaalYoiMj wdkikl99rEv6O9S5zydvbSpuXzKqjSd27LCslXCtuz6gHFqWNeq6DlEff8ldHwkxz9g6 kV8A== X-Forwarded-Encrypted: i=1; AJvYcCVGJfdaHSzWyVvgH+7D+hQWx+CaCpz1usKALBvdM+Zv3bSUnsK0GG1YfekrJcpIBJ3nVbqLZI7E1lEGuQ==@gnu.org X-Gm-Message-State: AOJu0YxdZG4/lzPaWWFBkejAhKBWvHydT3NbgaBSU+ruaoifV6AZ2V9r k17dM1QyEwMsIZduBxMcSGhHx89Su/hUQFa3b/RFAgWbhfRS2bs7uEgVmRyS X-Google-Smtp-Source: AGHT+IFe/HHO0E3FB50y8U4E26OHoAfxhkZRn2rP+/B7Loo2efDo7aVXYiKI9ArHgRjRl6n9EbLJGg== X-Received: by 2002:adf:f206:0:b0:366:eade:bfbb with SMTP id ffacd0b85a97d-374bcfe5bd4mr7489250f8f.46.1725387196571; Tue, 03 Sep 2024 11:13:16 -0700 (PDT) Original-Received: from M-E7-NPR.local ([2a01:e0a:1c:a2c0:a534:9ad9:9963:6a93]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-374bfbfc7b7sm9922841f8f.88.2024.09.03.11.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 11:13:16 -0700 (PDT) X-Google-Original-From: "Nicolas P. Rougier (gmail)" In-Reply-To: <86ed607rfb.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 03 Sep 2024 17:17:12 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=nicolas.rougier@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 03 Sep 2024 22:22:23 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323347 Archived-At: On Tue 03 Sep 2024 at 17:17, Eli Zaretskii 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... >=20 > 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: >=20 > (setq mode-line-format > '(:eval (let (mode-line-format) > (if (window-in-direction 'down) "yes" "no")))) >=20 > 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 --=20 Nicolas P. Rougier =E2=80=94=E2=80=94 www.labri.fr/perso/nrougier Institute of Neurodegenerative Diseases, Bordeaux