X-Loop: help-debbugs@HIDDEN
Subject: bug#79640: Buffer-local window-buffer-change-functions
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: rudalics@HIDDEN, monnier@HIDDEN, bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 16 Oct 2025 15:48:02 +0000
Resent-Message-ID: <handler.79640.B.17606296425623 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 79640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: 79640 <at> debbugs.gnu.org
Cc: martin rudalics <rudalics@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
X-Debbugs-Original-Xcc: martin rudalics <rudalics@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.17606296425623
(code B ref -1); Thu, 16 Oct 2025 15:48:02 +0000
Received: (at submit) by debbugs.gnu.org; 16 Oct 2025 15:47:22 +0000
Received: from localhost ([127.0.0.1]:36699 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1v9QCI-0001SY-1K
for submit <at> debbugs.gnu.org; Thu, 16 Oct 2025 11:47:22 -0400
Received: from lists.gnu.org ([2001:470:142::17]:50874)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1v9QBj-0001PF-GN
for submit <at> debbugs.gnu.org; Thu, 16 Oct 2025 11:46:48 -0400
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 <juri@HIDDEN>) id 1v9QBd-0003GJ-JY
for bug-gnu-emacs@HIDDEN; Thu, 16 Oct 2025 11:46:41 -0400
Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256)
(Exim 4.90_1) (envelope-from <juri@HIDDEN>) id 1v9QBM-0007Qd-7m
for bug-gnu-emacs@HIDDEN; Thu, 16 Oct 2025 11:46:38 -0400
Received: from smtp102.mailbox.org (smtp102.mailbox.org
[IPv6:2001:67c:2050:b231:465::102])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4cnXP56HhXz9tLJ
for <bug-gnu-emacs@HIDDEN>; Thu, 16 Oct 2025 17:46:17 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1760629577;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type;
bh=/TT+QeTAKxJcFDzgiahNI7Rf2ZPBP3G3nYZ2xUfIbxg=;
b=2CPvNTI3zylcyveukqyRSVG8L54GNNp5Z0ZFUg5Bq8Jomr5K27yLH9XhV9lCeHtUR9aVHf
CRmbIJAcENvJkAaNi9loaxKYupT+H90alMR+sYqBUjlFQxWuQ9ZU+qS7FnRiM0BPyO4feb
33hvQi2QywGoJ+rpaUPGKpyNGuWRHBGVRdBaVfZ4prPW0Af4RHbestOLsF4EdtpmdBtmKK
kGKh77C3Ewoc8yOKOWBfR4HxZNCrfUFOiwBsNYM0RDM0fQTgf8R8grm2Q1v38SAKcgDL1b
vbCCMCXTaVrqe1IZ1caiRyp2uc91g2M9oVshFCcAYizqkht3s1GIr9Ckuy1l8g==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
2001:67c:2050:b231:465::102 as permitted sender)
smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
Organization: LINKOV.NET
Date: Thu, 16 Oct 2025 18:45:04 +0300
Message-ID: <87ecr2n9ev.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4cnXP56HhXz9tLJ
Received-SPF: pass client-ip=2001:67c:2050:0:465::101;
envelope-from=juri@HIDDEN; helo=mout-p-101.mailbox.org
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 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,
RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
Martin, do you think we need to add a warning to the documentation of
'window-buffer-change-functions' that for the case when a buffer
is removed from the window, then the buffer-local hook should use
something like this to detect the case that the buffer
with the buffer-local hook is displayed:
(eq (window-buffer w) (current-buffer))
Below is a patch that fixes the bug in compilation-mode
for such test case:
1. Disable fringes.
2. Set compilation-context-lines to t.
3. Visit a compilation error to resize the margin.
4. Visit another buffer.
The margin is resized in an unrelated buffer that doesn't have
a buffer-local hook. Here is the fix:
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 8cfa793cfc6..01152328577 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -3062,7 +3062,8 @@ compilation--dummy-string
(defun compilation--set-up-margin (w)
"Setup the margin for \"=>\" in window W if it isn't already set up."
- (set-window-margins w (+ (or (car (window-margins w)) 0) 2)))
+ (when (eq (window-buffer w) (current-buffer))
+ (set-window-margins w (+ (or (car (window-margins w)) 0) 2))))
(defun compilation--tear-down-margin (w)
"Remove the margin for \"=>\" if it is setup in window W."
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Juri Linkov <juri@HIDDEN> Subject: bug#79640: Acknowledgement (Buffer-local window-buffer-change-functions) Message-ID: <handler.79640.B.17606296425623.ack <at> debbugs.gnu.org> References: <87ecr2n9ev.fsf@HIDDEN> X-Gnu-PR-Message: ack 79640 X-Gnu-PR-Package: emacs Reply-To: 79640 <at> debbugs.gnu.org Date: Thu, 16 Oct 2025 15:48:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. As you requested using X-Debbugs-CC, your message was also forwarded to martin rudalics <rudalics@HIDDEN>, Stefan Monnier <monnier@HIDDEN= .ca> (after having been given a bug report number, if it did not have one). Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 79640 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 79640: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D79640 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#79640: Buffer-local window-buffer-change-functions
Resent-From: martin rudalics <rudalics@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 16 Oct 2025 18:34:02 +0000
Resent-Message-ID: <handler.79640.B79640.17606396345529 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Juri Linkov <juri@HIDDEN>, 79640 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier@HIDDEN>
Received: via spool by 79640-submit <at> debbugs.gnu.org id=B79640.17606396345529
(code B ref 79640); Thu, 16 Oct 2025 18:34:02 +0000
Received: (at 79640) by debbugs.gnu.org; 16 Oct 2025 18:33:54 +0000
Received: from localhost ([127.0.0.1]:38038 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1v9SnM-0001Qx-Ba
for submit <at> debbugs.gnu.org; Thu, 16 Oct 2025 14:33:54 -0400
Received: from mout.gmx.net ([212.227.17.22]:53193)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <rudalics@HIDDEN>) id 1v9SnF-0001QY-TJ
for 79640 <at> debbugs.gnu.org; Thu, 16 Oct 2025 14:33:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at;
s=s31663417; t=1760639604; x=1761244404; i=rudalics@HIDDEN;
bh=WZaLWzA5mwxt6ol194IepZNYg1aVEnHHhQ6uqurjWPE=;
h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc:
References:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding:cc:content-transfer-encoding:
content-type:date:from:message-id:mime-version:reply-to:subject:
to;
b=IqQ9FW1M8jWXPfA7hNznmY+vBTJZgoub0jExlYMnorb36qhwSS8UgdzazEZTQrT+
e8gG5GklJueCwhZevtA3EoFcf/Ucr9oeYYYaDCxrSlp2IVd6sUZmru4Y/Lm3MVq0Y
mGg9SMCB0Dwf/TftN46qWcAAUvcJGFFt+2eNiI0nNtpGIaeuhu0yBh/fl7ZhjqXNl
jJmIacH7K8bngJe2vHOa/P9GH6Nf2MlcKKSKdDOfWF8lAd8GX4iVf5ZSSP/F8g/rs
Hc5/TOKkhO9C5nAOOXtARCkVFXnVnZN3h9OJ6FbPGTs0OUxD8W1pAUeK91JFupPcQ
mB8Rs3r74qSTpWdKTg==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from [192.168.31.113] ([213.162.85.159]) by mail.gmx.net (mrgmx105
[212.227.17.168]) with ESMTPSA (Nemesis) id 1N5mGB-1u85UN05al-0182Qk; Thu, 16
Oct 2025 20:33:24 +0200
Message-ID: <3acce825-fa90-4f3d-98f7-e893980c0297@HIDDEN>
Date: Thu, 16 Oct 2025 20:33:23 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
References: <87ecr2n9ev.fsf@HIDDEN>
Content-Language: en-US
From: martin rudalics <rudalics@HIDDEN>
In-Reply-To: <87ecr2n9ev.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:Rgdl5nTqg7hkEKhRnTTlhOxBRdabEIFm5tRWl5/8txWmAEhMCH/
4safqCa6+taGwj0dYoEER0En6F98+FWz2hO/AiocJtHNwE3x+i5B0j9itJe7raLSuTE+Y90
Mk/M7LgC0x//8PUCs/dawn/OEqsDERz6C0KuvTasNCTDS3bZDmSb7veoBtSeDRHDltgV7J3
4+PjuETvkmh6gP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debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
> Martin, do you think we need to add a warning to the documentation of
> 'window-buffer-change-functions' that for the case when a buffer
> is removed from the window, then the buffer-local hook should use
> something like this to detect the case that the buffer
> with the buffer-local hook is displayed:
>
> (eq (window-buffer w) (current-buffer))
Maybe: The local version of 'window-buffer-change-functions' may be now
called twice - once for the removed buffer and once for the buffer that
is now displayed there. In the former case you probably want to check
(eq (window-old-buffer w) (current-buffer))
and in the latter what you wrote above. I'll try to explain that.
martin
X-Loop: help-debbugs@HIDDEN
Subject: bug#79640: Buffer-local window-buffer-change-functions
Resent-From: martin rudalics <rudalics@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 17 Oct 2025 09:14:03 +0000
Resent-Message-ID: <handler.79640.B79640.176069244326037 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Juri Linkov <juri@HIDDEN>, 79640 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier@HIDDEN>
Received: via spool by 79640-submit <at> debbugs.gnu.org id=B79640.176069244326037
(code B ref 79640); Fri, 17 Oct 2025 09:14:03 +0000
Received: (at 79640) by debbugs.gnu.org; 17 Oct 2025 09:14:03 +0000
Received: from localhost ([127.0.0.1]:47296 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1v9gXC-0006ld-BI
for submit <at> debbugs.gnu.org; Fri, 17 Oct 2025 05:14:02 -0400
Received: from mout.gmx.net ([212.227.15.18]:55751)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <rudalics@HIDDEN>) id 1v9gWZ-0006hr-Na
for 79640 <at> debbugs.gnu.org; Fri, 17 Oct 2025 05:13:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at;
s=s31663417; t=1760692384; x=1761297184; i=rudalics@HIDDEN;
bh=05Eyx6K8qnWiDnUZ6p3QMt4CbKblH/5a62bNaPgN9/o=;
h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc:
References:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding:cc:content-transfer-encoding:
content-type:date:from:message-id:mime-version:reply-to:subject:
to;
b=XLKg/mEv4ERqVhF2dgW2T+A/mGqv+4ynRoacJeq5AXkiT93Gdsx/T6VGtDOv+7oB
lyiD5ufF8/WpwcyEBCYtE35onD5wNzHpYkCCWPO15TYUdFMuo629jXDp21lu2tHea
w8OC028S/MKYluwibvyPZKwfJ3qoR3DwlSi5aP44bm1deeFQlTZIkMETFy3VbV0M3
1tQwkyxID62Cn07aNL573K+CrMipqYO5kQQjeEUIb5HpM4LR1pqkkq+B4sfpdL0MG
gW60eRfME4SnA6fSPFMwZBhVffOshKndsFl7jNn6J6ori0CI4NxLbODa5j740Zxkh
yrZoO3qMqX8MSz2Zsg==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from [192.168.31.113] ([213.162.84.91]) by mail.gmx.net (mrgmx004
[212.227.17.190]) with ESMTPSA (Nemesis) id 1N1Obh-1uCFT92GFP-016D9T; Fri, 17
Oct 2025 11:13:04 +0200
Message-ID: <d8cff817-1f35-4b80-a312-a0f577009fee@HIDDEN>
Date: Fri, 17 Oct 2025 11:13:01 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
References: <87ecr2n9ev.fsf@HIDDEN>
Content-Language: en-US
From: martin rudalics <rudalics@HIDDEN>
In-Reply-To: <87ecr2n9ev.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
X-Provags-ID: V03:K1:S5S46J011WKE2/w1Sh7q3hQU7dgUPzK3LDfT4OQQqRa3n8wHvvr
xQuvYK6w/sZOAhj421z/WT8rd1iunUnhgTWEbRXAAIEBaHRe6t35wFjZewcTA6V36d7wQn2
SloutDqO1WQy6ko2BLpAEUnHuYC7Y/atffMBeDJQ3JyCdgGfCtjaG8cnW6dsxslzu7bP59H
0ARQt+GvAjmoz0qH6bEAg==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:taoC6vUeDLU=;wb6KuvYdwJObZD7EpVUxWp23GCL
QqVXAAW5gm4zoeNrHrmnKPSwWOQpBr2KG4no4J5/vbZ+PyFJw/ENyZjdGdvAQFLSU9d7A3o8y
4ozEBwHGk6mGvawV6lbc8CS1sqDYeAB8ya1j9ZH9mMZKfV9+6Mfi09T2afYymNuqcNcWES8bJ
oVhIUZwBpFd9/nG43NeuLYpjZmepbTT0qH2f8vS8ZyhcjGy2FXJmuTVWvSMuHMjoQLD1rOuf5
gbqaFBMlX7oObzNrEBGIkIFF85ws4bZs/6QlQDvpi1pb64QBWuAkeM6e+Cx1SKM1ei3x3i7eE
uvkdrsnLwAdanbUEWBoiAN+fYxDIiIFVfnw5FTIMJCWIkSdOLbm+e3c+MRpDVQtwTcnZsyKg4
JcowbrLvGkle13M5+CON1KsLzVv3zf1QmTuXLnI5qleoqvZn4YKp8MhRmdV/n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jKu5clq/4L8NGbipnfO2VipKdcMqB2G/NH4M
iUDgYJ7oPqmH7K2hx8A0y+e2HrHXwXQRGWoJ4GUj/9WOvY+O+Lph0IuPK909x5XU1l6cHO2Hu
R6iNQtJ4hwkI+/oboigLpT4XKDjxjc5EclHiiB7iEklkeZQP+qtPiUHFooK22nwlKIk1ufPKe
n30Nzvhf765Z/XNvJ8c41ufyaehuGj9Zt2kHuELfyqfAvZUCmGMU/F+x2bAkPkeTXOvpXABtJ
f/4Sjy7P9kx9XLanzFAsdlfJiHL5M02oxgYFW6CfmLl6WYICWYHy7ZIetZPhNKjod5w/w6cvK
gl/nySSGywutF2o5AfuII9Va+1xBqmH6Z1MCyBPg55zCmJYwHJY2VpBJ
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
ID4gTWFydGluLCBkbyB5b3UgdGhpbmsgd2UgbmVlZCB0byBhZGQgYSB3YXJuaW5nIHRvIHRo
ZSBkb2N1bWVudGF0aW9uIG9mDQogPiAnd2luZG93LWJ1ZmZlci1jaGFuZ2UtZnVuY3Rpb25z
JyB0aGF0IGZvciB0aGUgY2FzZSB3aGVuIGEg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lcyBh
IGNhbGwgd2l0aCBudW1lcmljIHdpZHRocw0Kd2hlbmV2ZXIgZWl0aGVyIG9mIHRoZSB0d28g
dmFyaWFibGVzIHdhcyBzZXQgdG8gYSBub24tbmlsLCBub24temVybw0KdmFsdWUgaW4gdGhl
IHdpbmRvdydzIGJ1ZmZlci4NCg0KRmluYWxseSwgd2UgY291bGQgbWFrZSB0aGVzZSB2YXJp
YWJsZXMgYWxpc3RzIHdoZXJlIHRoZSBjZHIgaXMgdGhlIHdpZHRoDQphbmQgdGhlIGNhciBz
dGFuZHMgZm9yIGEgbW9kZSBvciB3aGF0ZXZlciBhIGNhbGxlciB3YW50cyB0byBzdG9yZSB0
aGVyZS4NCuKAmHNldC13aW5kb3ctbWFyZ2luc+KAmSB3aXRoIHRoZSB0IGFyZ3VtZW50cyBj
b3VsZCB0aGVuIGNvbGxlY3QgdGhlIHNpemVzDQpmcm9tIHRoZSBjZHJzIGFuZCBtb2RlcyBj
b3VsZCByZW1vdmUgYWxpc3QgZW50cmllcyBhcHByb3ByaWF0ZWx5IHdoZW4NCnRoZXkgYXJl
IHR1cm5lZCBvZmYgb3IgZGlzYXBwZWFyIGZyb20gYSB3aW5kb3cuDQoNCkFuZCBvYnZpb3Vz
bHksIGVhY2ggbW9kZSBzaG91bGQgZGVjaWRlIHdoYXQgdG8gZG8gaW4gYSB3aW5kb3cgdGhh
dCBpcw0Kbm90IHdpZGUgZW5vdWdoIHRvIHNob3cgdGhlIG1hcmdpbnMuDQoNCm1hcnRpbg0K
X-Loop: help-debbugs@HIDDEN
Subject: bug#79640: Buffer-local window-buffer-change-functions
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 18 Oct 2025 18:12:02 +0000
Resent-Message-ID: <handler.79640.B79640.17608110639307 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: martin rudalics <rudalics@HIDDEN>
Cc: 79640 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 79640-submit <at> debbugs.gnu.org id=B79640.17608110639307
(code B ref 79640); Sat, 18 Oct 2025 18:12:02 +0000
Received: (at 79640) by debbugs.gnu.org; 18 Oct 2025 18:11:03 +0000
Received: from localhost ([127.0.0.1]:47246 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vABOQ-0002Pw-1X
for submit <at> debbugs.gnu.org; Sat, 18 Oct 2025 14:11:02 -0400
Received: from mout-p-103.mailbox.org ([80.241.56.161]:42196)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vABON-0002OK-1u
for 79640 <at> debbugs.gnu.org; Sat, 18 Oct 2025 14:11:00 -0400
Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4cpqVw1h2bz9skp;
Sat, 18 Oct 2025 20:10:48 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1760811048;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=WyI7k/aoEhdG7gN80I4IaXMwENkTnIEnVbKcXeamGgY=;
b=QDmGa4gf26GcItskOU41fP3pR40FVP8fho9SHhpBU7zAwCTt1jFU4jLxgiWSnk9M7Mk1Pq
BCDvT7zCdJW1WDV1aBiF4+zcCRvey0236dMHBtNzu0sK1Ljn+XSErLLd9Mbk1dYw4R4uVX
rebzj6yCGrzRkAoxd2Xr6qKBKani9XM+1WeZPpjYkKFiudLPZACSYMx37ByLbgk1spO715
oytovyhF5jn5jmLAwMMUFjNl43h34ZFCjG2fK+wHPGL4j+IFEeePmmBkZwgm4bAFohJnpS
vDEQI6MD+iirxNvzH0gAummQwBd189iXRC0+cLvYoK8pnC0afwkVQ7ddJqAbOQ==
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <d8cff817-1f35-4b80-a312-a0f577009fee@HIDDEN>
Organization: LINKOV.NET
References: <87ecr2n9ev.fsf@HIDDEN>
<d8cff817-1f35-4b80-a312-a0f577009fee@HIDDEN>
Date: Sat, 18 Oct 2025 21:08:56 +0300
Message-ID: <87wm4sytdz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>> Martin, do you think we need to add a warning to the documentation of
>> 'window-buffer-change-functions' that for the case when a buffer
>> is removed from the window, then the buffer-local hook should use
>> something like this to detect the case that the buffer
>> with the buffer-local hook is displayed:
>>
>> (eq (window-buffer w) (current-buffer))
>
> I now tried to explain that in the Elisp manual.
Thanks.
>> (defun compilation--set-up-margin (w)
>> "Setup the margin for \"=>\" in window W if it isn't already set up."
>> - (set-window-margins w (+ (or (car (window-margins w)) 0) 2)))
>> + (when (eq (window-buffer w) (current-buffer))
>> + (set-window-margins w (+ (or (car (window-margins w)) 0) 2))))
>
> I'm not quite sure whether it does TRT when you show another buffer in
> that window and the margin should be removed. And what if you then have
> yet another mode enabled that wants margins?
Do you agree that this patch fixes the bug for the case of the
buffer-local 'window-buffer-change-functions'?
It doesn't affect another buffer that is going to be displayed
in the same window. When another buffer uses own margins,
then they will be displayed anyway after switching buffers.
> I think here and elsewhere we want something like the following: Reserve
> two buffer-local variables, say 'requested-left-margin-width' and
> 'requested-right-margin-width'. A mode like 'compilation-mode' sets up
> or adds the number of columns it needs to either of these variables and
> subtracts that number when it is disabled or another buffer is shown in
> the window and then calls
>
> (set-window-margins
> window requested-left-margin-width requested-right-margin-width)
>
> This means that whenever several modes simultaneously work on one and
> the same window, they have to update these variables accordingly and get
> margins of accumulated widths.
>
> We could also call
>
> (set-window-margins window t t)
>
> instead with the semantics that 'set-window-margins' takes the sizes of
> the margins from these values and refuses a call with numeric widths
> whenever either of the two variables was set to a non-nil, non-zero
> value in the window's buffer.
>
> Finally, we could make these variables alists where the cdr is the width
> and the car stands for a mode or whatever a caller wants to store there.
> ‘set-window-margins’ with the t arguments could then collect the sizes
> from the cdrs and modes could remove alist entries appropriately when
> they are turned off or disappear from a window.
>
> And obviously, each mode should decide what to do in a window that is
> not wide enough to show the margins.
In bug#77313 we are creating a new function 'update-window-margins' that
will call a new hook 'window-margin-functions' to sum all margin widths
requested by different packages/modes, then just call 'set-window-margins'
with the calculated values.
X-Loop: help-debbugs@HIDDEN
Subject: bug#79640: Buffer-local window-buffer-change-functions
Resent-From: martin rudalics <rudalics@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 19 Oct 2025 09:08:02 +0000
Resent-Message-ID: <handler.79640.B79640.176086488030679 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Juri Linkov <juri@HIDDEN>
Cc: 79640 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 79640-submit <at> debbugs.gnu.org id=B79640.176086488030679
(code B ref 79640); Sun, 19 Oct 2025 09:08:02 +0000
Received: (at 79640) by debbugs.gnu.org; 19 Oct 2025 09:08:00 +0000
Received: from localhost ([127.0.0.1]:58037 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vAPOR-0007yi-6Z
for submit <at> debbugs.gnu.org; Sun, 19 Oct 2025 05:07:59 -0400
Received: from mout.gmx.net ([212.227.15.18]:38525)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <rudalics@HIDDEN>) id 1vAPOO-0007xy-QI
for 79640 <at> debbugs.gnu.org; Sun, 19 Oct 2025 05:07:57 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at;
s=s31663417; t=1760864870; x=1761469670; i=rudalics@HIDDEN;
bh=Qd5JAqRfsexy94mIFm3v8+OkwXqqR4n7mpzjHpuLUNU=;
h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc:
References:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding:cc:content-transfer-encoding:
content-type:date:from:message-id:mime-version:reply-to:subject:
to;
b=mz8yhHUGPq4s3h/DTuAn7IRkaY2qTPwZS4PBTx/C8XqY0DeIf3JkmX1s/2iv3Le0
26bV3CHndTASeUWR/ZDuPupB5mICHMhGNs1knA3XrpK2tn0VAJx2XSbnPPwRtNB3B
fDiHZtYykjFP8Rng4OO7GSEBTZcGOOY3ysUR97se95jPYSH+PPLcX/HLIaxV0amWr
QnUBcgisWIpjWqq4ziMnyJaqkViWUkSv93cW1SmN88OhYB8tbKzlDb07iryXE7Lvc
YucLKBQoayvPLnDlcNROJq2dqWt/LgkF98j/8a0pSt5/fFBH6TLuj9zBMEf6MCLYC
lq1HaDqlcvQfZiFErA==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from [192.168.31.113] ([213.162.86.250]) by mail.gmx.net (mrgmx005
[212.227.17.190]) with ESMTPSA (Nemesis) id 1MbRfv-1udXcF0iSH-00gcrT; Sun, 19
Oct 2025 11:07:50 +0200
Message-ID: <7b01439f-9cc1-4f32-96c9-94017d412550@HIDDEN>
Date: Sun, 19 Oct 2025 11:07:47 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
References: <87ecr2n9ev.fsf@HIDDEN>
<d8cff817-1f35-4b80-a312-a0f577009fee@HIDDEN>
<87wm4sytdz.fsf@HIDDEN>
Content-Language: en-US
From: martin rudalics <rudalics@HIDDEN>
In-Reply-To: <87wm4sytdz.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:UKdroP1wlCDmk4TmL/VY+X92rSP7w6uRUUUpXkS4bQtThWhoTG3
S/3e9A3ipEvXdcSibfGQKjk+gzbVII5nbd+YJnI7cz6glXb1DejqDon1+tre1S25wlhaAzc
CCASaZtqMT86ATAhQ7QPydEVLyVzxiVky4Jn2BmtNIj5ACm+kqco9VsqYdFNN1JJMDdxM04
VrVcScITJI5mHWcLucRZg==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:WKv4gjC32sY=;dj7vXJJgGvfvkmEqE7myJ+HGsMH
T30sRFLbrNhi08HiGdTIdqK75MHlbnmamUKybjW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ZyEhHnxopaR3NIhvhvSKN2RIJZeWgB4QW/Q2Qu1CZzd/ArKVFaxlBU
E9M8vF9PCVaXxNcu4nR1j9ZFXoZtplaKeiTqc7wqu+5lZeM8iTRaxNtJcOU1kp9Gr/3BjEivu
MUBaObKoQhvSZI9lPAK6VWQoqnA0FtwjeifB/OAHxhjfPcy4tnAcXab5YClfjdS85vQZvhANi
nELvpYALyMhwWi7ktDvBIjUFlh+fZnFT99vhqZKriIkBer4CtUjcoQwg0iKZBuPRJvqq4Qm3h
oq4/2VPz/FMF759Po6KUE67yKI5Kh2IJWJZJrID3p5+LSEe+bzIKUM/9FP3MSM8CfDWE+yrVX
5IikyvIY0+2frwk/7UQI8rL+AlE36i/WpnFzQWVKG7UJYnM6rVJH3Qv5xONf6y+uMja2HjuiV
DdyW1vqS75QLi24e9iEJOBxJlJ1gPW8q4nI5d/qa7V5llD3AsAKpibk2y6I4XGRotLZ2hHSjv
ZjbKg8WMFcbOOs+mjlzmYQDm7pON5sd8sggxhMFBMRVfo62Y+AiB5tQRstYUW8BjpnPeL9qMt
JAw44eM5e9gOK/f4sEFloNcOMxQBWd41ol+aoDcV/VTZJf7BfhCMLm2GmsyxiwhQzTKGx7T8u
E6WD71T8mk/d3VxFl5fgKSeKOCoC/e6HHHWYMqS333VsZlQCXjU6BivLg1YpcdCP7jQblDcoY
LiSVcwVFUtdhg/UE2TetlntCuEaH5Q24fVuVwxlSsrC3vxykHG/RuhkhPM2ALxTp6CGjBYacS
SYEMr1WIdGooJJPLyEBaFdWDug7ldkS8OniYcEXPI9qa5fNSM02VuqzEsRrE51RApbmq4MFHY
oylP9YWRobAzMva2BBALlDlrdU=
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>>> (defun compilation--set-up-margin (w)
>>> "Setup the margin for \"=>\" in window W if it isn't already set up."
>>> - (set-window-margins w (+ (or (car (window-margins w)) 0) 2)))
>>> + (when (eq (window-buffer w) (current-buffer))
>>> + (set-window-margins w (+ (or (car (window-margins w)) 0) 2))))
>>
>> I'm not quite sure whether it does TRT when you show another buffer in
>> that window and the margin should be removed. And what if you then have
>> yet another mode enabled that wants margins?
>
> Do you agree that this patch fixes the bug for the case of the
> buffer-local 'window-buffer-change-functions'?
FWIW, I agree. I don't know enough about compilation mode, but your
proposal should handle the case where a compilation window is made to
show an unrelated buffer, 'window-buffer-change-functions' eventually
kick in and set the margins of that other buffer.
> It doesn't affect another buffer that is going to be displayed
> in the same window. When another buffer uses own margins,
> then they will be displayed anyway after switching buffers.
Unless 'set-window-buffer' is called with KEEP-MARGINS non-nil, I
presume. IIRC we do that only when splitting windows so it hopefully
won't matter here.
> In bug#77313 we are creating a new function 'update-window-margins' that
> will call a new hook 'window-margin-functions' to sum all margin widths
> requested by different packages/modes, then just call 'set-window-margins'
> with the calculated values.
Who would run 'window-margin-functions'? Wouldn't it be sufficient to
have set_window_buffer check a buffer local variable and calculate the
margins from that? In which case modes like 'compilation-mode' would
not need 'window-buffer-change-functions'. Setting that variable and
calling 'update-window-margins' when the mode is turned on or off would
be sufficient. And instead of 'update-window-margins' you could run the
entire logic within 'set-window-margins' (which 'update-window-margins'
would have to run anyway) with the 't' args I proposed earlier.
But note the following small loophole: 'set-window-configuration' does
not run set_window_buffer when a window's buffer has changed within an
excursion and will merciless restore old margins. If it did not restore
margins, showing the previous buffer again would probably reuse the
margins shown within the excursion. This means that a mode turned
off/on within an excursion would lose its margin settings. OTOH we
probably cannot have 'set-window-configuration' run set_window_buffer
because we might not like any changes that come along with that. And
'window-buffer-change-functions' might not catch this because the buffer
of the window will not have changed if the excursion happens within two
redisplays. So to be on the safe side 'set-window-configuration' will
have to update margins whenever a buffer has changed. There might be
similar cases too, you'd have to check all occurrences of wset_buffer in
our sources.
martin
X-Loop: help-debbugs@HIDDEN
Subject: bug#79640: Buffer-local window-buffer-change-functions
Resent-From: Juri Linkov <juri@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 19 Oct 2025 18:00:02 +0000
Resent-Message-ID: <handler.79640.B79640.176089675520489 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 79640
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: martin rudalics <rudalics@HIDDEN>
Cc: 79640 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 79640-submit <at> debbugs.gnu.org id=B79640.176089675520489
(code B ref 79640); Sun, 19 Oct 2025 18:00:02 +0000
Received: (at 79640) by debbugs.gnu.org; 19 Oct 2025 17:59:15 +0000
Received: from localhost ([127.0.0.1]:37425 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vAXgY-0005KN-Vx
for submit <at> debbugs.gnu.org; Sun, 19 Oct 2025 13:59:15 -0400
Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:38002)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>)
id 1vAXgV-0005Jq-02; Sun, 19 Oct 2025 13:59:12 -0400
Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4cqRBt6Ywqz9smC;
Sun, 19 Oct 2025 19:59:02 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1760896742;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=0d++XlBzuakz6FTdneNQ+YRGqFdU18juWlQIbphnCmM=;
b=cWjhxa3fxL5nS21mtRliyQMEmWQfPFSkK+u1PKfvUGNtsWlnwQK+zWmJyUwHwMGogPnyeS
dhxP0eX0bE4r7XnwIz1Pja2V8iT30F7DYolapS8HwB2OmT+l7KCJ0qwRkl+Rf+ckLAUf3N
r2xIXy0hbPH78/5ph6waOf3OgsopB2xrZg5WpkBwrFGOVKd9nAR+k5YDXH6su2LIGhxyqS
CnPIebPNAGxNLgF8z0Ry7217XWYDxIebfhU0DAGpADpy9csbYq4ikeek9lxryxlJBkjwru
M+llB6rP12RL0Q97AiMy1NIIDlQVa6fJB5OxZCYDRkATGRCZN/6AqXMkr4x00A==
From: Juri Linkov <juri@HIDDEN>
In-Reply-To: <7b01439f-9cc1-4f32-96c9-94017d412550@HIDDEN>
Organization: LINKOV.NET
References: <87ecr2n9ev.fsf@HIDDEN>
<d8cff817-1f35-4b80-a312-a0f577009fee@HIDDEN>
<87wm4sytdz.fsf@HIDDEN>
<7b01439f-9cc1-4f32-96c9-94017d412550@HIDDEN>
Date: Sun, 19 Oct 2025 20:56:55 +0300
Message-ID: <87zf9m7p5c.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
close 79640 31.0.50
thanks
>>>> (defun compilation--set-up-margin (w)
>>>> "Setup the margin for \"=>\" in window W if it isn't already set up."
>>>> - (set-window-margins w (+ (or (car (window-margins w)) 0) 2)))
>>>> + (when (eq (window-buffer w) (current-buffer))
>>>> + (set-window-margins w (+ (or (car (window-margins w)) 0) 2))))
>>>
>>> I'm not quite sure whether it does TRT when you show another buffer in
>>> that window and the margin should be removed. And what if you then have
>>> yet another mode enabled that wants margins?
>>
>> Do you agree that this patch fixes the bug for the case of the
>> buffer-local 'window-buffer-change-functions'?
>
> FWIW, I agree. I don't know enough about compilation mode, but your
> proposal should handle the case where a compilation window is made to
> show an unrelated buffer, 'window-buffer-change-functions' eventually
> kick in and set the margins of that other buffer.
>
>> It doesn't affect another buffer that is going to be displayed
>> in the same window. When another buffer uses own margins,
>> then they will be displayed anyway after switching buffers.
>
> Unless 'set-window-buffer' is called with KEEP-MARGINS non-nil, I
> presume. IIRC we do that only when splitting windows so it hopefully
> won't matter here.
Ok, so now pushed the patch and closed this bug report.
>> In bug#77313 we are creating a new function 'update-window-margins' that
>> will call a new hook 'window-margin-functions' to sum all margin widths
>> requested by different packages/modes, then just call 'set-window-margins'
>> with the calculated values.
>
> Who would run 'window-margin-functions'? Wouldn't it be sufficient to
> have set_window_buffer check a buffer local variable and calculate the
> margins from that? In which case modes like 'compilation-mode' would
> not need 'window-buffer-change-functions'. Setting that variable and
> calling 'update-window-margins' when the mode is turned on or off would
> be sufficient. And instead of 'update-window-margins' you could run the
> entire logic within 'set-window-margins' (which 'update-window-margins'
> would have to run anyway) with the 't' args I proposed earlier.
>
> But note the following small loophole: 'set-window-configuration' does
> not run set_window_buffer when a window's buffer has changed within an
> excursion and will merciless restore old margins. If it did not restore
> margins, showing the previous buffer again would probably reuse the
> margins shown within the excursion. This means that a mode turned
> off/on within an excursion would lose its margin settings. OTOH we
> probably cannot have 'set-window-configuration' run set_window_buffer
> because we might not like any changes that come along with that. And
> 'window-buffer-change-functions' might not catch this because the buffer
> of the window will not have changed if the excursion happens within two
> redisplays. So to be on the safe side 'set-window-configuration' will
> have to update margins whenever a buffer has changed. There might be
> similar cases too, you'd have to check all occurrences of wset_buffer in
> our sources.
Thanks for the explanations. Let's move the designing of this new feature
to emacs-devel. I'll start a new thread there.
Received: (at control) by debbugs.gnu.org; 19 Oct 2025 17:59:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 19 13:59:19 2025 Received: from localhost ([127.0.0.1]:37427 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vAXgd-0005Kc-FY for submit <at> debbugs.gnu.org; Sun, 19 Oct 2025 13:59:19 -0400 Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:38002) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1vAXgV-0005Jq-02; Sun, 19 Oct 2025 13:59:12 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4cqRBt6Ywqz9smC; Sun, 19 Oct 2025 19:59:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1760896742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0d++XlBzuakz6FTdneNQ+YRGqFdU18juWlQIbphnCmM=; b=cWjhxa3fxL5nS21mtRliyQMEmWQfPFSkK+u1PKfvUGNtsWlnwQK+zWmJyUwHwMGogPnyeS dhxP0eX0bE4r7XnwIz1Pja2V8iT30F7DYolapS8HwB2OmT+l7KCJ0qwRkl+Rf+ckLAUf3N r2xIXy0hbPH78/5ph6waOf3OgsopB2xrZg5WpkBwrFGOVKd9nAR+k5YDXH6su2LIGhxyqS CnPIebPNAGxNLgF8z0Ry7217XWYDxIebfhU0DAGpADpy9csbYq4ikeek9lxryxlJBkjwru M+llB6rP12RL0Q97AiMy1NIIDlQVa6fJB5OxZCYDRkATGRCZN/6AqXMkr4x00A== From: Juri Linkov <juri@HIDDEN> To: martin rudalics <rudalics@HIDDEN> Subject: Re: bug#79640: Buffer-local window-buffer-change-functions In-Reply-To: <7b01439f-9cc1-4f32-96c9-94017d412550@HIDDEN> Organization: LINKOV.NET References: <87ecr2n9ev.fsf@HIDDEN> <d8cff817-1f35-4b80-a312-a0f577009fee@HIDDEN> <87wm4sytdz.fsf@HIDDEN> <7b01439f-9cc1-4f32-96c9-94017d412550@HIDDEN> Date: Sun, 19 Oct 2025 20:56:55 +0300 Message-ID: <87zf9m7p5c.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control Cc: 79640 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) close 79640 31.0.50 thanks >>>> (defun compilation--set-up-margin (w) >>>> "Setup the margin for \"=>\" in window W if it isn't already set up." >>>> - (set-window-margins w (+ (or (car (window-margins w)) 0) 2))) >>>> + (when (eq (window-buffer w) (current-buffer)) >>>> + (set-window-margins w (+ (or (car (window-margins w)) 0) 2)))) >>> >>> I'm not quite sure whether it does TRT when you show another buffer in >>> that window and the margin should be removed. And what if you then have >>> yet another mode enabled that wants margins? >> >> Do you agree that this patch fixes the bug for the case of the >> buffer-local 'window-buffer-change-functions'? > > FWIW, I agree. I don't know enough about compilation mode, but your > proposal should handle the case where a compilation window is made to > show an unrelated buffer, 'window-buffer-change-functions' eventually > kick in and set the margins of that other buffer. > >> It doesn't affect another buffer that is going to be displayed >> in the same window. When another buffer uses own margins, >> then they will be displayed anyway after switching buffers. > > Unless 'set-window-buffer' is called with KEEP-MARGINS non-nil, I > presume. IIRC we do that only when splitting windows so it hopefully > won't matter here. Ok, so now pushed the patch and closed this bug report. >> In bug#77313 we are creating a new function 'update-window-margins' that >> will call a new hook 'window-margin-functions' to sum all margin widths >> requested by different packages/modes, then just call 'set-window-margins' >> with the calculated values. > > Who would run 'window-margin-functions'? Wouldn't it be sufficient to > have set_window_buffer check a buffer local variable and calculate the > margins from that? In which case modes like 'compilation-mode' would > not need 'window-buffer-change-functions'. Setting that variable and > calling 'update-window-margins' when the mode is turned on or off would > be sufficient. And instead of 'update-window-margins' you could run the > entire logic within 'set-window-margins' (which 'update-window-margins' > would have to run anyway) with the 't' args I proposed earlier. > > But note the following small loophole: 'set-window-configuration' does > not run set_window_buffer when a window's buffer has changed within an > excursion and will merciless restore old margins. If it did not restore > margins, showing the previous buffer again would probably reuse the > margins shown within the excursion. This means that a mode turned > off/on within an excursion would lose its margin settings. OTOH we > probably cannot have 'set-window-configuration' run set_window_buffer > because we might not like any changes that come along with that. And > 'window-buffer-change-functions' might not catch this because the buffer > of the window will not have changed if the excursion happens within two > redisplays. So to be on the safe side 'set-window-configuration' will > have to update margins whenever a buffer has changed. There might be > similar cases too, you'd have to check all occurrences of wset_buffer in > our sources. Thanks for the explanations. Let's move the designing of this new feature to emacs-devel. I'll start a new thread there.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.