From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#29279: Sharing the margins Date: Sun, 19 Nov 2017 01:55:23 +0200 Message-ID: <463d412b-6a5d-eda5-d882-b4044d4f417d@yandex.ru> References: <0a54e927-cab1-1f1d-4996-85bb36949a33@yandex.ru> <83375imbaa.fsf@gnu.org> <83o9o6kp61.fsf@gnu.org> <83h8tykm99.fsf@gnu.org> <83375glvx4.fsf@gnu.org> <0547e92c-a574-0fe4-6122-1d11b24ee3c5@yandex.ru> <83efp0jjhi.fsf@gnu.org> <77ddb7fc-d57f-05fa-026c-e23e3bcd3432@yandex.ru> <83a7znjuc5.fsf@gnu.org> <9bbfd79b-9e80-db5a-fe57-d0d629477d5d@yandex.ru> <83shdei5o8.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1511049375 19772 195.159.176.226 (18 Nov 2017 23:56:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Nov 2017 23:56:15 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Thunderbird/57.0 Cc: 29279@debbugs.gnu.org, joostkremers@fastmail.fm To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 19 00:56:10 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 1eGCy0-0004Zz-L0 for geb-bug-gnu-emacs@m.gmane.org; Sun, 19 Nov 2017 00:56:08 +0100 Original-Received: from localhost ([::1]:51439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGCy4-0004yW-Qg for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Nov 2017 18:56:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGCxx-0004yF-QA for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 18:56:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGCxu-00071i-OF for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 18:56:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37949) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGCxu-00071c-Ks for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 18:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eGCxu-0006dH-E5 for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2017 18:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Nov 2017 23:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29279 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29279-submit@debbugs.gnu.org id=B29279.151104933325455 (code B ref 29279); Sat, 18 Nov 2017 23:56:02 +0000 Original-Received: (at 29279) by debbugs.gnu.org; 18 Nov 2017 23:55:33 +0000 Original-Received: from localhost ([127.0.0.1]:46630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGCxQ-0006cU-SN for submit@debbugs.gnu.org; Sat, 18 Nov 2017 18:55:33 -0500 Original-Received: from mail-wm0-f48.google.com ([74.125.82.48]:40503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGCxP-0006cI-3Z for 29279@debbugs.gnu.org; Sat, 18 Nov 2017 18:55:31 -0500 Original-Received: by mail-wm0-f48.google.com with SMTP id b189so12380316wmd.5 for <29279@debbugs.gnu.org>; Sat, 18 Nov 2017 15:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Bao8NrGov917UoK57AFbSsA8ERJXirwNM9Z0f79mjqs=; b=LZnQks8QEEFletrNjS6AvH+yGE1XjIk5BWShaSlwZELPrIYjRbjYqSXmPx4fenRJko huYlj6fyvc8zBMnwJi7njVwaa1jDVHytIwdS2ILJ5dQOAvxl/Jvw7PBjzudXgUmRFB6S /+7F+lxdR6ydfWL4DTOgajxwJyT9b66miQ1fTqb+x7M0TZvPFmEsz1rOPPaVGpqIJOCs SzArmcUy2j+yH5C7FLTkz5arwmdixsahk3+5WqmySKtYx304i3KhO85+oGNDmqfrPrlA Nam8Rib8M2Fc3iVIw8XstvgYDTnMAMqSC/PJIUUAxsRLHdTBwd58ZZVcofKgKMq0w4fP g7Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Bao8NrGov917UoK57AFbSsA8ERJXirwNM9Z0f79mjqs=; b=X61j4v285lfoElFENbWZW9meqmNAk29jN85pRmuArPTwq7f/Yom8rARGtk58UY9F7e TbY/+VbSXXTZGQelEoTcgN0l/+sYfrMjOkQdE/07iqHupbKXGYeb1r60TUMALhMtgVei 8B+rfqmy7cc4/+Y/S7kiDNbOLhQPvAC9LwYlQN0vBFBnbf9Qktn3OnIIuszd5wfLCZnv sa1bAnvsUwLBMqOzRtDdjdD2nkYb2H7Qkf9ekV/XP4JD+GInOe8iC+xq5FvDWzF+8HQp ie7dSAyzfGChz5LRYlWozb2fsEXh4Xjwu7Co3OT9IZi3vHBTkTe8XJnBHJoHu29ALOq6 tmHw== X-Gm-Message-State: AJaThX7hPelxKw+RBpGouCd0iucPt450uverGdOwBZNdhqPVGG+cVRFC uBlLqy4e/mVvnVIL+Th4mgk= X-Google-Smtp-Source: AGs4zMYRuVn/N6FG6GcE7aGygJ/550xO76mDRcIJ57KXkHvyqgu1qJ3zCPemm5YgEsb0kB/9CRbteA== X-Received: by 10.28.136.15 with SMTP id k15mr7449244wmd.147.1511049325380; Sat, 18 Nov 2017 15:55:25 -0800 (PST) Original-Received: from [192.168.1.3] ([185.105.174.193]) by smtp.googlemail.com with ESMTPSA id p79sm5869326wmf.43.2017.11.18.15.55.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2017 15:55:24 -0800 (PST) In-Reply-To: <83shdei5o8.fsf@gnu.org> Content-Language: en-US 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:140072 Archived-At: On 11/16/17 5:50 PM, Eli Zaretskii wrote: >> Sounds straightforward to me. Since we know the sizes of all the columns >> in advance, we can just substract them from the target total width, and >> pad with the resulting number of spaces. > > Maybe, but IME things are rarely so easy. In that case, I think we've made sure they are easy (by requiring all columns' widths to be known in advance). >> Further, even though we have a separate accessor for its width >> (line-number-display-width), if a package depends on it and needs to >> draw something based on its value, it should want to be notified when >> there is a change (*). window-configuration-change-hook seems natural. >> Unless we have a separate hook for that? > > The way this feature is designed and implemented, it doesn't lend > itself easily to hooks, primarily because it works in the inner-most > level of redisplay. Then maybe using the margins for it will be a necessary price, with the corresponding performance hit (though hopefully not), just to enable the extensibility our users are accustomed to. >> Can't you save the necessary data to a variable, finish redisplay, >> and then run the hook (if the data says so)? > > That would be pointless, because there are already hooks which work > before redisplay or after it finishes. All such a hook needs to do is > compare the value returned by line-number-display-width with the last > value it saw. That's what I did in tabulated-list-mode, which has > some unique requirements in this area. Avoiding the comparison > doesn't justify a new hook. Hmm, I'm not sure it would be as pointless as you say: normally, it's most important to be notified of some change _eventually_, and not necessarily during some process such as redisplay. It would at least save the user the problem of puzzling out how to do this, and what to compare. On the other hand, it could be the argument for margin changes not to run the usual hooks, because any sane called could compare margin widths before and after. > And anyway, what do you envision that a hook function will want to do? > Most probably, it will want to change the window dimensions, or affect > what's on display in some other way, which means an immediate second > redisplay cycle. Affect what's on display, yes, most likely. > So we gain nothing by making the display engine call > the hook. Yeah. I was suggesting to call the hook later, though. >> It's somewhat hypothetical, but I'd like to refer to (*) above. That is, >> somebody will probably ask for that anyway, sooner or later. > > Somebody already did, and I declined for now, because I think the same > effect can be achieved via existing hooks. Do you have margin-using examples that likewise couldn't be "achieved via existing hooks" if margin changes didn't call window-configuration-change-hook?