From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Rankin Newsgroups: gmane.emacs.bugs Subject: bug#28844: 26.0.90; display-line-numbers-mode should call window-configuration-change-hook Date: Mon, 16 Oct 2017 13:22:00 +1000 Message-ID: <1508124120.3709085.1139805520.1F653A1C@webmail.messagingengine.com> 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> <83o9p8h2yv.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1508124189 13689 195.159.176.226 (16 Oct 2017 03:23:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Oct 2017 03:23:09 +0000 (UTC) Cc: 28844@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 16 05:23:05 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 1e3vzc-0002lN-0k for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Oct 2017 05:23:04 +0200 Original-Received: from localhost ([::1]:59153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3vzj-0008MS-F6 for geb-bug-gnu-emacs@m.gmane.org; Sun, 15 Oct 2017 23:23:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e3vzd-0008MB-4m for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 23:23:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e3vzZ-0004HC-Ut for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 23:23:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e3vzZ-0004Gy-QU for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 23:23:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e3vzZ-0001P7-Hi for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2017 23:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Rankin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Oct 2017 03:23:01 +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.15081241245323 (code B ref 28844); Mon, 16 Oct 2017 03:23:01 +0000 Original-Received: (at 28844) by debbugs.gnu.org; 16 Oct 2017 03:22:04 +0000 Original-Received: from localhost ([127.0.0.1]:42247 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3vye-0001Nm-68 for submit@debbugs.gnu.org; Sun, 15 Oct 2017 23:22:04 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:46891) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3vyc-0001Ne-39 for 28844@debbugs.gnu.org; Sun, 15 Oct 2017 23:22:02 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id ABAB020B88; Sun, 15 Oct 2017 23:22:00 -0400 (EDT) Original-Received: from web5 ([10.202.2.215]) by compute3.internal (MEProxy); Sun, 15 Oct 2017 23:22:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paulwrankin.com; h=cc:content-transfer-encoding:content-type:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=7T5J3lcUZizQx3IEH jtR05cqzGrEKMmmnO14ZsSUt3A=; b=d6TqPtYafZUaVZVawDg/ymwRUZqHnunYV awVVcGdTUMDHU5qzO1DhtZT+ryEvV+/bA0OFYF1wSRAq9+iPBj4WgCx3cNcTzrDx /0MpWJS6kg4jULP4n4rFLKGR8d0QlDBwT+tDFdSvW/Ug6kYLTMZyqtzRLr1eyuIf CXrsumrXMWHLiHqdjCGrrEZpRIZ82iLc8ZKvZ+Vtl7NWyTKI6pggxTx1ffgaKNFE fRvCcSu3BMHbpkiLUe/JLRAhfiHaO7QmrMCxwIWGpw1QGr1jaBfK8mthOGJJG7on Z+8OG+v5aW2FDVJuigj60su4m3VTES24aMJ9PxEHa7li1/G7rVDTw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=7T5J3l cUZizQx3IEHjtR05cqzGrEKMmmnO14ZsSUt3A=; b=CgRFPqziR+qANBcbEzzCFX AJuhlPTGEnIMmiAY02ixhBEYDuLF1GQlpBVXJhk3CN0WUCUOq2xdz375wNiMiO0c LkSi6/WVPwzw2xoRFq3+44NQDUjZbczxqPxeeuiVv2QfY3I+nwUMmZ6z1VCyJh51 1RHDqLcK9SEg3fikOlgJhra/yEBlM8972Rhr5LhUzwzGX69nawGf7xJFv1I5ywqh +0GzbD3doXMwpqofS4u3URzh6TDbIR+MGdPLeeuIjxLmLLSeuHnUpWTph9sU1zav SRGG3S/ZBF9tYDYuc4InTH93Dyl+Kl+pwjYd570IVZtc6mCpQ/zYmnZDh4uvM8bw == X-ME-Sender: Original-Received: by mailuser.nyi.internal (Postfix, from userid 99) id 7AD619E302; Sun, 15 Oct 2017 23:22:00 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface - ajax-26fdae60 In-Reply-To: <83o9p8h2yv.fsf@gnu.org> 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:138493 Archived-At: On Mon, 16 Oct 2017, at 12:59 AM, Eli Zaretskii wrote: > > From: Paul Rankin > > Date: Sun, 15 Oct 2017 23:27:53 +1000 > > Cc: 28844@debbugs.gnu.org > >=20 > > This is all I should have to do, where WINDOW is the selected window an= d MARGIN is an integer: > >=20 > > - (set-window-margins window margin margin)) > > + (set-window-margins window (if (featurep 'display-line-numbers) > > + (- margin (line-number-display-wi= dth)) > > + margin) > > + margin)) >=20 > 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. Because this doesn=E2=80=99t work. If it did I wouldn=E2=80=99t be posting = it. Think about it; your mode updates the display on its own without notify= ing Emacs. The basic conceptual problem is that =E2=80=9Cevery time you nee= d the value=E2=80=9D is predicated on when display-line-numbers-mode change= s the value. There=E2=80=99s no way for another lisp program to know when t= hat is. > > Cool. As long as there is a hook. I appreciate inclusion of the functio= n line-number-display-width, but introducing compatibility-breaking code th= en putting the onus on others to work around it is kinda rude. If there is = a proper hook it eases the pain a bit. >=20 > 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. If you=E2=80=99ve introduced a problem into Emacs without the forethought o= n how it will adversely affect existing code, the onus is on you to either = remove or fix it. Function featurep is enough to know if display-line-numbe= rs is present (as above).