From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28844: 26.0.90; display-line-numbers-mode should call window-configuration-change-hook Date: Sun, 15 Oct 2017 17:59:04 +0300 Message-ID: <83o9p8h2yv.fsf@gnu.org> References: <1508054203.3504379.1139170720.0D0E99E9@webmail.messagingengine.com> <59E32D49.4030007@gmx.at> <1508065717.3534312.1139251176.600E646A@webmail.messagingengine.com> <59E350AE.3060005@gmx.at> <1508074073.3557079.1139314312.4BFE5BC2@webmail.messagingengine.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1508079622 609 195.159.176.226 (15 Oct 2017 15:00:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 15 Oct 2017 15:00:22 +0000 (UTC) Cc: 28844@debbugs.gnu.org To: Paul Rankin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 15 17:00:15 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3kOc-0006dE-Dc for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Oct 2017 17:00:06 +0200 Original-Received: from localhost ([::1]:57491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3kOj-0006BT-Iq for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Oct 2017 11:00:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3kOd-000697-Tp for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 11:00:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3kOY-0006h8-FS for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 11:00:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33090) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e3kOY-0006gj-By for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 11:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e3kOY-0000Xy-4X for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 11:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Oct 2017 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28844 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28844-submit@debbugs.gnu.org id=B28844.15080795602014 (code B ref 28844); Sun, 15 Oct 2017 15:00:02 +0000 Original-Received: (at 28844) by debbugs.gnu.org; 15 Oct 2017 14:59:20 +0000 Original-Received: from localhost ([127.0.0.1]:41771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3kNr-0000WQ-PI for submit@debbugs.gnu.org; Sun, 15 Oct 2017 10:59:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3kNq-0000WE-Fz for 28844@debbugs.gnu.org; Sun, 15 Oct 2017 10:59:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3kNg-0005Wv-JR for 28844@debbugs.gnu.org; Sun, 15 Oct 2017 10:59:13 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3kNg-0005WS-Eu; Sun, 15 Oct 2017 10:59:08 -0400 Original-Received: from [176.228.60.248] (port=4896 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e3kNf-00037Z-S4; Sun, 15 Oct 2017 10:59:08 -0400 In-reply-to: <1508074073.3557079.1139314312.4BFE5BC2@webmail.messagingengine.com> (message from Paul Rankin on Sun, 15 Oct 2017 23:27:53 +1000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138461 Archived-At: > From: Paul Rankin > Date: Sun, 15 Oct 2017 23:27:53 +1000 > Cc: 28844@debbugs.gnu.org > > This is all I should have to do, where WINDOW is the selected window and MARGIN is an integer: > > - (set-window-margins window margin margin)) > + (set-window-margins window (if (featurep 'display-line-numbers) > + (- margin (line-number-display-width)) > + margin) > + margin)) Exactly. So why do you need a hook? Just call this every time you need the value, and you will have the up-to-date one. > Cool. As long as there is a hook. I appreciate inclusion of the function line-number-display-width, but introducing compatibility-breaking code then putting the onus on others to work around it is kinda rude. If there is a proper hook it eases the pain a bit. If that's the problem, then you could provide a wrapper around line-number-display-width for older versions of Emacs, which would always return zero for those versions. Or even explicitly check for display-line-numbers being nil, which it always will be in older versions, and return zero even without calling line-number-display-width. I believe this is the standard way of dealing with these problems.